fix(desktop): session lease, terminal restore, goal todos, git confirm / 会话锁·终端·待办·Git 确认
Summary
Completes the remaining P3–P5 items from the 48h bug triage plan.
| Area | Issues | Fix |
|---|---|---|
| Session lease | #7732, #7592 | Longer in-process contention retry (8×40ms) against stacked probes |
| Terminal panel | #7744 | List/snapshot work for inactive tabs; create/write still active-only |
| Mode selector | #7731 | Plan / Goal / Standard + profile + approval visible in empty-session hero |
| Goal/Todo | #7694, #7634 | Canonical-todo final-readiness fallback only under delivery profile |
| Git confirm | #7784 | High-risk git (checkout/reset --hard/push/…) requires human even in Auto |
Details
Lease
Transient CleanupStaleRunning probes plus multi-project tab switches could exhaust a 2-attempt window and leave a sticky “already open” startup error.
Terminal
Frontend switches optimistically and re-syncs before SetActiveTab returns. Requiring tabID == activeTabID for list made the previous tab look empty.
Todos
Balanced mode still blocks this turn’s incomplete todo_write after a write, but no longer re-blocks every later turn via the delivery-only canonical fallback (which the UI labels as “交付检查尚未完成”).
Git
git checkout is exact-looking shell, so Auto previously allowed it. It now maps to bashApprovalRequireHuman (same class as dynamic bash), so Auto prompts; YOLO still bypasses by design.
Test plan
- [x]
go test ./internal/agent/ ./internal/permission/ - [x] desktop
TerminalWorkspaceListsInactiveTabSessions+ lease/target tests - [ ] Manual: multi-project tab switch without “already open”
- [ ] Manual: open terminal → switch session → switch back → session still listed
- [ ] Manual: new empty creation session shows Plan/Goal/Standard before first send
- [ ] Manual: Auto mode
git checkoutprompts; YOLO may still auto-run
Related
- Stacks with #7820 (updater), #7822 (vision/DPI)
中文摘要
修复多会话误锁、切换后终端“消失”、空会话无法选模式、均衡模式待办反复交付检查,以及 Auto 下 git checkout 不经确认的问题。