Skip to content

fix(desktop): preserve new-chat and rail restore intent (#67859) - #67906

Open
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/67859-desktop-restore-intent
Open

fix(desktop): preserve new-chat and rail restore intent (#67859)#67906
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/67859-desktop-restore-intent

Conversation

@Tranquil-Flow

Copy link
Copy Markdown
Contributor

Closes #67859

What changed

  • capture remembered desktop navigation before the initial / route can overwrite it
  • treat a remembered New Chat route as authoritative instead of falling back to a stale session
  • clear the remembered session when the user explicitly returns to New Chat
  • restore a session-owned preview without leaving a user-collapsed right rail expanded
  • preserve ordinary explicit preview behavior, so a deliberate preview open still reveals the rail

Why

The startup effect could persist / before reading prior navigation, and / then fell through to the stale lastSessionId. Preview restoration also used the explicit-open path, whose synchronous controller listener expanded the right side even when the user had collapsed it before quitting.

Verification

  • RED proof before the reviewed production revision: 2 failed, 10 passed
    • remembered / navigated to the stale session
    • restored preview changed the right-side state from closed to open
  • focused + nearby regression suite: 33 passed
  • full desktop UI suite: 1,647 passed, 1 skipped, 1 unrelated order-sensitive failure
  • isolated rerun of that unrelated settings test file: 25/25 passed
  • renderer and Electron TypeScript typecheck: passed
  • desktop ESLint: passed
  • Prettier on all five changed files: passed
  • git diff --check: passed
  • branch is exactly 1 commit ahead of current upstream/main

Related PR audit

PR #67823 overlaps the remembered-navigation file but addresses profile ownership and boot/profile adoption. Its restore path still falls through from remembered / to the session, and it does not touch preview/right-rail restoration; it therefore does not cover #67859.

Auto-published by Moonsong via Path B automated pipeline.

@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 needs-decision Awaiting maintainer decision before any implementation labels Jul 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #67859 and the overlapping open #67823. This branch fixes New Chat intent and collapsed-preview restoration, while #67823 focuses on profile-owned navigation; the approaches overlap but are not duplicates.

@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 isolating both launch-intent and rail-restoration behavior.

Problems

  • apps/desktop/src/app/contrib/hooks/use-desktop-integrations.ts:44,75 reads and clears the unscoped remembered-session key. Current main's 143942d497 made this state profile-owned; current restore reads the active profile at apps/desktop/src/app/contrib/hooks/use-desktop-integrations.ts:108. A direct port would leave the stale-session fallback for non-default profiles.
  • The preview half targets the pre-96999b116b session-preview model. Current apps/desktop/src/app/session/hooks/use-preview-routing.ts:29-115 has no restore path, and current apps/desktop/src/store/preview.ts:94-145 uses persistent preview tabs rather than restorePreviewTarget / session registries. Those APIs are absent on main.

Suggested changes

  • Rebase the launch-intent logic conceptually onto the current profile-scoped session helpers and add a non-default-profile regression.
  • Drop/rework the preview changes against the persistent-tab architecture only if the rail issue still reproduces there.

Automated hermes-sweeper review.

// it. This survives StrictMode effect replay and later in-app navigation.
const startupRestoreRef = useRef({
route: getRememberedRoute(),
sessionId: getRememberedSessionId()

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.

Current main scopes remembered sessions per profile (143942d497), and its restore reads getRememberedSessionId($activeGatewayProfile.get()). Capture this value with the same active/owning profile and clear that profile's key below; otherwise a non-default profile retains its stale fallback session.

@@ -57,14 +57,14 @@ export function usePreviewRouting({
// open on their own.
useEffect(() => {
if (currentView !== 'chat' || !previewSessionId) {
setPreviewTarget(null)
restorePreviewTarget(null)

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.

This restore path was removed by current main's 96999b116b preview-tab refactor: restorePreviewTarget and the session-preview registry no longer exist. Please re-evaluate this behavior against persistent $previewTabs; this hunk cannot be ported directly.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 30, 2026
@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

Summary

One PR, #67906, addresses both reported causes: stale-session fallback after leaving New Chat and preview restoration reopening a collapsed right rail. Its diff implements both fixes against the pre-refactor architecture, while the contributor review documents that current main now uses profile-scoped remembered sessions and persistent preview tabs.

Related pull requests

  • fix(desktop): preserve new-chat and rail restore intent (#67859) #67906 best fix — (+249/-36) — n/a: The diff captures startup navigation before / can overwrite it, makes remembered New Chat authoritative, clears the stale session ID, and restores previews without revealing a collapsed rail. The COMMENTED keep_open contributor review identifies required current-main adaptations: use the profile-scoped session helpers introduced by 143942d497, add a non-default-profile regression, and re-evaluate or rework the rail fix because 96999b116b removed the targeted restore/registry APIs in favor of persistent preview tabs.

Suggested consolidation

Keep #67906 open with a salvage path: retain its New Chat intent logic and regression coverage, but rebase that logic onto the current profile-scoped session helpers and test a non-default profile; reproduce the rail issue against persistent preview tabs and only then rework the obsolete preview portion. This follows the visible keep_open review and preserves #67906 as the recorded best consolidation candidate without recommending its current diff for merging.

Complex graph

flowchart LR
    classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
    classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
    classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
    classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
    classDef best stroke-width:3px,stroke:#b45309
    classDef target stroke-width:3px,stroke:#4338ca
    I67859(["issue #67859 (open)"])
    P67906["PR #67906 (open)"]
    P67906 -->|best fix| I67859
    class I67859 open
    class P67906 open
    class P67906 best
    class P67906 target
    click I67859 "https://github.com/NousResearch/hermes-agent/issues/67859"
    click P67906 "https://github.com/NousResearch/hermes-agent/pull/67906"
Loading

Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 15 kB of PR diffs, 7 kB of issue/PR text, 2 kB of discussion (4 comments), 3 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

@Tranquil-Flow
Tranquil-Flow force-pushed the fix/67859-desktop-restore-intent branch from 4d423c4 to c738a6b Compare August 5, 2026 10:51
@Tranquil-Flow
Tranquil-Flow force-pushed the fix/67859-desktop-restore-intent branch from c738a6b to c725666 Compare August 5, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades 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.

Desktop: relaunch restores old chat even after quitting on New chat (lastSessionId fallback); right rail reopens

4 participants