Skip to content

fix(opencode): keep workspace commands retryable after probe timeouts - #14933

Open
Marve10s wants to merge 1 commit into
pingdotgg:mainfrom
Marve10s:fix/opencode-command-timeout-v2
Open

Marve10s wants to merge 1 commit into
pingdotgg:mainfrom
Marve10s:fix/opencode-command-timeout-v2

Conversation

@Marve10s

@Marve10s Marve10s commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Problem

OpenCode 1.x workspace commands disappear when command.list takes more than ten seconds. The timeout becomes a successful empty command list, so the provider registry caches a snapshot containing only the built-in /compact command and skips subsequent ordinary refreshes for that workspace.

The faulty timeout order is still present on current main after the orchestrator V2 rewrite.

Change

Apply the SDK-error fallback before the timeout. A slow probe now fails, allowing the registry to preserve cached providers and retry the workspace scan. Ordinary SDK errors retain their existing fallback behavior. The separate OpenCode 2.x path is unchanged.

The driver-level reproduction uses the real OpenCode SDK, recorded 1.18.32 health responses, and a controlled transport that holds the command request open. On main, the probe succeeds after ten seconds with only /compact. With this change, it fails at ten seconds and a subsequent successful response restores /hello alongside /compact. An SDK error still preserves workspace skills and /compact. A live MCP cold start was not exercised.

Scope and approval

Fixes #13071. Replaces #13264 following the maintainer's request to rebuild and verify the fix against current main.

This is a focused timeout-handling fix in the existing OpenCode 1.x workspace probe, with regression coverage in the current driver test file.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 2, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 2, 2026 — with ChatGPT Codex Connector
@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 9582490

Macroscope's review found this PR approvable — This is a narrowly scoped OpenCode 1.x timeout-handling fix that preserves normal command loading and SDK-error fallback while allowing timed-out probes to be retried. Regression tests cover both the timeout/retry path and the existing fallback behavior.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown

Review in Change Stack →

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

🧰 Additional context used
📚 Code guidelines (1)
docs/internals/effect-services.md — configured

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d9ca51f9-1873-4bc4-8744-525367c9d795
📥 Commits

Reviewing files that changed from the base of the PR and between 7ff2eab and 9582490.

📒 Files selected for processing (2)
  • apps/server/src/provider/Drivers/OpenCodeDriver.test.ts
  • apps/server/src/provider/Drivers/OpenCodeDriver.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.


📝 Walkthrough

Walkthrough

OpenCode command loading now applies a 10-second timeout before falling back to an empty command list. Tests cover a timed-out probe followed by a successful retry, and an SDK error response.

Changes

OpenCode command probe

Layer / File(s) Summary
Command probe timeout and fallback
apps/server/src/provider/Drivers/OpenCodeDriver.ts, apps/server/src/provider/Drivers/OpenCodeDriver.test.ts
The workspace inventory loader applies the timeout before its fallback. Tests check that a timed-out probe can be retried to load commands and skills, and that an SDK error leaves the built-in command and skills available without server-provided commands.

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 95824

This change keeps workspace commands retryable after a slow probe timeout, and SDK errors keep their existing fallback behavior. No merge-blocking risk was found.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 95824

The fix preserves existing cached commands when discovery times out and allows later attempts to recover. No new endpoint, permission, credential use, or material security risk was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The supported exposure change concerns workspace-command availability and cached inventory recovery through the existing OpenCode server connection. The mobile upload and GitHub script paths are unchanged supporting name matches, not demonstrated downstream consumers or additional affected security boundaries.

Trust Boundaries and Controls

  • observed — The changed probe uses the existing server URL, workspace directory, password configuration, and command.list operation. It changes how a slow server response is reported; it does not add credential authority, command execution, or a new trust transition.

Resilience and Maintainability Implications

  • inferred — Cancellation wiring supports cleanup rather than accumulation of abandoned command requests: the Effect signal reaches command.list and is included in the SDK Request passed to fetch. Existing test sources assert abortion of command inventory requests on interruption. The new driver test itself ignores the signal, so it demonstrates timeout-result and retry semantics rather than physical transport termination.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: keeping OpenCode workspace commands retryable after probe timeouts.
Description check ✅ Passed The description includes the problem, change, scope and approval details, and focused verification results. The verification information appears in the Change section instead of a separate Verificatio…
Linked Issues check ✅ Passed Issue #13071 requires custom OpenCode commands to appear in command suggestions. The PR changes OpenCode 1.x workspace inventory loading so the 10-second timeout is applied before the SDK-error fallba…
Out of Scope Changes check ✅ Passed The changed production code and tests support issue #13071. The production change is limited to OpenCode 1.x probe timeout handling. The tests verify retry and fallback behavior. The PR summary report…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: opencode custom commands are not present in the list of availabe commads

2 participants