Skip to content

Run the MARY diagnose job on Claude Haiku 5.5 through OpenCode Go, as one synchronous structured-output call


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

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:

  1. 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 final no_output record for snapshot 38054051236.
  2. 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 final no_output for 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.
  3. 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:

CapabilityResult
/v1/messages, claude-haiku-5-5works
output_config.format json_schemaworks; reply was the schema’s JSON only
/v1/messages/count_tokens404
/v1/messages/batches404
x-opencode-session headerrequired 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.

  1. Provider and model. The job and its eval call claude-haiku-5-5 through OpenCode Go with the Anthropic SDK (baseURL https://opencode.ai/zen/go). The key is the Actions secret OPENCODE_GO_API_KEY. MARY_DIAGNOSE_ANTHROPIC_API_KEY is retired; no workflow reads it.

  2. Request shape. One synchronous messages.create per snapshot run id:

    • thinking off and max_tokens 4096, as before;
    • output_config.format json_schema with OUTPUT_SCHEMA, the mary.governance-diagnose.v1 envelope with additionalProperties: false throughout. This is the schema drafted in #566.
    • user-agent: petrova-mary-diagnose/1.0 and x-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 --await collect step and their artifacts.

  3. 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.

  4. 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_USD still overrides it.
    • Backstop: Go’s own limits. Keep “Use balance” off so hitting them costs nothing.
  5. 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) sets model: claude-haiku-5-5 in the prompt’s meta.yml. prompt.xml is unchanged, byte-identical to a7a4e96d; verify.sh is unchanged (sha256 b4cd4379…).
    • The petrova pin moves to f1899f6b in this PR. The pin and eval checks run.
    • FLIGHT records the pass in MARY_DIAGNOSE_EVAL_PASSED_SHA.

    The eval workflow now also fails if meta.yml at the pin names a model other than the job’s MODEL.

  6. 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.

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:

ModelRunsCasesPassEnvelope errorsDropped
Opus 4.8, batch shape, no schema3 × full242211
Opus 4.8, with schema (#566)2 × full, 2 × trim-v1323101 (prose-count, number word)
Haiku 5.5 via Go, with schema2 × full, 2 × trim-v1 at a7a4e96d323200
Haiku 5.5 via Go, with schema1 × full, 1 × trim-v1 at f1899f6b (eight cases)161600
Haiku 5.5 via Go, with schemanumber-word-note (not vendored), both shapes171106 (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.

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.

#WhatEffect
A (proposed)Terms 1–6 as written$0 marginal cost; snapshots never lost to a gate or an outage
BTerms 1, 2, 4–6; keep gates final (term 3 as before)Same cost; a closed gate still loses that snapshot’s diagnosis
CStay on Opus 4.8 with a funded Anthropic keyAbout $15 a month; reverts #569 and re-pins eva-hq to an Opus meta.yml; number-word failures stay
  • Claude Max via claude setup-token (CLAUDE_CODE_OAUTH_TOKEN) and anthropics/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.
  • host/scripts/mary-diagnose-lib.mjs: MODEL, BASE_URL, USER_AGENT, OUTPUT_SCHEMA, messageRequest, clientOptions, estimateTokens, Go rates, callFailure, recordFromMessage; planTick is skip|call. batchRequest, submitOnce, recordFromResult, failureReason and awaitEnded are removed.
  • host/scripts/mary-diagnose.mjs: one call per tick; gates and failures exit with a warning and no artifact. Records carry provenance.provider: "opencode-go" and estimate_usd.
  • .github/workflows/mary-diagnose.yml: the collect steps are removed; the timeout drops from 40 to 15 minutes; the secret is OPENCODE_GO_API_KEY.
  • .github/workflows/mary-diagnose-eval.yml: uses the Go key and checks the meta.yml model.
  • docs/runbooks/secrets-inventory.yaml: adds OPENCODE_GO_API_KEY and retires MARY_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.
  1. Rule A, B or C (ruled A, 2026-10-11).
  2. Set the Actions secret OPENCODE_GO_API_KEY (set 2026-10-10T19:51Z).
  3. Merge eva-hq #136 (merged f1899f6b; this PR pins it).
  4. Set MARY_DIAGNOSE_EVAL_PASSED_SHA (set to f1899f6bfa944aa1317b00769413c4878e2da9d1 on 2026-10-10T20:51Z).
  5. Delete the Actions secret MARY_DIAGNOSE_ANTHROPIC_API_KEY. Its precondition is met: a generated record landed in run 38085427840.
  • 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.yml model); petrova #556, #562, #567
  • https://opencode.ai/docs/go/
  • 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-hq f1899f6b); 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).