Skip to content

feat(orchestration): support OpenCode worker model selection - #22134

Closed
user141514 wants to merge 1 commit into
stablyai:mainfrom
user141514:feat/opencode-worker-launch-preferences
Closed

user141514 wants to merge 1 commit into
stablyai:mainfrom
user141514:feat/opencode-worker-launch-preferences

Conversation

@user141514

Copy link
Copy Markdown
Contributor

Allow supervised OpenCode workers to use per-launch model overrides through the existing launch-preference and receipt path. Preserve existing OpenCode agent arguments while replacing only model flags, and reject unsupported effort values explicitly. Keep Native Chat option exposure unchanged and update the worker CLI and orchestration guidance.

ELI5

What Changed

Why

Linked Issue

Fixes #

Visual Proof

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 174556e2-8489-4717-9a88-aadc62683b3c

📥 Commits

Reviewing files that changed from the base of the PR and between 105285182233613a0fa5e2a13b0c2d5eb53a3762 and 2856267.

📒 Files selected for processing (6)
  • docs/site/content/docs/cli/orchestration.mdx
  • skill-guides/orchestration/references/coordinator-loop.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/specs/orchestration-worker-specs.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.test.ts
  • src/shared/tui-agent-startup-session-options.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/site/content/docs/cli/orchestration.mdx
  • skill-guides/orchestration/references/coordinator-loop.md
  • src/cli/specs/orchestration-worker-specs.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

OpenCode now has a dedicated launch-option catalog for worker model arguments. Worker preference resolution uses this catalog and rejects unsupported effort values. CLI and orchestration documentation now list OpenCode support for opaque model IDs. Bundled orchestration guidance now documents the orca-search skill and its conditional search reference.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 28562

No actionable current-head risk remains; the PR is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes a concise PR summary, but most required template sections are incomplete. The linked issue is missing, visual proof is not marked N/A, testing details and checklist items are … Complete the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Agent skill upstream boundary, Notes, and Checklist sections. Provide the issue number, testing details, and either visual attachments or an explicit N/A wit…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 8 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: support for per-launch model selection for OpenCode workers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes a concise PR summary, but most required template sections are incomplete. The linked issue is missing, visual proof is not marked N/A, testing details and checklist items are not completed, and the rationale and user-facing change sections remain as comments.

Resolution

Complete the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Agent skill upstream boundary, Notes, and Checklist sections. Provide the issue number, testing details, and either visual attachments or an explicit N/A with a reason.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 8 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Update the preceding example comment. · orchestration.mdx:43

docs/site/content/docs/cli/orchestration.mdx:43
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the preceding example comment.

The comment excludes OpenCode, while the following statement says that --model supports OpenCode. This conflicting guidance can lead users to conclude that OpenCode does not support --model.

Proposed fix
-# optional per-worker model / effort (Claude, Codex, Cursor only; not with --terminal):
+# optional per-worker model / effort (Claude, Codex, Cursor, OpenCode; not with --terminal):

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: c9e3827f-74e5-449e-bb16-e1f4c28bd3a5

📥 Commits

Reviewing files that changed from the base of the PR and between 841d06a and 105285182233613a0fa5e2a13b0c2d5eb53a3762.

📒 Files selected for processing (10)
  • docs/site/content/docs/cli/orchestration.mdx
  • skill-guides/orchestration/references/coordinator-loop.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/specs/orchestration-worker-specs.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.ts
  • src/shared/agent-session-option-catalog-opencode.test.ts
  • src/shared/agent-session-option-catalog-opencode.ts
  • src/shared/agent-session-option-launch.ts
  • src/shared/tui-agent-startup-session-options.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — two minor suggestions inline.

Reviewed changes

  • OpenCode launch-only catalog — adds OPENCODE_LAUNCH_OPTION_CATALOG that maps an opaque model id to --model, strips configured -m/--model, yet stays out of getAgentSessionOptionCatalog so Native Chat exposure is unchanged.
  • Launch-catalog dispatcher — new getAgentSessionOptionLaunchCatalog routes opencode to the launch catalog and every other agent to the existing catalog; removeOverriddenAgentSessionArgs and resolveAgentSessionOptionLaunch now use it.
  • Worker launch preferences — worker-launch-preferences.ts resolves OpenCode through the launch catalog; --effort is rejected because the launch catalog defines no effort option.
  • Docs — orchestration docs, CLI spec notes, and the regenerated bundled skill guide now list OpenCode.
  • Tests — new OpenCode catalog test plus worker and TUI launch cases pin the model mapping and configured-args replacement.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

export function getAgentSessionOptionLaunchCatalog(
agent: AgentType
): AgentSessionOptionCatalog | null {
return agent === 'opencode' ? OPENCODE_LAUNCH_OPTION_CATALOG : getAgentSessionOptionCatalog(agent)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAgentSessionOptionLaunchCatalog special-cases only 'opencode', so worker-start --agent opencode2 --model … still throws "does not support launch-time model selection" even though opencode2 is the same OpenCode family whose config note says it uses the same flags. Was scoping to opencode deliberate here, or should opencode2 (and possibly mimo-code) route to the same launch catalog? Not a regression — those agents were rejected before this PR too.

@@ -44,7 +44,7 @@ orca orchestration worker-start --task <taskId> --worktree new-child --name bill
orca orchestration worker-start --task <taskId> --worktree current --agent claude --model <opaque-model-id> --effort high --json
```

`--model` accepts opaque provider model IDs for Claude, Codex, and Cursor. `--effort` requires `--model` and only applies when that agent/model supports the level. Neither flag can combine with `--terminal` (reuse an existing pane). Overrides apply to that launch only and show under `launch.requested` / `launch.effective` in the start receipt. Federated starts need a worker host that advertises launch-preference support.
`--model` accepts opaque provider model IDs for Claude, Codex, Cursor, and OpenCode. `--effort` requires `--model` and only applies when that agent/model supports the level. Neither flag can combine with `--terminal` (reuse an existing pane). Overrides apply to that launch only and show under `launch.requested` / `launch.effective` in the start receipt. Federated starts need a worker host that advertises launch-preference support.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line now lists OpenCode, but the comment directly above it (# optional per-worker model / effort (Claude, Codex, Cursor only; not with --terminal):) still names only Claude, Codex, and Cursor. Worth updating that comment so the example matches the supported set below.

Allow supervised OpenCode workers to use per-launch model overrides through the existing launch-preference and receipt path.
Preserve existing OpenCode agent arguments while replacing only model flags, and reject unsupported effort values explicitly.
Keep Native Chat option exposure unchanged and update the worker CLI and orchestration guidance.
@user141514
user141514 force-pushed the feat/opencode-worker-launch-preferences branch from 1052851 to 2856267 Compare September 22, 2026 06:15
nwparker added a commit that referenced this pull request Oct 4, 2026
Preserve original #22134 contribution and the full45-file model feature.
@nwparker

nwparker commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Implemented in the merged #24624 and #24768. Thanks @user141514 for the original worker model-selection contribution.

Supervised OpenCode workers in an existing worktree can select a model through the launch preferences and receipts while preserving automatic and plugin arguments. Unsupported effort values are refused explicitly. The real private OpenCode 2.0.16 checks covered the requested model, genuine supervised completion, and ordinary launches using their configured default. Native Chat option exposure stays unchanged.

Closing this PR as superseded by the merged implementation.

@nwparker nwparker closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants