Repository navigation
fix(desktop): recover stale remote backends and scope profile caches per connection - #102673
Closed
SmelterLabs wants to merge 1 commit into
Closed
SmelterLabs wants to merge 1 commit into
SmelterLabs wants to merge 1 commit into
Conversation
This was referenced Sep 9, 2026
…per connection Five related defects in the desktop's remote-backend handling, all reachable from normal multi-gateway use: - Foreground registry-profile activation trusted the cached backend. It now probes the exact cached entry (revalidateConnectionFor) and retires its pool/transport scope when the probe shows it stale. - The two revalidation paths raced each other. They now serialize through a single-flight coordinator. - Profile caches were global, so profiles leaked across gateways. They are now connection-scoped. - A bare profile name spawned a same-named local child instead of routing to the active registry socket. This misroutes any remote profile whose display name differs from its default key. - An active chat backend could be taken by the idle reaper mid-conversation. touchBackend now keepalives it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SmelterLabs
force-pushed
the
pr/desktop-stale-backend-recovery
branch
from
September 18, 2026 17:21
a95ba4e to
3e8f742
Compare
Author
|
Closing: superseded by the v2026.9.21 shared-backend redesign. The profile-cache scoping and dispatch-time recovery from this PR landed upstream independently, and the remaining pre-activation handshake and prewarm guard were written for the old one-backend-per-profile model, which the new supervisor in electron/main.ts replaces. Thanks for the review time. |
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.
What this fixes
Five related defects in the desktop app's remote-backend handling. All of them are reachable from ordinary multi-gateway use, and we have been carrying this patch downstream since 2026-08-26 on a daily-updated fork, so it has real runtime hours behind it.
1. Foreground profile activation trusted a stale cache. Activating a registry profile took the cached backend at face value. It now probes that exact cached entry via
revalidateConnectionForand retires the pool/transport scope when the probe comes back stale, instead of handing the UI a dead backend.2. The two revalidation paths raced. Both could run concurrently against the same connection. They now serialize through a single-flight coordinator.
3. Profile caches leaked across gateways. The cache was global, so profiles from one gateway could surface against another. Caches are now connection-scoped.
4. A bare profile name spawned the wrong thing. Given a bare name, the desktop spawned a same-named local child rather than routing to the active registry socket. This misroutes any remote profile whose display name differs from its default key.
5. The idle reaper could take an in-use backend. An active chat backend was eligible for reaping mid-conversation.
touchBackendnow keepalives it.Testing
tsc --noEmitclean.vitest run src/store/connections.test.ts src/store/profile.test.ts src/store/gateway-agent-scope.test.ts src/store/gateway-profile-request.test.ts— 4 files, 76 tests, all passing against currentmain(63279301b).connections.test.ts,gateway-agent-scope.test.ts, andgateway-profile-request.test.ts.Notes
Cherry-picked cleanly onto current
mainwith no conflicts. Happy to split this into five separate PRs if that is easier to review — they are independent fixes that happened to land together, and the shared surface isstore/connections.tsandstore/gateway.ts.🤖 Generated with Claude Code