Skip to content

fix(desktop): scope active session lookup - #89616

Closed
helix4u wants to merge 2 commits into
NousResearch:mainfrom
helix4u:fix/desktop-bot-profile-session-lookup
Closed

fix(desktop): scope active session lookup#89616
helix4u wants to merge 2 commits into
NousResearch:mainfrom
helix4u:fix/desktop-bot-profile-session-lookup

Conversation

@helix4u

@helix4u helix4u commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

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

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

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

  1. Configure a local non-default Desktop profile with an existing stored Bot Chat.
  2. Open that bot from the Bots pane while the primary backend belongs to another profile.
  3. Verify Desktop queries the bot's active profile, resolves the session owner, and hydrates the transcript without a primary-backend Session not found timeout.

Focused verification on Windows 11:

  • vitest run --project ui src/app/session/hooks/use-session-actions/resolve-stored-session.test.ts (10 passed)
  • focused ESLint (passed)
  • focused Prettier check (passed)
  • git diff --check (passed)

The full Desktop typecheck was attempted, but this workstation's shared dependency cache does not yet contain the blobatar package already declared by current main; TypeScript stops in src/sdk/index.ts before reaching this patch. GitHub CI will install the current lockfile dependencies.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 11

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

The regression is covered at the resolver boundary: current main sends the first lookup without a profile, while the fixed path sends getSession(storedSessionId, activeProfile) and succeeds without probing unrelated profiles.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) area/sessions Session lifecycle, resume, persistence, history area/profiles Multi-profile isolation, HERMES_HOME scoping duplicate This issue or pull request already exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #79522: both scope resolveStoredSession's first by-ID lookup to the active Desktop profile to prevent an unscoped primary-backend 404. #79522 is the earlier open implementation.

@helix4u helix4u closed this Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping area/sessions Session lifecycle, resume, persistence, history comp/desktop Electron desktop app (apps/desktop/*) duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants