Repository navigation
fix(client): resubscribe a connected shell stuck synchronizing - #908
Merged
Merged
Conversation
A connected environment's thread list could stay on "Syncing threads…" until the app was next foregrounded. After 30 s connected and still synchronizing, the shell now resubscribes (backing off to 4 min) and reports a counts-and-flags diagnostic to Sentry on desktop and mobile, so the next occurrence shows why it stalled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On mobile, with two paired environments, the thread list for one of them sometimes stayed on "Syncing threads…" and went stale. It recovered only after the app was foregrounded again. Server traces on both hosts show every subscription answered within milliseconds, with its completion marker. So the client sometimes never moved that environment's shell to live, and nothing retried while the connection stayed healthy. The exact client path is still unknown, and the app cannot report it.
Fix
EnvironmentShellStatewatches for a shell that stayssynchronizingwhile its connection isconnected. After 30 s it resubscribes, doubling the wait up to 4 min while it stays stuck. The supervisor still owns disconnected and connecting states.environment_shell_stalledthrough a newClientDiagnosticsreference, which defaults to a no-op. The report holds only counts and flags: awaiting completion, held snapshot, subscription on the live session, verification pending or rejected. Desktop and mobile send it to Sentry as a warning, only when error reports are on. The next occurrence then shows which path dropped the marker.shell-synctest covers this: no resubscribe while connecting, a resubscribe plus a report once connected, then silence after the marker. It fails onmain.🤖 Generated with Claude Code