Repository navigation
Validate OpenCode worker model preferences on the execution host - #24624
Conversation
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.
Reuse captured composer readiness on local and paired execution hosts and revoke launching-shell paste anchors. Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
…apability Co-authored-by: user141514 <user141514@users.noreply.github.com>
Co-authored-by: Adnan Khan <adnank11427@gmail.com>
Reuse captured composer readiness on local and paired execution hosts and revoke launching-shell paste anchors. Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
Preserve current overlay cleanup and restore the qualified run prompt contract.
Preserve original #22134 contribution and the full37-file catalog.
|
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
📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change adds per-launch OpenCode model selection for execution hosts that verify the CLI version and model availability. It adds OpenCode launch-option serialization and runtime preflight checks. Worker and agent-launch paths reject unsupported preferences before launch effects. Tests cover model validation, supported and unsupported environments, PTY creation, and refusal handling. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The launch flows continue to refuse unsupported configurations before starting and preserve existing promptless launches; no merge-blocking issue is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The new launch preference is guarded and does not appear to widen access. Incomplete verification of command handling and failure recovery leaves limited residual uncertainty. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 33 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
71e5504b-1d8a-4ed4-9782-42093df61909
📒 Files selected for processing (37)
docs/site/content/docs/cli/orchestration.mdxskill-guides/orchestration/references/coordinator-loop.mdsrc/cli/bundled-skill-guides.tssrc/cli/specs/orchestration-worker-specs.tssrc/main/agent-launch/__fixtures__/host-agent-startup-call-sites.txtsrc/main/agent-launch/agent-launch-executor.tssrc/main/agent-launch/agent-launch-opencode-model.test.tssrc/main/opencode/opencode-model-availability.test.tssrc/main/opencode/opencode-model-availability.tssrc/main/opencode/opencode-model-startup-plan.test.tssrc/main/opencode/opencode-model-startup-plan.tssrc/main/opencode/opencode-model-version-policy.test.tssrc/main/opencode/opencode-model-version-policy.tssrc/main/runtime/opencode-model-worktree-create.test.tssrc/main/runtime/orca-runtime-create-agent-session.tssrc/main/runtime/orca-runtime-create-managed-worktree.tssrc/main/runtime/orca-runtime-get-agent-session-execution-namespace.tssrc/main/runtime/orca-runtime-get-terminal-interactive-wait.tssrc/main/runtime/orca-runtime-resolve-worktree-removal-target.tssrc/main/runtime/orchestration-opencode-model-host.test.tssrc/main/runtime/rpc/methods/agent-launch-failure-code.tssrc/main/runtime/rpc/methods/agent-launch-prestart-failure.test.tssrc/main/runtime/rpc/methods/agent-launch.tssrc/main/runtime/rpc/methods/orchestration/federation/federation.tssrc/main/runtime/rpc/methods/orchestration/worker/local-worker-start.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-opencode-model-preflight.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-start-validation.tssrc/main/runtime/rpc/methods/orchestration/worker/workers-new-worktree.test.tssrc/main/runtime/runtime-worktree-agent-startup.tssrc/renderer/src/components/terminal-pane/ipc-pty-opencode-model.test.tssrc/renderer/src/components/terminal-pane/ipc-pty-spawn-request.tssrc/shared/agent-session-option-catalog-opencode.test.tssrc/shared/agent-session-option-catalog-opencode.tssrc/shared/agent-session-option-launch.tssrc/shared/tui-agent-startup-session-options.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Refused OpenCode model catalogs whose
opencode modelsoutput was truncated byrunProcessor ends mid-line —probeOpenCodeModelAvailabilitynow also requires!outputTruncatedandstdout.endsWith('\n'), so an incomplete catalog can no longer validate a model. - Added an explicit existing-worktree requirement to
resolveWorkerLaunchPreferences: an OpenCode--modelwithcreatesWorktreerefuses first, with a worktree-specificcapability_unsupportedmessage, before the CLI-verification refusal. - Threaded
createsWorktreethroughprepareLocalWorkerStartandprepareFederationAttachmentWorkerStartso both start paths reach that guard before any worktree or terminal effect. - Updated the CLI spec, the orchestration docs page, and the coordinator-loop reference to state that OpenCode
--modelis existing-worktree-only; regeneratedbundled-skill-guides.tsstays in sync with the reference. - Added focused coverage: truncated and unterminated catalog refusal, LF/CRLF acceptance, and the worktree-specific refusal message on both start paths (asserting no probe and no side effects).
The delta responds directly to both CodeRabbit findings at these locations and reconciles the prior review's new-worktree concern. 44 tests across the two directly-changed test files plus 24 in workers-new-worktree.test.ts pass, and the bundled-skill-guide verifier is clean at a3f7e81. The residual heuristic gap — a catalog cut exactly at a line boundary — is already documented in the PR notes and is a deliberate fail-closed tradeoff.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Accepted upstream's deletion of config/scripts/orchestration-skill-guidance.test.mjs. stablyai#25791 removed all four skill-guidance test files as a category with no replacement, so this branch's assertions go with them; the guidance text they pinned is unchanged. references/coordinator-loop.md auto-merged cleanly: stablyai#24624 rewrote the OpenCode paragraph in the slot this branch had already placed it, and the defaults policy around it is intact. src/cli/bundled-skill-guides.ts is generated and was regenerated, not resolved. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011nnNsG3p4Do9eiyfXGr2rB

ELI5
An OpenCode worker can use a requested model without changing the default for later launches.
What Changed
Validate the requested model on the execution host before creating a terminal or sending input. Preserve command arguments, startup, and resume behavior through Orca's existing launch preferences and receipts. Refuse truncated or visibly unfinished model catalogs. New-worktree requests explain that model selection requires the current or an existing worktree.
Why
The machine running OpenCode knows which CLI and models are available. Checking there prevents silent fallback. Reusing the launch path keeps validation before effects and preserves existing behavior.
Linked Issue
Part of #19980. Preserves #22134 and credits @user141514. OpenCode 2.0.16 model isolation follows in #24768.
Visual Proof
Actual installed-OpenCode model B and later default-model A turns, including screenshots pinned to source
c8fdfdbe.The catalog correction also has an actual macOS before/after check: installed OpenCode 2.0.16 returned 262,144 bytes ending mid-line. The old probe accepted a model in that prefix; the repaired probe refused it. Both probes accepted the complete small catalog. These four checks ran the actual CLI without model turns.
Testing
Earlier feature qualification passed 147 focused tests and all three typechecks, lint, format, and quality checks; its later integration passed 52 tests and all three typechecks. Review corrections passed 93 targeted tests and all three typechecks. The final catalog correction passed 10 tests, Node typechecks for both PRs, and affected lint, format, and quality checks.
Actual testing used private macOS profiles and a controlled provider. Windows, WSL, and SSH boundaries have automated coverage.
Review
Independently reviewed. The complete original contribution is preserved. Exact verified legacy versions 1.18.30 and 1.18.32 are supported here; #24768 adds verified 2.0.16 support. Unsupported requests fail before launch.
Agent skill upstream boundary
Notes
#22134 remains open until its complete replacement is merged. Linked model-isolation screenshots retain their original source identity. A final newline catches visibly incomplete catalog output; a cut exactly at a line boundary cannot be detected this way.
Checklist