fix(herdr): close Phase 4 item 2 — actually ask the agent for a handoff

Release already validated and uploaded a §6.1 handoff, but nothing ever
told the agent the .orchestra-handoff.json convention existed, so the
file it waited on never got written. rotate() now prompts the agent
once via a new optional herdr.HandoffRequester capability
(CLIAdapter.RequestHandoff) when the file is missing, and defers
Release until it appears, mirroring the .orchestra-report.md/B3 ask
pattern rather than inventing a handoff.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W1rkJ2hBMybnJctPbcy4tT
This commit is contained in:
kami
2026-07-27 22:10:22 +04:00
parent 62bb17e05d
commit 3fe3aee5b7
6 changed files with 161 additions and 6 deletions
+16 -2
View File
@@ -137,8 +137,22 @@ Fixed so far:
half-wired, per AUDIT.md's explicit "delete and record the deviation"
option. New tests: `TestReleaseScratchCommitsDirtyFilesBeforeUpload`,
`TestReleaseRefusesOnStaleDirtyFile` (internal/herdr/adapter_test.go).
**Not done:** Phase 4 item 2 (handoff production for Codex/opencode —
nothing yet drives those harnesses to write `.orchestra-handoff.json`).
**Was still open:** Phase 4 item 2 — nothing drove *any* harness to write
`.orchestra-handoff.json`, since Release only validated a file whose
existence was never solicited. **Closed 2026-07-27:** `rotate()` now checks
for the adapter's optional `herdr.HandoffRequester` capability; when
`HandoffFile` is missing at the worktree root, it prompts the agent once
(`CLIAdapter.RequestHandoff`, mirroring the `.orchestra-report.md`/B3
convention — the plane asks for a handoff, it never invents one) and skips
Release that tick, retrying every subsequent tick until the file appears.
`herdr.Session.HandoffRequested` avoids re-prompting every tick. Covered by
`TestRotationRequestsHandoffBeforeReleasing`
(`internal/orchestrator/rotation_test.go`), which asserts Release is never
called before the file exists and fires once it does. Codex/opencode still
share this same path (no harness-specific gap remains); the only leftover
question is whether each harness's own Stop-equivalent hook honors the
in-pane prompt to write the file before exiting, which is a live-deployment
fact, not something provable from source.
Not yet started: B7 (quota projection has no producer),
Codex/opencode completion producers, the turn-decision endpoint, S2S4,