Escalate agent Close to SIGKILL so it terminates in one action

Agent 'Close' (agent-close) sent a single SIGTERM via Session.Kill and
never escalated, so an agent that traps/ignores SIGTERM (e.g. opencode)
stayed in the running tab bar until the user closed it again. Add
Session.Terminate, which reuses terminateAndWait (SIGTERM, wait, then
SIGKILL) but preserves the session entry so the exited pane stays
readable, and route handleChildClose's agent path through it in a
goroutine to keep the UI responsive during the stop timeout.

Resolves the opencode double-close TODO item.
This commit is contained in:
2026-05-25 12:30:13 +01:00
parent 96f7c66d5f
commit 50fd7be70d
6 changed files with 71 additions and 8 deletions

View File

@@ -1,7 +1,6 @@
- [ ] We should deduplicate /r/n newlines or /n newlines to save tokens on mcp responses for terminal reads.
- [ ] Codex idle detection seems to trigger too soon, see below [CODEX IDLE]
- [ ] Issue with mcp timing out [MCP TIMEOUT]
- [ ] I have to run the close action twice on opencode for it to actually close the tab.
- [ ] When opening a codex sub agent, the message gets input to the field, but the message is never submitted.
- This appears to be inconsistent. Sometimes it works, sometimes it doesn't. Might be because of popups on codex sub agents?
- Question: when it fails, is a Codex startup popup visible (trust/workspace, auth/model selection, permissions), or is the normal composer focused?