Repository navigation
Conversation
…h gate OpenCode CLI 1.18.35 was refused by the worker-start --model version gate (capability_unsupported) even when the requested model was available and the account authenticated, because VERIFIED_LEGACY_MODEL_VERSIONS only listed 1.18.30 and 1.18.32. Add 1.18.35 to the verified set, keeping the fail-closed behavior for every other unverified version. Also make the refusal message name the detected CLI version and the verified version list, so a rejected launch no longer requires reading the source to learn what would be accepted. Fixes stablyai#26611 Generated-by: GLM-5.3-Flash (ZCode)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe verified legacy-version set now includes OpenCode CLI 1.18.35. Startup validation checks model availability for verified legacy versions and refuses nonempty manual launch arguments. Refusals for unsupported versions identify the detected version and verified-version list. Tests cover the added version and rejection of version 1.18.34. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable issue is identified for this change; it is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e0732909-8d35-4637-bbf6-e63aed2d30d9
📒 Files selected for processing (4)
src/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.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Addressing the review round (real-CLI verification + docstring coverage): Real-CLI verification of 1.18.35 (new evidence) Temporarily installed
Scope note: this is the non-interactive With these checks passing, the issue's "add support if tests pass" condition holds, so the allowlist entry stays (the suggested revert to fail-closed is not needed). Docstring coverage Added one-line docstrings to the touched helpers (allowlist predicate, executable resolution, availability probe, both startup-plan entry points) in fa3d6cd — comments only, no behavior change. Focused suites pass (29/29 across |
CodeRabbit flagged docstring coverage on the PR-touched functions. Add one-line docstrings to the verified-version allowlist, the model availability probe, and the startup plan entry points. No behavior change. Generated-by: GLM-5.3-Flash (ZCode)
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Restore the legacy-version agentArgs refusal. · opencode-model-startup-plan.ts:96-97
src/main/opencode/opencode-model-startup-plan.ts:96-97
🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRestore the legacy-version
agentArgsrefusal.For verified legacy versions, the early
return { inputs }bypasses the existinginputs.agentArgs?.trim()refusal. A reachable worker can therefore continue with nonemptyagentArgs, which the previous code rejected before launch. This permits caller-supplied OpenCode flags to accompany the generated--modelcommand and can override or otherwise change model selection, breaking the fail-closed guarantee for manual launch arguments.Restore the refusal before returning the legacy plan.
Suggested fix
+ if (inputs.agentArgs?.trim()) { + return refuseModel() + } return { inputs }
🧹 Nitpick comments (1)
src/main/opencode/opencode-model-startup-plan.test.ts (1)
113-125: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the legacy availability probe in the startup-planner test.
The 1.18.35 test mocks
probeOpenCodeModelAvailabilityto returntrueand checks only the launch command. A planner that skips the probe would still pass this test. The helper tests call the helper directly, so they do not detect this caller regression. Assert the probe call and add a false-result case that expects refusal.Suggested fix
- expect((await buildExecutionHostAgentStartupPlan(scope()))?.launchCommand).toContain( - '--model' - ) + const plan = await buildExecutionHostAgentStartupPlan(scope()) + expect(plan?.launchCommand).toContain('--model') + expect(probeOpenCodeModelAvailability).toHaveBeenCalledWith( + expect.objectContaining({ model: preferred, cwd: '/private/project' }) + ) expect(probeOpenCodeLaunchModelContext).not.toHaveBeenCalled() } ) + it('refuses an unavailable model on the verified legacy route', async () => { + vi.mocked(probeOpenCodeLaunchCapabilities).mockResolvedValue({ + version: '1.18.35', + pluginApi: 'v1', + promptMode: 'submit' + }) + vi.mocked(probeOpenCodeModelAvailability).mockResolvedValue(false) + + await expect(buildExecutionHostAgentStartupPlan(scope())).rejects.toMatchObject({ + code: 'capability_unsupported' + }) + }) +
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a6b0c0bd-1614-4464-a023-ecc3a6c3072f
📒 Files selected for processing (3)
src/main/opencode/opencode-model-availability.tssrc/main/opencode/opencode-model-startup-plan.tssrc/main/opencode/opencode-model-version-policy.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/opencode/opencode-model-version-policy.ts
- src/main/opencode/opencode-model-startup-plan.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Confirmed the Major and fixed it in c00557f. I verified the regression against the base: the pre-PR check Changes:
Verification: |
The legacy-version early return bypassed the unconditional `agentArgs` refusal that the pre-refactor check enforced for every version, so a reachable worker could keep caller-supplied OpenCode flags alongside the verified `--model` launch. Restore the refusal before returning the legacy plan and lock the route with tests: manual args now refuse, an unavailable catalog model refuses, and the legacy pass-through asserts the availability probe ran. Generated-by: GLM-5.3-Flash (ZCode)
|
Thx for the PR. But still this is a hardcode list. Once opencode upgrade we will face this prob again. I don't think this is ideal. |
|
Thanks for following up - you're right that a hardcoded list isn't the ideal end state, and the issue's preference for capability-based verification is fair. I re-tested whether that's feasible for the 1.18.x line today, and it currently isn't, on three concrete grounds:
So there is no safe runtime capability probe for launch-time model selection on the legacy line today. The alternatives would be another schema map keyed by version (still hardcoded, and more brittle than the allowlist, plus the port problem) or accepting launches we cannot verify, which point 3 of this issue rules out. Until the legacy line exposes a port-safe, programmable way to confirm selection, the exact-version allowlist plus the If opencode adds a selection-verification surface to the 1.x line, I'm glad to switch this to capability probing and delete the list. |
|
Wouldn't it be better to use a denylist instead of an exact-version allowlist? If "1.18.32" and "1.18.35" both work, I don't think we should assume every new patch version is incompatible. We could perform a capability probe before launching the agent and fail early if the required behavior isn't supported. Runtime errors should also be handled explicitly. This would avoid maintaining a version list every time OpenCode releases a patch, while still allowing us to block known incompatible versions. |
|
Thanks for pushing on this — the maintenance concern is real, and nobody enjoys adding a version to a list every patch cycle. I considered the denylist shape specifically, and I believe it fails this issue's own acceptance criteria rather than it being a style preference:
In practice a new patch costs one verification run (the commands in #26611) plus a one-line addition. And if OpenCode ever exposes model endpoints on the legacy line, a capability gate becomes buildable and the list can retire — happy to revisit then. |
…election (#33307) OpenCode model selection accepts per-major floors (1.x >= 1.18.30, 2.x >= 2.0.14; prereleases and 3.x refused) instead of exact version allowlists, so current releases launch with a picked model again. Fixes #26611. Supersedes #26683, #31985. Co-authored-by: ggbdpq <[email protected]>
…election (stablyai#33307) OpenCode model selection accepts per-major floors (1.x >= 1.18.30, 2.x >= 2.0.14; prereleases and 3.x refused) instead of exact version allowlists, so current releases launch with a picked model again. Fixes stablyai#26611. Supersedes stablyai#26683, stablyai#31985. Co-authored-by: ggbdpq <[email protected]> (cherry picked from commit d170b5a)
ELI5
A user on OpenCode CLI 1.18.35 asked a worker to launch with
--model, the model was in the catalogue and the account was authenticated, but Orca still refused withcapability_unsupported— purely because the launch-time verification gate only trusted two hand-verified 1.18.x builds. This teaches the gate about 1.18.35 and makes the refusal say which version was detected and which versions are accepted, so the next person no longer has to read the source to find out.What Changed
Before —
VERIFIED_LEGACY_MODEL_VERSIONScontained only1.18.30and1.18.32. OpenCode 1.18.35 fell through to the refusal path with a generic message ("The execution host cannot verify this OpenCode model launch."), even though its model selection behaves like the already-verified 1.18.3x line.After — 1.18.35 joins the verified legacy set and takes the existing legacy launch route (model availability probe, launch args preserved). Every other unverified version still fails closed. The refusal for an unverified version now reads:
OpenCode CLI version <detected> cannot verify launch-time model selection. Use a verified OpenCode CLI (1.18.30, 1.18.32, 1.18.35, 2.0.16).— the list is derived from the policy module, so it cannot drift from the gate.Mechanism: one version added to the set in
opencode-model-version-policy.ts, a newVERIFIED_OPENCODE_MODEL_VERSIONSsummary exported from the same module, and the combinedversion !== '2.0.16' || agentArgsrefusal split into two checks so the version-specific message only fires for the version gate (the manual-args refusal keeps its generic message and behavior).Why
The gate is intentionally an exact-version allowlist (plugin-API compatibility alone does not verify model selection), so the fix follows the established pattern of adding hand-verified versions one at a time rather than loosening to prefix matching. A capability-based gate for the 1.18.x line would need a probe we cannot run today, so the narrow allowlist addition plus a self-describing error is the safe increment. Fail-closed behavior is preserved and now pinned by an extra refused version (
1.18.34) in tests.Linked Issue
Fixes #26611
Visual Proof
N/A — no UI change; the observable difference is the
capability_unsupportederror text, covered by automated test assertions.Testing
src/main/opencodesuitetsc --noEmit -p config/tsconfig.node.jsonoxlint/oxfmt --checkon touched filesAI Disclosure
Implementation assisted by ZCode with GLM-5.3-Flash (issue triage, test-first fix, verification).
Agent skill upstream boundary
Notes
Security: no new inputs; the refusal message only echoes the CLI-reported version string into an
OrchestrationErrormessage, same trust level as existing capability handling. Cross-platform/SSH: unchanged — the version gate applies identically on every host. Backwards compatibility: verified versions and the 2.0.16 capability route behave exactly as before; only the previously-refused 1.18.35 changes outcome, and error messages are additive detail.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — touched-package tests, node typecheck, and lint/format run locally; full matrix left to CI