fix(opencode): keep workspace commands retryable after probe timeouts #19636
main fromrefs/pull/19636/head·merged by juliusmarminge View on GitHubA healthy OpenCode 1.x provider cached a completed empty workspace-command list after the ten-second probe timeout. Report that timeout as pending so existing registry behavior preserves cached commands and retries. Keep discovered skills; successful probes report complete, while SDK errors retain main's provider-health fallback. OpenCode 2.x is unchanged.
Maintainer takeover of #19636, credit to @Marve10s. Merged main and rebuilt the timeout handling around its newer error semantics.
Verification:
- Two added driver tests retained, with explicit timeout/success/SDK-error state assertions. Main: 7 pass, 1 fails. Head: all 8 pass.
- Three existing registry pending/retry tests pass; package typecheck and scoped lint/format pass.
- Independent Claude Opus 5.5 and GPT-6 Sol full-PR reviews: no blockers.
- Headless Linux network proof used the real OpenCode SDK against a local Node HTTP server. The first request is held open, the test clock reaches the timeout, and a second request returns commands. Main fails the pending assertion; head preserves the skill, reports pending, then loads compact+hello on retry. Temporary proof instrumentation was removed; no screenshots apply to this server-state change.
Before HTTP proof · After HTTP proof
A real OpenCode 1.x server with a slow MCP cold start remains unverified. macOS, Windows, iOS, Android and Electron desktop were not verified. Existing contributor-policy approval remains a maintainer decision; this PR is unmerged.
Implemented with Codex GPT-6.1 Sol in T3 Code; tests by GPT-6 Astra.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
💡 Codex Review#
Here are some automated review suggestions for this pull request.
Reviewed commit:
f6db8f9600ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
packages/provider-opencode/src/server/driver.ts line 413OutdatedResolvedby Marve10s(GitHub profile, opens in a new tab)@@ -409,5 +409,5 @@409409 {410410 skills: openCodeRuntime.loadOpenCodeSkills(client),411411 commands: OpenCodeRuntime.loadOpenCodeCommands(client).pipe(412- Effect.timeout("10 seconds"),413412 Effect.orElseSucceed(() => []),413+ Effect.timeout("10 seconds"),Preserve successful skills when command discovery times out
When
command.listexceeds 10 seconds butloadOpenCodeSkillshas already succeeded, this downstream timeout rejects the entireEffect.all, so a target cwd with project-only skills and no prior workspace cache falls back to the machine snapshot and never receives those skills (indefinitely if commands remain slow).upsertProviderWorkspaceSnapshotalready preserves cached commands whenslashCommandsPendingis true, so this timeout should produce that partial workspace state rather than discard the successful skill result while keeping command discovery retryable.Useful? React with 👍 / 👎.
Warning
Review limit reached#
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 6 minutes.
View limit details
-
Limit details: You’ve used all 10 included reviews currently available.
Review configuration:
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
379e54ed-7f9c-4f16-9b19-c98a194a5d40
📥 Commits
-
Reviewing files that changed from the base of the PR and between e892792be793fdfb4e7aa7f4de68b9f7e475ffde and 924e574ba5548e6635f7165756d404921c381475.
📒 Files selected for processing: 2
-
packages/provider-opencode/src/server/driver.test.tspackages/provider-opencode/src/server/driver.ts
-
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
eb940a9e-7693-441e-8610-4ea5d11f93c5
📥 Commits
-
Reviewing files that changed from the base of the PR and between f6db8f960070a34900b67cc4e373c4914f9f6ade and e892792be793fdfb4e7aa7f4de68b9f7e475ffde.
📒 Files selected for processing: 2
-
packages/provider-opencode/src/server/driver.test.tspackages/provider-opencode/src/server/driver.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.
-
📝 Walkthrough
-
The OpenCode v1 workspace inventory now represents command-probe timeouts as pending. The workspace snapshot retains available skills and built-in commands. Tests cover a later successful probe and an SDK error response.
Changes: OpenCode workspace commands
Layer / File(s) Summary Timed command loading
packages/provider-opencode/src/server/driver.ts,packages/provider-opencode/src/server/driver.test.tsThe v1 inventory applies a timeout to command loading and represents a timeout as pending in the workspace snapshot. Tests check that a later successful probe loads built-in and server-provided commands, and that an SDK error leaves the skill and built-in command available. Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
e8927-
The timeout change is ready to merge after normal checks; no concrete unresolved issue is identified.
Security architecture risk: 🔵 Low · up to
e8927-
The change keeps workspace discovery retryable without adding authority or changing workspace identity. Existing cache protections preserve previously discovered commands while a probe is pending. No security regression was established, although live slow-server behavior was not validated in this review.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The changed state transition is bounded by the existing provider instance and cwd cache identity. A slow command response affects inventory completeness and retry behavior for that workspace; the inspected change does not add cross-workspace access or another privileged operation.
Trust Boundaries and Controls
- observed — Workspace inventory still uses the requested cwd and the existing configured OpenCode server URL and password. Runtime selection and the separate v2 inventory path are unchanged. The timeout change changes how returned inventory completeness is represented, not how the server or credentials are selected.
Resilience and Maintainability Implications
- observed — Existing registry controls contain partial and concurrent refreshes: duplicate ordinary scans are suppressed, results are committed conditionally against the captured instance and workspace state, and in-flight claims are removed on completion or interruption. Outer scan failures do not commit a partial snapshot. These controls remain applicable when the driver begins emitting pending results.
-
Pre-merge checks:
4-
Check name Status Explanation Linked Issues check PASS. The change addresses [ #13071] by preventing a timed-out OpenCode 1.x command probe from returning a completed empty list. The probe now preserves workspace skills and marks slash commands pendin…Out of Scope Changes check PASS. The changes are limited to OpenCode 1.x inventory timeout handling and focused regression tests in packages/provider-opencode/src/server/driver.test.ts. The OpenCode 2.x path and unrelated pro…Title check The title clearly and concisely describes the main change: keeping OpenCode workspace commands retryable after probe timeouts. Description check The description explains the problem, implementation, scope, verification results, limitations, and maintainer context. It does not use the template headings exactly or provide an explicit approval co… Full details: Linked Issues check
-
Explanation
PASS. The change addresses [
#13071] by preventing a timed-out OpenCode 1.x command probe from returning a completed empty list. The probe now preserves workspace skills and marks slash commands pending. The registry can retain cached commands and retry. The regression test verifies recovery of/hellowith/compactafter a later successful probe.
Full details: Out of Scope Changes check
-
Explanation
PASS. The changes are limited to OpenCode 1.x inventory timeout handling and focused regression tests in
packages/provider-opencode/src/server/driver.test.ts. The OpenCode 2.x path and unrelated provider behavior remain unchanged.
Full details: Description check
-
Explanation
The description explains the problem, implementation, scope, verification results, limitations, and maintainer context. It does not use the template headings exactly or provide an explicit approval comment, but it contains the required information overall.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge assignedjuliusmarminge
Taking over this one. I'll adapt the timeout handling to current main, keep focused regression coverage, and push the reviewed result here.
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XS
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
juliusmarminge merged this78d095a
juliusmarminge closed this
Sign in to join this conversation.
Codex Review Summary#
This comment shows the latest Codex review activity on this pull request.
e892792ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.