Skip to content

fix(app): keep archived sessions open in their tabs - #46165

Open
richard-fairthorne wants to merge 1 commit into
anomalyco:devfrom
richard-fairthorne:archive-tab-decouple
Open

fix(app): keep archived sessions open in their tabs#46165
richard-fairthorne wants to merge 1 commit into
anomalyco:devfrom
richard-fairthorne:archive-tab-decouple

Conversation

@richard-fairthorne

@richard-fairthorne richard-fairthorne commented Aug 29, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #35058

Type of change

  • Bug fix

What does this PR do?

Archiving currently acts as a navigation command. After the time.archived write succeeds, each archive entry point (in-session options menu, command palette, sidebar rows) runs some combination of session.evict, navigateAfterRemoval (to a neighbouring session, the parent session, or a new draft tab), and notifySessionTabsRemoved (which also navigates). Two racing navigations around a list mutation produce the churn reported in #35058: the archived session's tab gets its content replaced with another session, and an unrelated new tab can open. The SSE event reducer and server-session handler also evict caches for archived sessions, so even a tab that survives loses its messages.

This change makes archiving a data operation only. The server write and the sidebar list update remain; the eviction, navigation, and tab-removal calls are removed. An open tab keeps rendering the archived session, and its caches age out through the normal LRU or get wiped on actual deletion. Deletion behaviour is unchanged — it still evicts, removes tabs, and navigates away.

How did you verify your code works?

  • bun typecheck in packages/app — clean
  • Updated event-reducer.test.ts and home-session-archive.test.ts to pin the new behaviour (caches survive archive, no tab-removal event fired) — both pass
  • Full packages/app suite: 646 pass; the remaining failures (terminal, comments, desktop-native, prompt-submit) reproduce on a clean origin/dev checkout and are unrelated
  • The pre-push hook ran the monorepo bun turbo typecheck — 30/30 packages green

Screenshots / recordings

No visual change — the fix removes behaviour (tab churn on archive) rather than changing how anything renders.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Do less!

Archiving a session now only updates the session list state. Open tabs
keep rendering the archived session: no cache eviction, no navigation
to a neighbouring session, no tab removal, no replacement draft tab.

Fixes the archive churn reported in anomalyco#35058, where archiving the current
session replaced its tab content with another session and could spawn
an unrelated new tab via the removal-navigation path.

Deletion behaviour is unchanged.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 29, 2026
@richard-fairthorne
richard-fairthorne marked this pull request as ready for review August 29, 2026 16:21
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Archived Sessions Do Not Close Tabs and Reopen Recent Session(归档会话未能关闭标签页,还重新打开最近会话)

1 participant