Skip to content

fix(desktop): navigate to session when clicking most-recent from non-Chat tab - #67331

Closed
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-66875
Closed

fix(desktop): navigate to session when clicking most-recent from non-Chat tab#67331
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-66875

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

Problem

When viewing a non-Chat tab (Plugins, Artifacts, Capabilities, Messaging) and clicking the most recent session in the sidebar, nothing happened — the view stayed on the current page (/plugins, /artifacts, etc.).

Clicking any other session worked fine: it switched to Chat with that session loaded.

Root Cause

The onResumeSession callback at wiring.tsx:753 calls focusOpenSession(sessionId) first. When the clicked session matches $selectedStoredSessionId (i.e. it's the most recent / last-opened session), focusOpenSession returns true after calling revealTreePane('workspace') and noteActiveTreeGroup(null) — but it does not navigate the router. Since the user is on a non-Chat page, the workspace pane doesn't show chat, so nothing visible happens.

For sessions that differ from $selectedStoredSessionId (all but the topmost), focusOpenSession returns false, and navigate(sessionRoute(sessionId)) runs as expected.

Fix

After focusOpenSession returns true but the current route is NOT a chat view, still call navigate(sessionRoute(sessionId)) to force the route change. This is a 2-line addition in the existing handler.

Test

TypeScript compiles cleanly (npx tsc --noEmit passes). No test coverage exists for this specific wiring handler path.

Closes #66875

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state duplicate This issue or pull request already exists labels Jul 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #66880: both repair the focusOpenSession success path that leaves a non-Chat route visible when the latest session is selected. #66880 is the earlier open implementation with focused regression coverage.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused fix. The dead-click premise is confirmed on current main: apps/desktop/src/app/contrib/wiring.tsx:753-756 only navigates when focusOpenSession returns false, while apps/desktop/src/store/session-states.ts:424-447 returns true for both the main session and open tiles.

Problems

  • apps/desktop/src/app/contrib/wiring.tsx:761 routes an already-open tile to sessionRoute(sessionId). After focusOpenSession has focused that tile, apps/desktop/src/app/session/hooks/use-route-resume.ts:115-150 treats the tile route as non-active and calls resumeSession; apps/desktop/src/app/session/hooks/use-session-actions/index.ts:446-450 then makes it the selected/main session. The requested view switch should not promote an existing tile.
  • The changed routing decision has no regression coverage.

Suggested changes

  • Route the non-chat, already-open path through the selected main-session route, falling back to the clicked id only if no main session exists.
  • Add focused pure routing tests. The earlier open implementation in #66880 (c39e7273c1e4d3743004a17831cf2a8cfe383828) covers the main-session, tile, and no-main cases.

Automated hermes-sweeper review.

if (!focusOpenSession(sessionId)) {
navigate(sessionRoute(sessionId))
} else if (appViewForPath(location.pathname) !== 'chat') {
navigate(sessionRoute(sessionId))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an already-open tile, this routes to the tile id after focusOpenSession has focused it. useRouteResume then resumes that id as the selected/main session, promoting the tile. Route through the selected main-session id here (with a no-main fallback) so this only reveals Chat while preserving the tile.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 19, 2026
@kyssta-exe

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #66880 (alt-glitch triage confirmed). The focusOpenSession success-path fix is already covered there.

@kyssta-exe kyssta-exe closed this Jul 19, 2026
@teknium1 teknium1 added the area/sessions Session lifecycle, resume, persistence, history label Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions Session lifecycle, resume, persistence, history comp/desktop Electron desktop app (apps/desktop/*) duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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.

[Bug]: Latest session does not switch after navigating to Plugins/Artifacts tab and back

3 participants