fix(ship): review completed same-head salvage - #2221
Conversation
|
Context for review, since this is a one-function change with a subtle failure mode. The defect is an inference, not the salvage mechanism. Two things worth checking hardest in review. First, the witness. The comparison must take the child's head from the run record's own head fact, which arrives as a sibling of Second, the untouched cases. A genuinely interrupted child, a stopped run, a failed run and a provider-transient ending must all abort exactly as they do now. Fixtures are real runs from today: |
There was a problem hiding this comment.
Changes requested: The same-head salvage exception is unreachable through the production read-record path because the child head is never returned.
Warning
Changes requested · head d0a7c46 · 1 finding: 1 major
| Severity | Finding | Where |
|---|---|---|
| major | F1 Spec contradiction — docs/reference/specs/agent-ship.md item 8: production read-record omits the child head required by the exception | src/core/ship/coordinator.ts:1826 |
Full review
F1 (high confidence): interruptedCheckpoint requires facts.headSha, but the production /admin/coordinator/read-record response never returns a coding child head; coordinatorRunView omits it, while the response adds handoff and pushed only. Therefore a completed same-head salvage still becomes an interrupted checkpoint and aborts, contradicting item 8. Persist and return the independently observed final head through read-record, then add an adapter-level regression rather than injecting ChildFacts.headSha directly.
There was a problem hiding this comment.
Changes requested: The salvage exception is not reachable through the production read-record path because the child head is never returned.
Warning
Changes requested · head d0a7c46 · 1 finding: 1 major
| Severity | Finding | Where |
|---|---|---|
| major | F1 The production child record never supplies the head required by the salvage exception | src/core/ship/coordinator.ts:1825 |
Full review
F1 — settleCoding can only take the new exception when facts.headSha is present, but the production read-record response in adminCoordinator.ts never adds the finished child’s head. The unit therefore still treats the same-head salvage as interrupted WIP and aborts. The tests miss this because they inject headSha directly into the pure coordinator. Derive and return the independently recorded final head through the read-record boundary, with an integration test covering that response.
Co-Authored-By: coreplane-switchboard[bot] <318072483+coreplane-switchboard[bot]@users.noreply.github.com>
d0a7c46 to
9038ee5
Compare
|
Re-review requested at The finding was that the exception could never fire in production: This is the first pull request reviewed under the new rule: the first pair audits a head in full, and every later round is a single arm scoped to the findings raised plus the diff since. The reason is on issue #2230, along with the correction that the earlier stall was a posting-threshold problem rather than a scope one. |
Completed coding children now proceed to pull-request review when a salvage push only republishes the run’s independently observed final head. Finished work no longer aborts as an interrupted checkpoint while genuine WIP remains protected.
Why: Issue #2197 records completed, handed-off work stranded because salvage replayed the same commit. This narrow inference fix complements PR #2203 without changing salvage publication itself.
Where to look
Feedback wanted: Confirm the run-record head is the correct independent witness and that exact normalized equality is preferable to prefix equivalence.
Risk: Limited to ship coding-run settlement. A false match could review WIP; a false mismatch preserves today’s abort. Roll back this commit to restore the prior inference.
Verified: 133 coordinator tests, scoped TypeScript, Prettier, hygiene, and spec proof checks pass; CI and the post-deploy receipt remain human-gated.
Decisions (2)
Validation (6 criteria)
For agents
Rebased onto origin/main immediately before push; it was already current. The fix intentionally changes only interruptedCheckpoint and its settleCoding call site, plus focused tests and agent-ship item 8. Reproduce with: npx vitest run src/core/ship/coordinator.test.ts.
Requested by @justinhelmer in slack:C0BRRHKFLCB
🤖 Generated with Claude Code