feat(harness): dispatch /v1/harness/complete by harness kind (codex/opencode)

Adds an optional "harness" field so codex/opencode completions route to
their own Usage readers instead of always assuming Claude's transcript
format; unblocks the server side named as open in progress.md.

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 23:31:10 +04:00
parent 44376f0709
commit 72f6230b4a
3 changed files with 39 additions and 3 deletions
+20 -1
View File
@@ -226,7 +226,26 @@ Fixed so far:
it too). Both `TaskCreated` and `TaskAmended` now populate all four fields.
Covered by `TestTaskAmendedAppliesAllFields` (`internal/store`).
Not yet started: Codex/opencode completion producers, S8S11. See
- **Codex/opencode completion producers** — `/v1/harness/complete` was
Claude-only (hardcoded `herdr.ClaudeUsage`). Added an optional `harness`
field to the request body (`""`/`"claude"` unchanged default); `"codex"`
dispatches to `herdr.CodexUsage`, `"opencode"` to `herdr.OpenCodeUsage`,
anything else is a 400. Both readers already existed and were tested in
`internal/herdr` but had zero callers outside tests — same "written, not
wired" pattern the rest of this audit keeps finding. The Claude stop hook
(`deploy/hooks/orchestra-stop.sh`) now sends `"harness":"claude"`
explicitly for symmetry, no behavior change. **Not done:** an actual
Codex/opencode Stop-hook-equivalent script — Codex has no native stop hook
(would need a rollout-tail poller deciding when to call this), and
opencode's own turn-boundary mechanism is unverified from source (same
caveat AUDIT.md already names for Phase 2 item 4). This change unblocks
the server side; the harness-side wrapper for either is still open. No
new test: `cmd/orchestra` has zero handler test coverage of any kind
(pre-existing, confirmed by grep before writing this), so this follows the
existing pattern rather than introducing a one-off test harness for one
handler.
Not yet started: Codex/opencode Stop-hook-equivalent scripts, S8S11. See
`AUDIT.md` for the full plan.
**Phase 0 done (2026-07-27):** this box has live TCP reachability to the real