Skip to content

fix(desktop): session lease, terminal restore, goal todos, git confirm / 会话锁·终端·待办·Git 确认 - #7833

Open
SivanCola wants to merge 1 commit into
esengine:main-v2from
SivanCola:fix/session-goal-git-hardening
Open

fix(desktop): session lease, terminal restore, goal todos, git confirm / 会话锁·终端·待办·Git 确认#7833
SivanCola wants to merge 1 commit into
esengine:main-v2from
SivanCola:fix/session-goal-git-hardening

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

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

  • go test ./internal/agent/ ./internal/permission/
  • 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 checkout prompts; YOLO may still auto-run

Related

中文摘要

修复多会话误锁、切换后终端“消失”、空会话无法选模式、均衡模式待办反复交付检查,以及 Auto 下 git checkout 不经确认的问题。

… git confirm

Problem
- Multi-tab project switching sporadically surfaces "session is already open"
  (esengine#7732, esengine#7592).
- Switching chat tabs made open terminals appear closed (esengine#7744).
- Empty creation hero hid Plan/Goal/Standard before the first message (esengine#7731).
- Stale open todos re-triggered "delivery checks incomplete" on later turns in
  balanced mode (esengine#7694, esengine#7634).
- Exact-looking destructive git (checkout/reset/push) auto-ran under Auto
  without a human card (esengine#7784).

Root cause
- Lease contention budget was only two short retries against stacked probes.
- Terminal list required the active tab, racing optimistic frontend switches.
- Hero mode intentionally hid mode chrome.
- Final readiness fell back to canonical todos outside delivery.
- Bash approval treated simple git checkout as reusable under Mode=Allow.

Fix
- Expand session-lease contention retries (8 x 40ms).
- Allow terminal list/snapshot for any open tab; keep mutations active-only.
- Keep task mode, runtime profile, and approval chrome visible in hero mode.
- Restrict canonical-todo final-readiness fallback to delivery profile.
- Classify high-risk git bash as require-human under Auto.

Verification
- go test ./internal/agent/ ./internal/permission/
- go test . -run 'TerminalWorkspaceLists|TerminalTarget|EnsureTabSessionLease' (desktop)
@SivanCola
SivanCola requested a review from esengine as a code owner August 7, 2026 04:04
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) agent Core agent loop (internal/agent, internal/control) labels Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant