Repository navigation
fix(bin): pass the dispatch profile effort to OpenCode workers through their launch config - #5542
karotkriss wants to merge 4 commits into
Conversation
…aunch config The dispatch profile's effort axis was recorded in task metadata but never reached an OpenCode worker: the launch wrote only a permission grant into the config it constructs. OpenCode 1.18.32's config schema carries per-model reasoning effort as agent.<name>.variant, so the chosen effort is now merged into the same OPENCODE_CONFIG_CONTENT JSON as the default build agent's variant, keyed to the resolved model. With no effort chosen the launch stays byte-identical. Fixes kunchenguid#1373
Keep main's restructured crew-dispatch configuration docs and restore the OpenCode agent.build.variant effort sentence under model/effort behavior.
|
Speaking as Kun's firstmate: First look vs main Closes #1373: yes — body Fixes #1373; tip writes profile effort into OpenCode contract-class: VISION: One captain / interface — aligns (captain-chosen effort applies). Authority explicit — aligns (effort remains captain-owned; omit when unsupported). Scripts — aligns. Restart — n/a. Delegation/spine — aligns (worker contract matches profile). Vendor — aligns (config schema field, not UI scrape). Scope — aligns (launch wiring). Conflicts: only Attestation: MISMATCH (body Security: none. Firstmate flag: no. Waiting on: author (attestation / NM), not captain. |
|
Superseded by #5799, which carries the same change re-validated on a fresh branch. |
Intent
Fixes #1373
The dispatch profile's effort axis is recorded in task metadata but never reaches an OpenCode worker: the launch writes only a permission grant into the config it constructs, and no effort setting is passed.
Write the chosen effort into the OpenCode config the launch already constructs, using the config field OpenCode documents for per-model reasoning effort, so the worker runs at the profile's effort; when no effort is chosen the launch stays byte-identical.
This closes upstream issue #1373.
What Changed
effort_flag_for_harnessnow emits anagent.buildentry (model +variant) into theOPENCODE_CONFIG_CONTENTJSON the OpenCode launch already writes, so the profile's effort reaches the worker via the config schema's per-model reasoning-effort field instead of being dropped; the entry is gated to providers/efforts known to expose a matching variant (anthropic/*: high, max;openai/*: low, medium, high, xhigh), and with no resolved model, another provider, or an out-of-family effort the launch stays byte-identical to the permission-only form.docs/configuration.mdand the OpenCode harness-adapter reference to document how the effort rides the launch config and when the variant is omitted.Risk Assessment
✅ Low: The fix-round change correctly implements the human-chosen provider-family gating with a preserved byte-identical no-effort launch, sound JSON escaping and substitution, and behavioral tests over the emitted launch command; it is well-bounded with no reachable defect found.
Testing
I derived scenarios from the intent and the round-1 provider-family gating decision, then drove each against the real fm-spawn.sh launch builder (which emits the literal command firstmate would run). anthropic/claude-sonnet-4-5 + high emits
"agent":{"build":{"model":"anthropic/claude-sonnet-4-5","variant":"high"}}; openai/gpt-5.6-sol + xhigh emits the openai-family variant; no effort produces{"permission":{"*":"allow"}}which is byte-identical to the base commit's template; anthropic + medium (outside anthropic's high|max list) omits the variant and stays permission-only. The full dispatch-profile suite also passed (exit 0). The only aspect not drivable here is whether opencode 1.18.32 actually honors agent.build.variant at runtime and runs the worker at that effort - that needs a live opencode binary plus real model API credentials, so it is reported untested, not as a finding, since the change's own surface is fully validated.Evidence: Emitted opencode launch commands (four cases)
Source: Emitted opencode launch commands (four cases)
anthropic+high -> ...OPENCODE_CONFIG_CONTENT='{"permission":{"":"allow"},"agent":{"build":{"model":"anthropic/claude-sonnet-4-5","variant":"high"}}}' opencode --model 'anthropic/claude-sonnet-4-5' --prompt... anthropic+no-effort -> ...OPENCODE_CONFIG_CONTENT='{"permission":{"":"allow"}}' opencode --model 'anthropic/claude-sonnet-4-5'... openai+xhigh -> ..."variant":"xhigh"}}}... anthropic+medium -> ...OPENCODE_CONFIG_CONTENT='{"permission":{"*":"allow"}}'... (variant omitted)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-spawn.sh:2527- effort_flag_for_harness opencode branch (bin/fm-spawn.sh:2526-2532) writes the requested effort as agent.build.variant for ANY of low|medium|high|xhigh|max, but the branch's own comment (2521) states each model exposes only a subset (Anthropic high|max, OpenAI low..xhigh). A dispatch profile pairing e.g. anthropic/claude-sonnet-4-5 with effort=medium (a plausible real config) writes variant="medium", which that model has no variant for. This diverges from the deliberate record-and-omit precedent in this same function: codex omits max unless model=gpt-5.6-luna (2472-2474) and grok omits xhigh/max (2483-2484) precisely to avoid passing known-bad values. If OpenCode rejects an unknown variant at config/model resolution, this regresses the previously always-valid permission-only launch for those combos; if it silently ignores it, the profile's effort just never applies. I cannot verify OpenCode's behavior from source. Because a durable fix requires per-model variant-list knowledge (a catalog/probe) that extends the change beyond writing the chosen effort, the remedy - not the defect - needs the author's decision; confirm whether an unsupported variant fails the launch or is ignored, and whether to gate emission by the model's variant list as codex/grok do.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-spawn-dispatch-profile.test.sh(full suite, exit 0; the four opencode scenarios all reported ok)Drove fm-spawn.sh directly for four opencode cases via run_ship_spawn and captured the literaltmux send-keys -llaunch command for each (anthropic/high, anthropic/no-effort, openai/xhigh, anthropic/medium)Compared the no-effort emitted config against the base commit's opencode template to confirm byte-identical output✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.