Repository navigation
test: pin the sync /runs disconnect contract, and retire its interim status (#389, #380) - #878
Conversation
…status (rossoctl#389, rossoctl#380) rossoctl#389's items 1-4 landed in rossoctl#717 and the deploy/k8s half in rossoctl#765. Item 5, "retire rossoctl#380's interim contract", is the last one, and the evidence settles it against the obvious reading: a disconnect must still not cancel a sync /runs leaf. mocactl's subagent path posts /v1/runs and then reads /runs/status (packages/mocactl/src/transport/leaf-turn.ts), so it is not holding the socket when the run ends -- an abort would strand every subagent. Flipping it is also breaking under the change policy, on a route kept as a frozen alias. What the "interim" framing was about, a sync run lost on a worker restart, is answered by async turns (ADR-0047 M1-M3), which have redelivery. So the behaviour stays and stops being interim: a test pins it, ADR-0028 records why, and the /v1/runs description states it. The test also asserts no signal reaches runLeaf, because once rossoctl#391 lands runLeaf takes an optional AbortSignal and the regression rossoctl#380 feared is a one-line edit. Also corrects harness-openapi.yaml, which still called the authenticated async replacement "designed and not yet implemented" after M1-M3 shipped. No info.version bump: both doc edits are prose, not contract changes. Closes rossoctl#380. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
Clawgenti Code Review
Doc-and-test change pinning the sync /runs disconnect contract (ADR-0028 amendment, OpenAPI note, and a regression test in server.test.ts). Reviewed docs, OpenAPI and the new test.
No blocking issues. The test is well constructed — it asserts both halves of the contract (record still written after req.destroy(), and no 4th signal argument reaching runLeaf), and the comment explains why the two routes must not converge. The ADR's claim that #380's third item refers to a nonexistent file checks out against deploy/vm.
Author: cwiklik (CONTRIBUTOR — returning external)
Areas reviewed: Docs, OpenAPI, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes (DCO pass)
CI status: passing
All checks pass. Ready for human review.
Generated by RepoMan github-pr-review@9672454 (https://github.com/rossoctl/agent-skills/blob/96724547c162978f58d845b9a8331a679bf39444/skills/github-pr-review/SKILL.md).
clawgenti
left a comment
There was a problem hiding this comment.
Generated by RepoMan github-pr-review@9672454 (https://github.com/rossoctl/agent-skills/blob/96724547c162978f58d845b9a8331a679bf39444/skills/github-pr-review/SKILL.md).
pdettori
left a comment
There was a problem hiding this comment.
Summary
This changes only tests and docs; src/server.ts is not touched. It pins the existing rule that a sync /runs run keeps going after the client disconnects, and turns #380's interim status into a permanent, documented decision in ADR-0028 and the OpenAPI spec. I checked the PR's claims against upstream/main and they hold up: mocactl's leaf-turn.ts posts /v1/runs and then polls /runs/status, the change-policy quote is accurate, deploy/vm has no disconnect smoke check to mirror, and handleRunLeafParsed passes no signal today. The record-written assertion is the real behaviour guard and it is sound. The no-signal assertion is narrower than it looks (inline suggestion).
Author: cwiklik (MEMBER — maintainer)
Areas reviewed: TypeScript test, Docs (ADR, OpenAPI YAML)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, signed off: yes
CI status: all checks passing
|
|
||
| // ...and no signal reached the leaf, so the no-abort wiring fails loudly rather than only | ||
| // through its effect. runLeaf(env, config) -- a 4th `signal` argument means someone wired it. | ||
| expect(runLeaf.mock.calls[runLeaf.mock.calls.length - 1][3]).toBeUndefined(); |
There was a problem hiding this comment.
suggestion: This guard only catches one way of wiring a signal. runLeaf is (env, config?, deps?) (harness/src/run-leaf.ts:419), so index [3] only fails if the signal arrives as a new 4th argument. If it's passed as the 3rd argument, inside deps, or on config, the test still passes. Those are the more likely shapes, given executeTurn takes input.signal. The negative control in the PR body used the same 4th-argument shape as the test, so it doesn't show the guard is robust.
Proposed fix, which pins today's exact call:
// handleRunLeafParsed calls runLeaf(body, buildConfig(auth)): two arguments, no signal on either
const args = runLeaf.mock.lastCall!;
expect(args).toHaveLength(2);
expect(args[1]).not.toHaveProperty('signal');Any deliberate arity change then has to touch this test, which is the point.
|
|
||
| `POST /runs` and `/v1/runs` keep running after the client's socket goes away, and write the result | ||
| record when they finish; `GET /runs/status` serves it afterwards. `/turn` does the opposite — it | ||
| aborts the in-flight turn on disconnect (`packages/server/src/server.ts`, ADR-0029 §3.6). The |
There was a problem hiding this comment.
nit: ADR-0029 has no §3.6. The disconnect → abort section is §3.6 of the spec, docs/specs/2026-08-26-turn-sse-streaming-design.md.
|
|
||
| A client disconnect does not cancel the run: it finishes and persists its result record, | ||
| which `GET /runs/status` serves afterwards, so submit-then-poll is supported here. This is | ||
| permanent, not interim (ADR-0028). `POST /v1/turn` is the opposite and aborts on |
There was a problem hiding this comment.
nit: "POST /v1/turn is the opposite and aborts on disconnect" leaves out detachable turns. ADR-0040 and SH_TURN_DETACH=1 let a turn opt out of the abort, as this same file describes under DETACHABLE TURNS. Suggest "aborts on disconnect unless the turn is detachable". The same applies to "/turn does the opposite" in the ADR-0028 amendment.
| asymmetry was accidental, and #380 filed it as an **interim** contract to be retired once async | ||
| leaf turns on P6 (#389) gave detached work a better home. | ||
|
|
||
| Async turns have now shipped (ADR-0047, M1–M3), and the retirement goes the other way: **the |
There was a problem hiding this comment.
nit: "M1–M3 shipped" is correct, because #388 lifted the async tenancy gate (packages/control-plane/src/turn-exchange.ts:167). But ADR-0047's status line still says "M2, which lifts the single-tenancy gate, owed". A reader following this amendment to ADR-0047 will find the two ADRs disagree. Cite #388 here, or refresh ADR-0047's status line in this PR.
Review on rossoctl#878: - the no-signal guard only caught a 4th argument, which is the least likely shape. Pin the call instead -- two arguments, no `signal` on either -- so a signal on `config`, inside `deps` or as a third argument fails it too. Verified by patching both shapes into `handleRunLeafParsed` and watching the test fail. - `/turn` aborts on disconnect UNLESS the turn is detachable (ADR-0040, SH_TURN_DETACH=1), which the asymmetry's two statements left out. - the disconnect-abort section is §3.6 of the turn-SSE streaming spec, not of ADR-0029. - cite rossoctl#388 for M2's gate lift, since ADR-0047's status line predates it (rossoctl#856 refreshes that line). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
|
@pdettori all four addressed in suggestion — the no-signal guard was narrower than it looked. Correct, and the negative control in the PR body was circular (it reproduced the same 4th-argument shape the assertion tested). Took your proposed fix: pin the call itself rather than one position. const args = runLeaf.mock.lastCall!;
expect(args).toHaveLength(2);
expect(args[1]).not.toHaveProperty('signal');Checked against both of the shapes you named, by patching
nit — ADR-0029 §3.6. Fixed: it is §3.6 of nit — detachable turns. Fixed in both statements. The ADR and the openapi description now say nit — ADR-0047's status line. Took the "cite #388" half deliberately: #856 already refreshes that line (it is the per-turn-budgets PR and rewrites the whole status header to "all three milestones implemented"), so editing it here would collide for no gain. The amendment now reads "M2's single-tenancy gate was lifted by #388, which ADR-0047's own status line predates", which is true whichever lands first. Also updated the ADR's description of what the test pins, so it matches the stronger assertion. Green locally: Assisted-By: Claude Code |
Brings rossoctl#878 (the sync /runs disconnect contract), rossoctl#880 (the RUNBOOK's reproduction recipe) and rossoctl#882 (deploy/k8s SH_WORKSPACE_IDLE for the container worker, default 8h). No conflicts. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Closes the last open scope item on #389, and closes #380.
Why this is a doc-and-test change, not a behaviour change
#389's items 1–4 landed in #717, and the
deploy/k8shalf in #765 — neither was notedon the issue, so #389 reads as unstarted when only item 5 is left: "retire #380's interim
contract."
#380 pinned this behaviour: a synchronous
POST /runsleaf keeps running, and writes itsresult record, after its client disconnects. It was called interim because async leaf
turns (#389) were meant to supersede it. Retiring it does not mean wiring a
disconnect-abort into
/runs:mocactldepends on the behaviour. Its subagent path posts/v1/runsand then pollsGET /runs/status(packages/mocactl/src/transport/leaf-turn.ts), so it is deliberatelynot holding the socket when the run ends. An abort on disconnect would strand every
subagent.
docs/reference/change-policy.md("changing adefault so that behaviour … changes"), on a route the policy keeps as a frozen, supported
alias.
is answered by async turns (ADR-0047 M1–M3), which have crash redelivery. The gap closes by
offering an alternative, not by changing this route.
So the behaviour stays and stops being interim: a test pins it, ADR-0028 records why, and the
/v1/runsdescription states it.What changed
packages/server/test/server.test.tsrunLeaf,req.destroy()mid-leaf, then assert the record is readable at/runs/statusand thatrunLeafreceived nosignalargument.docs/adrs/0028-async-prompt-dispatch.mddocs/api/harness-openapi.yaml/v1/runs. Also corrects the stale claim that the authenticated async replacement is "designed and not yet implemented" — M1–M3 have shipped, and that sentence pointed readers away from the very path this amendment recommends.The second assertion is what makes #380's acceptance real. Once #391 lands,
runLeaftakesan optional
AbortSignalandhandleRunLeafParsedstill passes none, so the regression #380feared — someone copying
/turn's abort wiring here — is a one-line edit with nothingstanding in its way.
/turn's opposite contract is already pinned in the same file, so it isreferenced in a comment rather than re-tested; the two must not converge.
No
info.versionbump. Both doc edits are prose — no field, route or error code changes.The changelog's rule is that the minor is bumped for additive changes, and the change policy
says text meant for people is not a contract. The contract suite passes unchanged, which is
the check on that call.
Verification
packages/server: 33 files, 593 tests passed (rebased onupstream/main@f748ac86).packages/control-plane/test/openapi-contract.test.ts: 21 passed, unchanged.make typecheck: clean.SKIP=hadolint-docker make lint: clean (Docker is down locally).from
handleRunLeafParsedintorunLeaf, confirmed the new test fails(
expected AbortSignal { aborted: true } to be undefined), then reverted.src/server.tsis untouched by this PR.
Not in this change
#380's item 3 — a live disconnect check in
deploy/k8s/smoke.sh"mirroringdeploy/vm's" —refers to a file that does not exist:
deploy/vmhasresearch-smoke.shandsetup-vm.sh,and neither it nor
deploy/k8s/smoke.shhas such a check. Recorded as dissolved in the ADRamendment rather than silently dropped.
Assisted-By: Claude Code