fix(desktop): exclude archived sessions from startup selection - #4980
Conversation
Validate archive eligibility for both automatic selection and retained startup selection. Preserve explicit navigation and new-task reload ownership. Unit and Electron regressions fail against the previous selector and pass with the fix. Generated-by: OpenAI Codex
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for the focused fix. I found no actionable issues at 25987b44a6c80a76962d5bce63b5a3446eb415d0. Archive eligibility is enforced at the existing bootstrap-selection owner for both initial selection and subsequent snapshots; explicit navigation and new-task reload intent retain their existing revision/lease protection.
Independent verification: all 13 exact-head selector/reload-intent tests passed; replacing only the selector with the merge-base implementation made the four archive regressions fail. After rebuilding workspace dependencies and Desktop main/preload/renderer at this head, a real Electron/Host journey also passed: create a conversation, verify cold restoration, archive it, reload without explicit new-task intent, verify no archived transcript/title is selected, then send successfully from the new-task surface. The final catalog retained one archived and one active Session. DOM geometry showed a usable 776 × 30 px editor with 14 px text; no renderer page errors were observed. The journey used the deterministic backend and DOM-dispatched actions, not a live provider.
中文
当前 head 未发现可执行问题,批准。修复接在已有启动选择权威处,保留显式导航与新任务 reload intent 的保护。13 个定向测试通过;只恢复旧选择器后,4 个归档回归失败。独立构建当前 head 后,真实 Electron/Host 的创建→恢复→归档→reload→新建发送路径通过,归档记录仍保留,编辑区几何与14px字体正常,未观察到 renderer page error。验证使用确定性 backend,不代表真实 provider 验证。
AI-assisted review and independent execution by Codex; no additional production changes were made.
Summary
Fix automatic startup reopening archived history behind an empty task sidebar.
The bootstrap catalog intentionally contains archived sessions. The selector previously treated catalog membership as sufficient both when opening its first conversation and when retaining that selection across bootstrap snapshots. The normal sidebar already excludes archived sessions.
Filter archive-ineligible candidates inside the bootstrap selection owner, covering both paths without changing catalog/storage semantics. When no unarchived conversation remains, the existing new-task surface is shown. Explicit navigation (including opening archived history), explicit new-task reload intent, catalog ordering, and the existing empty-task behavior remain unchanged. No migration or data deletion is needed.
Verification
new-task-reload.spec.tstests pass together (27.4s), including existing draft preservation.git diff --check, E2E budget (34 tests), and renderer architecture checks (101 fixtures plus baseline ratchet) pass.test:dist: 2329 passed and two failures in the initial parallel run. The unchanged shell-env test missed its startup PID file under load; the unchanged Vite test process required termination after its assertions finished but it did not exit. Isolated reruns pass 12/12 shell-env tests and 2/2 Vite tests. The broad command was not rerun in full.Before and after
Same real Electron scenario, 1280 x 900 viewport, Chinese locale, light theme, expanded sidebar, default zoom, and one archived test conversation. These use isolated synthetic data, not a personal transcript.
Before: empty sidebar, archived conversation automatically reopened.
After: empty sidebar and the existing new-task surface.
Review
Local self-review and an independent agent review found no actionable issues. The change follows the verified selection-boundary cause directly; no deeper refactor, extra runtime state, fallback, or production-code deletion is warranted. Tests cover distinct selection and ownership boundaries. A delayed-refresh/navigation interleaving is covered by separate selector/refresher tests rather than a new integrated timing fixture.
Human approval and hosted CI remain required before merge. This PR does not authorize or enable merging.
AI use
Tool(s) and scope: OpenAI Codex investigated the bug, implemented the selector fix and regression tests, ran validation, captured screenshots, and prepared this PR. The commit includes a Generated-by trailer.
Checklist
The focused checks pass; the broad-suite qualification above is why the aggregate checkbox remains unchecked.
Does this PR entail a change in behavior?