Skip to content

Limit tshd notifications to one per kind per root cluster#62031

Merged
ravicious merged 2 commits intomasterfrom
r7s/notification-key
Jan 7, 2026
Merged

Limit tshd notifications to one per kind per root cluster#62031
ravicious merged 2 commits intomasterfrom
r7s/notification-key

Conversation

@ravicious
Copy link
Copy Markdown
Member

@ravicious ravicious commented Dec 5, 2025

Closes #51336.

changelog: Fixed an issue where Teleport Connect could generate a flurry of notifications about not being able to connect to a resource

You can see in Bartosz's report that Connect can generate a bunch of notifications. In this case it's about an app proxy not being able to connect to the app because the user did not relogin within 1 minute. This can happen when a program repeatedly tries to connect to a proxied resource over the course of a night. When you open Connect the next day, you're greeted by a flurry of notifications that's impossible to close manually because there's so many of them.

My solution to this is to add a key property to a notification. Notifications with the same key overwrite each other. This enables us to limit tshd notifications to one per kind per root cluster. This way if there are multiple clients hammering multiple local proxies all belonging to the same cluster, the user is only ever going to see a single notification in Connect.

Sure, we lose some information, but the notifications are not supposed to be detailed diagnostic reports, merely a sign that something went wrong. If the user sees a single notification about not being able to relogin, they should still know what to do.

There are already callsites where we manually apply the one notification limit (e.g., in AppContext). The new key property will remove the need to store the notification ID manually and instead the callsite will be able to just pass constant key to the notifications service.


I tested this by logging in as a user with short TTL, then starting a Postgres gateway, waiting for the cert to expire and then attempting to connect to the proxy through multiple psql invocations in separate shell sessions.

This necessitated refactoring the state of the service from an array to
a map.
@ravicious ravicious force-pushed the r7s/notification-key branch from 92b93ef to 40240c0 Compare December 5, 2025 17:50
@ravicious ravicious marked this pull request as ready for review December 8, 2025 11:26
@github-actions github-actions bot requested review from kimlisa and kiosion December 8, 2025 11:26
@ravicious ravicious removed the request for review from kiosion December 8, 2025 11:27
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, this mechanism is so elegant.

@ravicious
Copy link
Copy Markdown
Member Author

@kimlisa ping

@ravicious ravicious requested review from avatus and removed request for kimlisa December 18, 2025 10:57
@ravicious ravicious added this pull request to the merge queue Jan 7, 2026
Merged via the queue into master with commit 447009d Jan 7, 2026
46 checks passed
@ravicious ravicious deleted the r7s/notification-key branch January 7, 2026 12:11
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@ravicious See the table below for backport results.

Branch Result
branch/v17 Failed
branch/v18 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toast notifications do not disappear automatically

3 participants