fix(dashboard): resume chat in the session's owning profile - #48049
Open
cyb0rgk1tty wants to merge 1 commit into
Open
fix(dashboard): resume chat in the session's owning profile#48049cyb0rgk1tty wants to merge 1 commit into
cyb0rgk1tty wants to merge 1 commit into
Conversation
Sessions live in per-profile state.db files, but the dashboard chat
resume path resolved them only against the process/active profile.
Reopening a chat owned by a different profile than the one currently
selected — including a bare desktop-restored /chat?resume=<id> URL that
carries no ?profile= — 404'd with "session not found".
- _session_latest_descendant() opens the requested profile's db and, on
a miss, falls back to locating the owning profile (session ids are
globally unique), so the compression chain is walked where the session
actually lives.
- /api/sessions/{id}/latest-descendant accepts ?profile=, matching the
sibling read endpoints.
- _resolve_chat_argv() resolves a resume target's owning profile and pins
HERMES_HOME to it explicitly (including the default home), so the TUI
reopens the correct state.db regardless of the switcher hint.
- add _find_session_profile(): read-only point-lookup across profiles.
Complements NousResearch#44162 (transcript-load path); this covers the resume/PTY
path. Adds regression tests in test_web_server_profile_unification.py.
Collaborator
Contributor
|
Thanks for isolating the dashboard PTY resume path. The current-head premise is still visible: the PTY forwards Problems
Suggested changes
Automated hermes-sweeper review. |
1 task
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
Reopening a dashboard chat that belongs to a different profile than the one currently selected in the profile switcher fails with "session not found." The desktop app hits this too: it restores its last
/chat?resume=<id>URL on launch, which carries no?profile=, so the resume is scoped to whatever profile happens to be sticky-active.Root cause: sessions are stored in per-profile
state.dbfiles, but the resume path resolved them only against the process/active profile:_session_latest_descendant()always opened the process db, and/api/sessions/{id}/latest-descendanttook noprofileargument._resolve_chat_argv()boundHERMES_HOMEfrom the switcher hint, so the spawned TUI reopened the wrongstate.dband 404'd.Fix
_session_latest_descendant(session_id, profile=None)opens the requested profile's db and, on a miss, falls back to locating the owning profile and walking the compression chain there. Session ids are globally unique, so this is safe./api/sessions/{id}/latest-descendantaccepts?profile=, matching the sibling read endpoints (/messages, detail)._resolve_chat_argv()resolves a resume target's owning profile and pinsHERMES_HOMEto it explicitly (including the default home), so the spawned TUI reopens the correctstate.dbregardless of the hint. Named owners still spawn their own gateway; default-owned resumes keep the in-memory gateway attach._find_session_profile(): read-only point-lookup across profiles (no table scan, no descendant walk), used only on the cold path.Repro
/chat?resume=<default-session-id>with no?profile=).session not found. After: resumes correctly.Scope / relation to other PRs
This is the resume / chat-PTY half of cross-profile session handling. It complements #44162 (the transcript-load path —
getSessionMessages, for #44147); the two don't overlap in code. A frontend change could additionally thread the owning profile into the resume URL to skip the lookup, but the server-side fix makes resume correct even for bookmarked / desktop-restored URLs that carry no profile.Testing
tests/hermes_cli/test_web_server_profile_unification.py::TestProfileScopedChatResume: owner lookup; latest-descendant resolution in / without / with-wrong profile; the endpoint's?profile=honoring + no-profile fallback; and_resolve_chat_argvbinding the owner for both named- and default-owned resumes.scripts/run_tests.sh tests/hermes_cli/test_web_server.py tests/hermes_cli/test_web_server_profile_unification.py— pass (3 unrelated, pre-existing failures in the status/update-hermes endpoints reproduce onmainwithout this change).scripts/check-windows-footguns.py hermes_cli/web_server.py— clean.