fix(desktop): scope active session lookup - #89616
Closed
helix4u wants to merge 2 commits into
Closed
Conversation
Collaborator
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 does this PR do?
Scopes
resolveStoredSession()'s first by-ID lookup to the renderer's active Desktop profile.Desktop's gateway socket and Electron REST routing are separate. Activating a non-default Bot profile updates the gateway, but an unscoped REST request still goes to the primary backend. The resolver then excluded the active profile from its fallback probes because it assumed that unscoped request had already checked it. A stored Bot Chat owned by the active non-default profile could therefore 404 on the primary backend and time out without ever querying its actual owner.
The active profile is now explicit on the first lookup and remains authoritative even when a pooled or remote backend reports its own local alias.
Related Issue
Discord support report: https://discord.com/channels/1053877538025386074/1539430577185497138
Type of Change
Changes Made
apps/desktop/src/app/session/hooks/use-session-actions/utils.ts: route the initial stored-session lookup through the active profile instead of the primary REST backend.apps/desktop/src/app/session/hooks/use-session-actions/resolve-stored-session.test.ts: cover a session that exists only on the active non-default profile and update the resolver ladder assertions.How to Test
Session not foundtimeout.Focused verification on Windows 11:
vitest run --project ui src/app/session/hooks/use-session-actions/resolve-stored-session.test.ts(10 passed)git diff --check(passed)The full Desktop typecheck was attempted, but this workstation's shared dependency cache does not yet contain the
blobatarpackage already declared by currentmain; TypeScript stops insrc/sdk/index.tsbefore reaching this patch. GitHub CI will install the current lockfile dependencies.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
The regression is covered at the resolver boundary: current
mainsends the first lookup without a profile, while the fixed path sendsgetSession(storedSessionId, activeProfile)and succeeds without probing unrelated profiles.