fix: keep cancellation pending until execution cleanup is confirmed

This commit is contained in:
2026-10-20 15:47:07 +01:00
parent 1cf5156c77
commit b96b9d94a6
26 changed files with 690 additions and 142 deletions
+23 -1
View File
@@ -166,13 +166,35 @@ Every submission, including agent-issued `submit`/`rpc`, still uses server valid
## Drafts in the TUI
The server runs one active run per resolved workspace. A new request key in a
The server runs one active run per resolved workspace, including overlapping
parent/descendant directories (and symlink aliases). Separate sibling worktrees
remain independent. A new request key in a
different workspace is admitted immediately and executes concurrently; a second
run in a workspace an active run is already changing is refused, naming the
conflicting run and advising you to wait or use a different workspace (for
example another checkout of the repository). Reusing the original request key
reattaches idempotently.
`cancel ID` / `cancel_run` records `cancel_requested: true` before signaling the
executor. The reply can still have `status: running` (or `queued`) and no
`finished_at`: this means **stopping**, not stopped. The workspace stays reserved
until execution returns and owned-session cleanup is confirmed; late success
cannot override cancellation. A parked human run has no executor and cancels
immediately. Repeating Stop while stopping is safe.
If cleanup cannot be confirmed, the run stays nonterminal with
`cleanup_unconfirmed: true`, retains partial step evidence, and reserves its
workspace. The web client labels this explicitly and hides duplicate Stop.
Successful startup recovery interrupts and confirms recorded sessions before
settling the run; without a recoverable session pointer, uncertainty and the
reservation survive restart rather than inventing stop confirmation. Recovery
does not resume a canceled run. A database-sidecar advisory server lock is held
through runner shutdown, so a second server on that database cannot recover or
interrupt the first one's live runs. Keep the sidecar file in place; its existence
is not ownership (the kernel lock is). This is a local-filesystem lock, not a
distributed lease; hard-link database aliases and filesystems without reliable
advisory locking are unsupported.
Use `:templates` for four simple, manual-only starters: task, review, research,
and plan/implement/review. **Submit template** (`s` or Enter) asks for a
name without opening an editor. Enter saves a retained draft, then a separate