Skip to content

the OpenCode orchestrator-worktree argv carries no --model, so worktree executors run on the session model #5260

Description

@stiefenm
  • Found: 2026-10-06, Cowright Phase 1 research (Pitfall 2); patched locally since Plan 01-01
  • Environment: GSD Core 1.16.0 (--opencode --global), OpenCode 1.18.35, Linux

Summary

capability-registry.cjs describes the OpenCode orchestrator-worktree executor as
"command": "opencode", "args": ["run"] (two blocks). opencode run --dir <wt> <prompt> without
--model uses the config model, the brain model, and --agent cannot select a subagent-mode
agent such as gsd-executor. The model_overrides entry for gsd-executor is baked into the agent
file, which the spawned process never loads as its agent. Parallel-wave executors therefore lose
their per-role model on OpenCode.

Minimal repro

  1. {"model_overrides": {"gsd-executor": "<provider>/<cheap-model>"}} in ~/.gsd/defaults.json,
    then npx @opengsd/gsd-core@1.16.0 --opencode --global.
  2. gsd-tools query dispatch-isolation --json in a project: the exec argv is
    ["run", "--dir", "<wt>", "<prompt>"], with no model.

Expected

The orchestrator-worktree argv carries --model <resolved gsd-executor model> whenever an override
exists for the executor role.

Actual

No model flag; the process runs on the session model.

Suggested fix

Give the OpenCode runtime descriptor a model flag and resolve the executor's model into the argv at
dispatch time, the same way Task() model parameters are resolved on Claude Code (#2256).

Cowright workaround

scripts/patches/registry-model.cjs inserts "--model", "<hands>" after "run" in both blocks after
every install; check C06 verifies the argv. Not exercised live yet, because no worktree dispatch
happened in the smoke (U-06).

Evidence

  • docs/smoke/runs/2026-10-07/mechanical-final.json (C06)
  • scripts/patches/registry-model.cjs header

Activity

  1. trek-e commented on Oct 9, 2026

    @trek-e
    Collaborator

    This was generated by AI during triage.

    Diagnosis

    Reproduced: yes — runtime opencode, model_overrides["gsd-executor"]="openai/gpt-5-mini", query dispatch-isolation --json --cwd-target /tmp/wt --prompt hello returns exec.args ["run","--dir","/tmp/wt","hello"]; no --model. opencode run --help and opencode.ai/docs/cli confirm -m, --model (provider/model) is a supported run flag.
    Root cause: the OpenCode orchestratorExec descriptor declares no modelFlag, in capabilities/opencode/capability.json:111-118 (generated into gsd-core/bin/lib/capability-registry.cjs:3002 and :7278); gsd-core/bin/gsd-tools.cjs:2668 (resolveDispatchIsolationDecision) skips model-pin resolution entirely when no modelFlag is declared, and src/host-integration.cts:962 (resolveOrchestratorExec) appends the flag only when the descriptor has one. Codex is the only descriptor with modelFlag (capabilities/codex/capability.json:105, #3714). Secondary: resolveDispatchModelPin (gsd-tools.cjs:2546-2560) drops any value containing "claude" with a Codex-worded warning, which would still drop anthropic/claude-* pins on OpenCode after the descriptor fix.
    Introduced by: long-standing (OpenCode orchestratorExec added 4a66d62, 2026-07-24, #2625; Codex modelFlag a3d5841, 2026-08-26)
    Blast radius: Low-Medium — descriptor + generated registry + capability matrix doc; shared pin policy in resolveDispatchModelPin also serves Codex.
    Coupled (must not miss): #5259 (same OpenCode dispatch path); gsd-tools.cjs declaresModelFlag gate and its warning text; regenerate registry; tests/host-integration-descriptors.test.cjs, tests/model-resolver.test.cjs; changeset. CodeGraph/Memtrace/Cortex checks did not run this pass (bounded grep used); no recorded decision found in ADR-1239 or the capability matrix.
    Regression test: with runtime opencode and a gsd-executor pin, dispatch-isolation --json --cwd-target <wt> --prompt <p> exec.args contain --model <pin> with the prompt last; unpinned/inherit argv unchanged; leading-dash pin dropped without exec:null; an anthropic/claude-* pin is delivered on OpenCode but still dropped on Codex.

  2. trek-e commented on Oct 9, 2026

    @trek-e
    Collaborator

    Agent Brief

    Category: bug
    Summary: OpenCode worktree executors ignore the gsd-executor model override because the dispatch argv never carries a model flag.
    Current behavior: With a model_overrides entry for gsd-executor on the OpenCode runtime, the orchestrator-worktree exec argv from query dispatch-isolation is run --dir <wt> <prompt>; the spawned process runs on the session/config model. A claude-containing pin would additionally be discarded by the shared pin policy with a Codex-worded warning.
    Desired behavior: When an explicit, valid gsd-executor pin exists, the OpenCode argv carries --model <provider/model> (OpenCode's documented run flag) ahead of the prompt; with no pin, inherit, or an invalid value, the argv is unchanged and never fatal.
    Key interfaces: query dispatch-isolation --json --cwd-target --prompt; the runtime descriptor's orchestratorExec model-flag axis; the dispatch model-pin policy; the generated capability registry.
    Acceptance criteria: pinned OpenCode run yields --model <pin> before the prompt, prompt last; unpinned/inherit/leading-dash pins leave argv as today; an Anthropic-flavored provider/model pin is honored on OpenCode and still dropped on Codex; Codex and kimi argv unchanged; registry regenerated; capability matrix doc updated.
    Out of scope: profile/tier-derived models reaching argv; Codex passive-model posture; --agent selection; kimi/kimi-code.

  3. added
    bugSomething isn't working
    and removed
    needs-triageNew issue awaiting maintainer review
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfirmed-bugVerified reproducible bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions