Run the MARY diagnose job on Claude Haiku 5.5 through OpenCode Go, as one synchronous structured-output call
rank: decision outranks: []
Section titled “rank: decision outranks: []”Run the MARY diagnose job on Claude Haiku 5.5 through OpenCode Go, as one synchronous structured-output call
Section titled “Run the MARY diagnose job on Claude Haiku 5.5 through OpenCode Go, as one synchronous structured-output call”Date: 2026-10-10 Status: closed Supersedes: none. Replaces the provider, model, request shape and monthly cap set by docs/decisions/2026-10-09-mary-diagnose-batch-and-lower-ceilings.md (terms 1–3). Absorbs the structured-output draft of petrova #566, which was closed unmerged and never reached main. Superseded-by: none — current MR-compliance: MR-4, MR-7, MR-9
Context
Section titled “Context”The job (.github/workflows/mary-diagnose.yml) ran Claude Opus 4.8 as a
one-request Message Batch on a dedicated Anthropic API key
(MARY_DIAGNOSE_ANTHROPIC_API_KEY, ruling 2 of the 2026-10-08 decision).
The first real run cost $0.1245, about $15 a month at four snapshots a day.
Three things happened on 2026-10-10:
- The key’s balance ran out. The day’s eval re-runs used it up. The next
tick got
400 "Your credit balance is too low to access the Anthropic API"and stored a finalno_outputrecord for snapshot 38054051236. - A gate made a snapshot final. Earlier, a tick ran while main pinned a
prompt sha the eval had not passed (
9fd19ea0, before #567 reverted it). The job stored a finalno_outputfor that run id. When the gate opened an hour later, nothing could diagnose the snapshot without deleting the artifact by hand. Items 1 and 2 each needed that hand deletion on the same day. - FLIGHT ruled on cost. The Anthropic spend FLIGHT will carry is the Claude Max plan; small jobs move to the OpenCode Go plan ($10 a month) FLIGHT already pays for.
OpenCode Go (https://opencode.ai/docs/go/) serves Claude Haiku 5.5 on the
Anthropic Messages API at https://opencode.ai/zen/go/v1/messages.
Probed 2026-10-10 with FLIGHT’s Go key:
| Capability | Result |
|---|---|
/v1/messages, claude-haiku-5-5 | works |
output_config.format json_schema | works; reply was the schema’s JSON only |
/v1/messages/count_tokens | 404 |
/v1/messages/batches | 404 |
x-opencode-session header | required by Go for routing (GLM refused a request without it) |
Go’s Haiku 5.5 rates are $0.10 / $0.50 per million input / output tokens up to 100K input, and $0.50 / $2.50 above. They count against a $15 monthly Haiku allowance on the Go plan, with 5-hour (20%) and weekly (50%) windows. They are not billed while “Use balance” is off in the OpenCode console.
Decision
Section titled “Decision”-
Provider and model. The job and its eval call
claude-haiku-5-5through OpenCode Go with the Anthropic SDK (baseURL https://opencode.ai/zen/go). The key is the Actions secretOPENCODE_GO_API_KEY.MARY_DIAGNOSE_ANTHROPIC_API_KEYis retired; no workflow reads it. -
Request shape. One synchronous
messages.createper snapshot run id:- thinking off and
max_tokens4096, as before; output_config.formatjson_schema withOUTPUT_SCHEMA, themary.governance-diagnose.v1envelope withadditionalProperties: falsethroughout. This is the schema drafted in #566.user-agent: petrova-mary-diagnose/1.0andx-opencode-session: mary-diagnose-<run id>, as Go asks of clients;maxRetries: 0. A failed call is retried by the next tick, not in the same process.
Message Batches go away, with their
--awaitcollect step and their artifacts. - thinking off and
-
What is final. A stored record is final for its run id, as before. Only two things store one:
- a model reply (
generated, verdict attached); - a per-run ceiling refusal (
no_output). This one depends on the snapshot’s size, so retrying cannot change it.
Configuration gates write no record: no ceiling set, eval gate not passed, key not set, monthly cap reached. Failed calls write none either (network, 429, 5xx, 4xx including an exhausted allowance). The tick logs a
::warning::and the next tick tries the same run id. Until then the band shows “no governance-diagnose artifact”, as it does for any undiagnosed run. - a model reply (
-
Cost guards.
- Per run: the ceiling is still
MARY_DIAGNOSE_COST_CEILING_USD($0.25). It is checked against an estimate, because Go has no token count: input tokens = prompt characters ÷ 2, plus 4096 output tokens, at Go’s tier for that input size. The ÷ 2 over-counts by about 10%; Haiku 5.5 measured about 2.2 characters a token on the eval fixtures. A live snapshot is about $0.01 by this estimate. - Per month: the default share of the Go Haiku allowance drops from
$15 to $3. The allowance is shared with FLIGHT’s interactive OpenCode
use, so the job takes a fifth.
MARY_DIAGNOSE_MONTHLY_CAP_USDstill overrides it. - Backstop: Go’s own limits. Keep “Use balance” off so hitting them costs nothing.
- Per run: the ceiling is still
-
Model change through term 7. The 2026-10-08 decision, term 7 and ruling 5, routes a model change through three steps:
- eva-hq #136 (merged,
f1899f6b) setsmodel: claude-haiku-5-5in the prompt’smeta.yml.prompt.xmlis unchanged, byte-identical toa7a4e96d;verify.shis unchanged (sha256b4cd4379…). - The petrova pin moves to
f1899f6bin this PR. Thepinandevalchecks run. - FLIGHT records the pass in
MARY_DIAGNOSE_EVAL_PASSED_SHA.
The eval workflow now also fails if
meta.ymlat the pin names a model other than the job’sMODEL. - eva-hq #136 (merged,
-
The verifier is unchanged and still final. Statement caps, citations, the digit rule and number words are still its checks. The schema removes a failure class; it replaces no check.
Evidence
Section titled “Evidence”Prompt a7a4e96d, and f1899f6b (eva-hq #136: same prompt.xml bytes, model: claude-haiku-5-5), petrova eval script on the job’s own request shape,
2026-10-10:
| Model | Runs | Cases | Pass | Envelope errors | Dropped |
|---|---|---|---|---|---|
| Opus 4.8, batch shape, no schema | 3 × full | 24 | 22 | 1 | 1 |
| Opus 4.8, with schema (#566) | 2 × full, 2 × trim-v1 | 32 | 31 | 0 | 1 (prose-count, number word) |
| Haiku 5.5 via Go, with schema | 2 × full, 2 × trim-v1 at a7a4e96d | 32 | 32 | 0 | 0 |
| Haiku 5.5 via Go, with schema | 1 × full, 1 × trim-v1 at f1899f6b (eight cases) | 16 | 16 | 0 | 0 |
| Haiku 5.5 via Go, with schema | number-word-note (not vendored), both shapes | 17 | 11 | 0 | 6 (number word “zero”) |
number-word-note stays a known gap, as on Opus, where every prompt tried
failed it. Haiku restates the note’s “zero” in about a third of runs; the
verifier drops that statement, so nothing false renders. A 4/4 first sample
was luck. The case stays out of the vendored fixtures so the CI eval measures
the eight cases the gate has always meant.
Haiku used about 7.5–9k input tokens and 0.4–3.2k output tokens per fixture,
$0.0010–0.0025 of the allowance per call. A live snapshot is about 48k
tokens. Projected cost is about $0.005–0.007 a run, or $0.60–0.85 a month at
four runs a day: well under the $3 share.
Choices for FLIGHT
Section titled “Choices for FLIGHT”The code for choice A merged in petrova #569 (0b985e0e) before the
ruling and is live: snapshot 38054051236 was diagnosed through Go in run
38085427840 (5 statements kept, $0.0064). B or C would undo part of it.
| # | What | Effect |
|---|---|---|
| A (proposed) | Terms 1–6 as written | $0 marginal cost; snapshots never lost to a gate or an outage |
| B | Terms 1, 2, 4–6; keep gates final (term 3 as before) | Same cost; a closed gate still loses that snapshot’s diagnosis |
| C | Stay on Opus 4.8 with a funded Anthropic key | About $15 a month; reverts #569 and re-pins eva-hq to an Opus meta.yml; number-word failures stay |
Alternatives considered
Section titled “Alternatives considered”- Claude Max via
claude setup-token(CLAUDE_CODE_OAUTH_TOKEN) andanthropics/claude-code-action. Costs nothing extra and keeps Opus, but it runs a full agent for what is one structured call, and it shares Max limits with FLIGHT’s interactive work. Better suited to the agentic jobs (IRINA’s judgement step, asgard’s jazz workflows) than to this one. - A non-Anthropic Go model (GLM, Kimi, DeepSeek). They use Go’s
/chat/completions, a second SDK, and an eval from zero. Haiku keeps the Anthropic SDK, the request shape and the schema, so the eval transfers. - Keep batches. Go has none.
- Go’s terms. Go is “designed for OpenCode and other coding agents that produce similar types of requests”, and its traffic is monitored for abuse. Four small calls a day that name themselves and send a session id are low volume, but a scheduled CI job is not what the page describes. If Go objects, the fallback is choice C or the Max path above.
- Data path. Governance snapshot content (mary-wiki register, notes, gate states) now goes through OpenCode before reaching Anthropic. Go marks some models “Not ZDR”, for example Muse Spark; it makes no statement about Haiku’s retention.
- Shared allowance. The key is FLIGHT’s interactive key. A heavy interactive week can use up the weekly window. The job then gets 429s, writes nothing, and catches up on the newest snapshot later.
Consequences
Section titled “Consequences”host/scripts/mary-diagnose-lib.mjs:MODEL,BASE_URL,USER_AGENT,OUTPUT_SCHEMA,messageRequest,clientOptions,estimateTokens, Go rates,callFailure,recordFromMessage;planTickis skip|call.batchRequest,submitOnce,recordFromResult,failureReasonandawaitEndedare removed.host/scripts/mary-diagnose.mjs: one call per tick; gates and failures exit with a warning and no artifact. Records carryprovenance.provider: "opencode-go"andestimate_usd..github/workflows/mary-diagnose.yml: the collect steps are removed; the timeout drops from 40 to 15 minutes; the secret isOPENCODE_GO_API_KEY..github/workflows/mary-diagnose-eval.yml: uses the Go key and checks themeta.ymlmodel.docs/runbooks/secrets-inventory.yaml: addsOPENCODE_GO_API_KEYand retiresMARY_DIAGNOSE_ANTHROPIC_API_KEY.- Legacy
governance-diagnose-batch-*artifacts are still read by the monthly sum until they expire. The job no longer writes them.
Open for FLIGHT
Section titled “Open for FLIGHT”Rule A, B or C(ruled A, 2026-10-11).Set the Actions secret(set 2026-10-10T19:51Z).OPENCODE_GO_API_KEYMerge eva-hq #136(mergedf1899f6b; this PR pins it).Set(set toMARY_DIAGNOSE_EVAL_PASSED_SHAf1899f6bfa944aa1317b00769413c4878e2da9d1on 2026-10-10T20:51Z).- Delete the Actions secret
MARY_DIAGNOSE_ANTHROPIC_API_KEY. Its precondition is met: a generated record landed in run 38085427840.
References
Section titled “References”docs/decisions/2026-10-08-mary-governance-generated-statements-render.md(terms 6, 7; ruling 5)docs/decisions/2026-10-09-mary-diagnose-batch-and-lower-ceilings.md(terms 1–3, 5)- petrova #566 (structured-output draft, closed unmerged), #569 (this change)
- eva-hq #136 (
meta.ymlmodel); petrova #556, #562, #567 - https://opencode.ai/docs/go/
Sign-off
Section titled “Sign-off”- Subagent: Claude Opus 5.5, 2026-10-10 (drafted; probes and evals run with
FLIGHT’s Go key from this branch, prompt
a7a4e96d); corrected before the ruling in petrova #570 (837ccf03) - Human: flight@arno.host, 2026-10-11 — rule A: terms 1–6 as written.
Claude Haiku 5.5 through OpenCode Go (
OPENCODE_GO_API_KEY), one synchronous structured-output call per run id; gates and failed calls write no record and retry next tick; $0.25 per run against the char/2 estimate, $3 a month default share of the Go Haiku allowance; model change via term 7 (eva-hqf1899f6b); verifier unchanged.
Countersigned by human:flight@arno.host on 2026-10-11 — box ticked in
commit dfb5c17d (petrova #571), authored by the human, squashed into
ee9e3a18 on main. Choice A: terms 1–6 accepted as drafted. Terms 1–3 of
2026-10-09-mary-diagnose-batch-and-lower-ceilings.md (provider, model,
request shape, monthly cap) are replaced; its other terms stand. Status
flipped open→closed on 2026-10-11 by an agent as scribe (MR-7).