You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7f79a37
Browse filesBrowse the repository at this point in the historyBrowse files
Fills docs/M0-FINDINGS.md §M0-4 and folds the results into the plan and stories.
Probe tooling kept on spike/m0-4-cancel-probe (never merged).
Cancellation is fast and clean on all three harnesses: the turn ends within
64 ms of session/cancel, nothing arrives afterwards, and the session stays
usable. M1c-1 therefore gets a 2 s grace and never needs to kill.
Two results the plan did not anticipate:
- copilot answers `end_turn` for a turn it cancelled, contrary to ACP's MUST
and undocumented by GitHub. Filed upstream as github/copilot-cli#4561.
M1b-2 must key status on (stopReason, did we cancel, did the watchdog fire).
- every harness accepts a second session/prompt mid-turn: none rejects it, the
in-flight turn dies, both requests answer `end_turn`, and on opencode and
copilot the text lands in the running turn's context, where both models read
it as a possible prompt injection (github/copilot-cli#4555 has the
mechanism). One prompt per session per task; there is no safe nudge.
Closes#5.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013ZVZAP4MdJ69xjyDHg6RVx
**Latency is not the interesting number.** Every sample landed inside 64 ms, two orders of
393
+
magnitude below any plausible TTL, and nothing arrived on the wire after the response. **No
394
+
harness came near the 60 s wait bound**, so there is no "did not end within N s" row to
395
+
record. The interesting number is the stop reason.
396
+
397
+
Note also what is *not* wrong here: every literal observed is inside M1b-2's set
398
+
(`docs/STORIES.md:334-343`) — nobody invented a value. The mismatch is semantic, and that is
399
+
worse, because a vocabulary error would have been caught by a type.
400
+
401
+
**Copilot reports `end_turn` for a turn it cancelled**, in both samples. The baseline row is
402
+
what settles it: 11 events and ~5.6 s against 69 events and 36.3 s, with the `tool_call`
403
+
that triggered the cancel never completing. It obeyed immediately and then described the
404
+
result as a clean finish. This contradicts the protocol's own MUST — *"the Agent **MUST**
405
+
respond to the original `session/prompt` request with the `cancelled` stop reason"*
406
+
([ACP, prompt turn](https://agentclientprotocol.com/protocol/prompt-turn)) — and it is
407
+
**undocumented**: GitHub's [ACP server reference](https://docs.github.com/en/copilot/reference/copilot-cli-reference/acp-server)
408
+
names `stopReason` only inside an example (`!== "end_turn"`) and never enumerates the
409
+
values, and [Canceling a Copilot CLI operation](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/cancel-and-roll-back)
410
+
covers only Esc and Ctrl-C in the TUI. No issue on `github/copilot-cli` reported it either,
411
+
so this spike filed one:
412
+
[github/copilot-cli#4561](https://github.com/github/copilot-cli/issues/4561), with a
413
+
standalone repro and the control run above as the evidence the turn was truncated.
414
+
415
+
Worth knowing that the public record here is inverted: this exact defect was filed against
Copy file name to clipboardExpand all lines: docs/PROJECT-PLAN.md
+21-9Lines changed: 21 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ policy across all of them and returning machine-readable results.
34
34
| Result contract | A `<task-result>` block in the final message. `git status` cross-checks it; disagreement raises a task **warning**, never a failure. MCP `report_result` deferred. |
35
35
| Worktrees | Supervisor owns fully — creates off a base ref, removes on success, **keeps worktree and branch on failure or timeout**, reaps orphans only when the run is terminal and past the retention window. |
| Liveness | Per-task **stall → warn** (idle, or the same tool repeating) and **TTL → `session/cancel`**. Each disabled by setting `0`. |
37
+
| Liveness | Per-task **stall → warn** (idle, or the same tool repeating) and **TTL → `session/cancel`**. Each disabled by setting `0`. **Measured (M0-4): cancellation works and is fast — every harness ended its turn within 64 ms and stopped emitting, and the session stayed usable, so the TTL rung needs a 2 s grace and no kill. But the stop reason cannot classify the outcome: copilot reports `end_turn` for a turn it cancelled, so the supervisor's own record of *did I cancel* is the authoritative half.**|
38
38
| Crash recovery | Startup sweep plus transactional spawn. A partially-created task leaves nothing behind. |
39
39
| Run definition | A `.ts` module default-exporting the run object; `.json` also accepted; the daemon's POST body is the same shape. One validator behind all three. |
40
40
| Handoff | Same worktree, sequential. Successor sees predecessor's changes on disk plus its result summary in-prompt. |
@@ -205,8 +205,9 @@ internally — so for that harness we judge more than a title string even withou
205
205
Agenda item #1 in the brief. Costs almost nothing and de-risks every design choice after.
206
206
207
207
> **Status:** item 1 is done — see `M0-FINDINGS.md`. Items 2 and 7 are done — M0-2, which
208
-
> also retired the `claude-code` registry entry. Items 3-6 and 8 are still open, and 3/5/6
209
-
> now start from the baseline that survey recorded rather than from nothing.
208
+
> also retired the `claude-code` registry entry. Items 3 and 4 are done — M0-3. Item 5 is
209
+
> done — M0-4. Items 6 and 8 are still open, and 6 now starts from the baseline those
210
+
> surveys recorded rather than from nothing.
210
211
211
212
1.~~Run today's MVP against real **opencode** and **claude-agent-acp**.~~**Done, and
212
213
widened to all three targets.** All spawn, all complete a turn at protocol v1, none
@@ -232,10 +233,17 @@ Agenda item #1 in the brief. Costs almost nothing and de-risks every design choi
232
233
(`terminal | notification | permission | none`). opencode shows us nothing and cannot be
233
234
gated by argv at all; claude-agent-acp's argv arrives late, on `tool_call_update`.
234
235
**M3-6 therefore survives without M3-5.**
235
-
5.**Cancellation probe.** Confirm the expected result — that no harness accepts a second
236
-
`session/prompt` while a turn is in flight — and record what each one does with
237
-
`session/cancel` mid-turn: does the turn end promptly, and with what `stopReason`?
238
-
M1's TTL rung is only as good as this answer.
236
+
5.~~**Cancellation probe.**~~**Done by M0-4, and the expectation was wrong**
237
+
(`docs/M0-FINDINGS.md` §M0-4). Cancellation itself is the easy half: all three end the
238
+
turn within 64 ms, emit nothing afterwards, and leave the session reusable — so the TTL
239
+
rung gets a 2 s grace and never needs to kill. Two results this plan did not anticipate.
240
+
**Copilot answers `end_turn` for a turn it cancelled**, contrary to ACP's MUST, so
241
+
`stopReason` alone cannot classify an outcome and the supervisor must carry its own
242
+
cancel intent. And **every harness accepts a second `session/prompt` mid-turn** — none
243
+
rejects it, the in-flight turn dies, both requests answer `end_turn`, and on opencode and
244
+
copilot the text lands in the running turn's context rather than being served
245
+
(`github/copilot-cli#4555` reports the mechanism: `session/prompt` aborts the session
246
+
unconditionally, even when idle). There is no safe way to nudge a turn in flight.
239
247
6.**Usage reporting.** Record, per harness, whether `usage_update` arrives at all and what
240
248
its fields actually mean. `{used, size}` is context occupancy, not spend — check whether
241
249
anything reports cumulative or billable counts, or names the model it selected. This is
@@ -353,8 +361,12 @@ driven from a run file, fully verifiable offline.
353
361
reuses the `toolCallId → {title, kind}` map already maintained as a protocol invariant, so
354
362
it needs only a per-task "last title + consecutive count". Both signals emit a warning and
355
363
the task keeps running; the separate, longer `ttlMs` calls `session/cancel`, preserves the
356
-
branch and marks the task `timed_out`. Every knob disabled at `0`. Best-effort throughout —
357
-
one task's failure must never halt the sweep. Two notes: there is no third rung, because
364
+
branch and marks the task `timed_out`. **M0-4 supplies the missing number: wait 2 s after
365
+
the cancel before force-killing** — thirty times the slowest cancel measured, and the same
366
+
grace `run.mjs` already uses — and expect never to reach it. `timed_out` is set from the
367
+
watchdog's own record, not from the stop reason, which may come back `end_turn`. Every
368
+
knob disabled at `0`. Best-effort throughout — one task's failure must never halt the
369
+
sweep. Two notes: there is no third rung, because
358
370
ACP gives us no way to nudge a turn in flight, so detection reports rather than corrects;
359
371
and a token-based signal was considered and dropped, because `usage_update` reports context
360
372
occupancy in units that are not comparable between vendors.
Copy file name to clipboardExpand all lines: docs/STORIES.md
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,15 @@ with what `stopReason`. Confirm the expectation that none accepts a second `sess
115
115
while a turn is in flight.
116
116
*Done when* the note states the observed stop reason and latency per harness — M1c-1's TTL
117
117
rung is only as good as this answer.
118
+
**Done 2026-08-21** (`docs/M0-FINDINGS.md` §M0-4). Three corrections to this text as
119
+
written. The probe could not be a `run.mjs` run: its SIGINT path kills at 2 s
120
+
(`run.mjs:81-88`) and `#failAll` (`acp.mjs:62-64`) would have turned any slower cancel into
121
+
an exit error, so the answer needed tooling that cancels and waits — plus an **uninterrupted
122
+
control run**, without which "the turn ended" cannot be told from "the turn was ending
123
+
anyway". The expectation about a second `session/prompt` is **false on all three**: none
124
+
rejects it, the in-flight turn dies, and both requests answer `end_turn`. And latency turned
125
+
out not to be the interesting number — everything landed inside 64 ms — while
126
+
**copilot reports `end_turn` for a turn it cancelled**, which is what actually moves M1b-2.
118
127
119
128
**M0-5 · Usage reporting survey · S · needs M0-1**
120
129
Per harness: does `usage_update` arrive, and what do its fields mean? `{used, size}` is
@@ -148,7 +157,7 @@ default, and M3-5's terminal scope.
148
157
M0-3/4/5 sections are stubbed with the partial input that survey already produced (no
149
158
`terminal/*` traffic under `terminal: false`; copilot supplying real argv on the permission
150
159
request; `usage_update` shapes, including `cost` on opencode alone).
151
-
**M0-3 filled 2026-08-21.**Two sections remain: M0-4 and M0-5.
160
+
**M0-3 and M0-4 filled 2026-08-21.**One section remains: M0-5.
152
161
153
162
---
154
163
@@ -344,6 +353,15 @@ gates on this. **Decision — one table, in this module:**
344
353
|`refusal`|`failed`| agent declined; `summary` carries its text |
345
354
|`cancelled`|`timed_out` if the watchdog fired, else `cancelled`| the supervisor knows which |
346
355
356
+
**Revised by M0-4** — the table stands; its input does not. `cancelled` may never arrive:
357
+
copilot answers `end_turn` for a turn it cancelled (both samples, against a control run
358
+
proving the turn was cut short), contrary to ACP's MUST. And `end_turn` is now known to mean
359
+
*finished*, *I was cancelled*, or *someone sent a second prompt and killed my turn*.
360
+
**Key the status on the triple (`stopReason`, did we send a cancel, did the watchdog fire)**,
361
+
with the supervisor's own record authoritative and `stopReason` consulted only where the two
362
+
agree. A cancelled turn is also truncated mid-tool-call, so the "stopped mid-edit" hazard
363
+
recorded above for `max_tokens` applies to `timed_out` too.
364
+
347
365
**Gap 2** — the plan gives no rule for what happens to dependents when a dependency fails,
348
366
no rule for rolling task statuses into a run status, and its lifecycle
349
367
(`pending → running → done | failed | timed_out | cancelled`) has no state for "never
@@ -446,9 +464,19 @@ already maintained as a protocol invariant, so it needs only a per-task last-tit
446
464
count. Both signals warn and the task keeps running; the separate, longer `ttlMs` calls
447
465
`session/cancel`, preserves the branch and marks the task `timed_out`. Every knob disabled
448
466
at `0`. Best-effort throughout — one task's failure must never halt the sweep.
467
+
**M0-4 fills in the TTL rung** (`docs/M0-FINDINGS.md` §M0-4): every harness ended its turn
468
+
within 64 ms of `session/cancel`, sent nothing afterwards, and accepted a further prompt — so
469
+
**wait 2 s after cancelling, then force-kill**, and expect never to reach it. Mark
470
+
`timed_out` from the watchdog's own record: copilot's cancelled turns come back `end_turn`.
449
471
*Done when*`node:test` covers the repeat counter's reset behaviour and one task throwing
450
472
inside the sweep does not stop the others being checked. There is deliberately no third
451
473
rung: ACP gives no way to nudge a turn in flight, so detection reports rather than corrects.
474
+
**M0-4 turned that into a hard rule.** A second `session/prompt` is accepted by all three
475
+
harnesses and kills the running turn; on opencode and copilot its text is merged into that
476
+
turn's context, where both models read it as a possible prompt injection. Copilot aborts the
477
+
session on *any* prompt, even one sent while idle
478
+
([github/copilot-cli#4555](https://github.com/github/copilot-cli/issues/4555)). One prompt
479
+
per session per task.
452
480
A token-based signal was considered and dropped — `usage_update` reports context occupancy
0 commit comments