fix(opencode): leave configured server updates to their owner#23859

open1
main
GitHub fork: fix/opencode-configured-server-updates
opened1d agobyFfearandesire
View on GitHubTwo-way sync enabledPR last imported 1d ago

Problem

Fixes #22869. With OpenCode's Server URL configured, T3 checks the running server's version but offers an update for the local Binary path. These can be different installations. In the reported Windows/Nightly case, the npm CLI was already 2.1.3 while a desktop-bundled server still ran 2.0.32; repeating the CLI update could not update that server.

Change

Configured servers now use the existing manual-only maintenance capability. T3 still checks the running server against the appropriate 1.x or 2.x package, keeps the outdated advisory visible on refresh, and explains how to update/restart the installation that hosts the server. The advisory clears when the server actually reports the new version.

An empty or whitespace-only Server URL retains T3-managed local CLI updates. No server is restarted automatically, and no extra CLI probe or shared contract/client changes are needed.

Tradeoffs: configured loopback servers require manual updates even when they happen to use the same local CLI installation. If both managed and manual OpenCode instances are behind latest, the existing shared sidebar update shortcut becomes unavailable; the managed instance's own Settings Update button still works.

Relationship to #22839

This is an alternative to the open #22839, not an independent bug. Credit to that PR for identifying the installed-CLI/running-server distinction. Its approach verifies the local CLI update, but a current CLI can hide an outdated server, and its successful restart message is discarded by the web success presentation. Those gaps were confirmed against its pinned head 4538f006: 33 existing tests passed, two version-mismatch characterization cases passed, and an added notification regression failed.

This change fixes the update target itself. A loopback URL also does not prove local installation ownership: it can point to a desktop bundle or a forwarded remote server. It therefore does not treat the local CLI version as evidence that the configured server is current. No code from #22839 is included.

Scope and approval

Submitted under the focused obvious-bug exception: the offered action updates an installation that T3 cannot establish as the configured provider. The fix stays in OpenCode's existing driver/maintenance boundary, reuses manual-update support, and preserves automatic updates where T3 starts the local server. This is one underlying problem, with focused tests and the corresponding user-guide clarification. No maintainer approval is claimed.

Verification

  • Added driver regressions for both loopback and remote Server URLs. On base ef924413, both failed because maintenance returned a local opencode upgrade action. After the fix, both pass.
  • Tests check manual update/targeted-install capabilities, no local CLI probe, a persistent server-version advisory over repeated refreshes, and clearing that advisory after the server changes from 2.0.32 to 2.1.3.
  • A positive control confirms an empty/whitespace Server URL still offers the native CLI upgrade; existing npm 1.x/2.x maintenance tests remain green.
  • vp test run packages/provider-opencode/src/server/driver.test.ts: 7 passed.
  • vp run check:changed: passed format, lint, knip, typecheck of all five affected packages, and the focused tests.
  • Claude Fable 5.1 completed an independent adversarial review of ownership, update entry points, refresh behavior, contribution scope, and overlap with #22839. Its missing-latest-version finding was reproduced with a failing assertion, fixed, and included in the final checks.

These are isolated driver/service tests with a temporary local installation and replayed server responses. The original Windows incident and supported service-restart workaround are documented in the sanitized issue comment. Checks ran in Linux/WSL; Windows test execution, the patched desktop UI, and a live server upgrade were not exercised; the installed application and active state were left untouched. No raw logs or identifying local paths are attached.

Implemented and tested by GPT-6 Astra through Codex in T3 Code; adversarial review by Claude Fable 5.1 through the Claude Agent harness.

Checks

All checks passed

Added 1 commit

  • fix(opencode): leave configured server updates to their ownerbf64a3a
Synced from GitHub

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

ReviewStatusCommitReview trigger
📝 Code Review✅ Completed 2026-10-22T21:33:16.834506Zbf64a3aPR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 2c8bdf6177159d8fcd12a897d7c9311f6eb93237 and bf64a3ae354c3513ceeb384d5a78f6e88ed9043a.

📒 Files selected for processing: 3
  • docs/user/providers-opencode.md
  • packages/provider-opencode/src/server/driver.test.ts
  • packages/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; 9 remain after this review.

📝 Walkthrough

OpenCode maintenance now treats a non-empty configured server URL as externally managed. It does not offer a local package update for that server and directs users to update it through its starting app or tool. A blank server URL retains local update behavior.

Changes: OpenCode server updates

Layer / File(s)Summary
External server maintenance behavior
packages/provider-opencode/src/server/driver.ts, packages/provider-opencode/src/server/driver.test.ts, docs/user/providers-opencode.md
The driver skips local update resolution for configured servers and changes the advisory for external servers that are behind the latest version. Tests cover HTTP and HTTPS server configurations, confirm that the local CLI is not probed, and verify that a blank server URL retains the native upgrade command. The documentation clarifies which installed package the update button updates and how to update a configured server.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to bf64a

Configured-server update guidance and blank-URL local updates show no identified merge-blocking risk.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Linked Issues checkWarning[#22869] The diff in packages/provider-opencode/src/server/driver.ts sets isExternalServer when serverUrl.trim() is non-empty. For such servers, maintenance resolves with null, so no local opencode up…Either (a) implement the issue's expected behavior for configured servers: probe the installed CLI version separately, and when the CLI is current but the running server is behind latest, show a message that states the CLI is updated and th…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title follows conventional commit format and names the main change: configured OpenCode servers are now left to their owner for updates instead of offering a local CLI update. It matches the raw s…
Description checkPassedThe description follows the template well. It has a Problem section with the bug, the Windows/Nightly reproduction context, and the mismatch between the CLI and the running server. The Change section …
Out of Scope Changes checkPassedThe reviewed changes stay within the scope of #22869. driver.ts changes gate maintenance resolution on a non-empty Server URL and adjust the outdated-server advisory text for configured servers. drive…
Full details: Title check

Explanation

The title follows conventional commit format and names the main change: configured OpenCode servers are now left to their owner for updates instead of offering a local CLI update. It matches the raw summary (driver.ts resolves no update for non-empty serverUrl) and the PR objectives (manual-only maintenance for configured servers). It is specific and concise, with no file lists or vague terms.

Full details: Description check

Explanation

The description follows the template well. It has a Problem section with the bug, the Windows/Nightly reproduction context, and the mismatch between the CLI and the running server. The Change section explains the manual-only maintenance behavior for configured servers, the preserved local CLI updates for an empty Server URL, and the tradeoffs. The Scope and approval section explains the focused obvious-bug exception and states that no maintainer approval is claimed. The Verification section lists the specific tests, the base-commit failure and post-fix pass, the commands run, and what was not tested on Windows. The author placed the model attribution at the end as the template asks. The description is long and includes detail about #22839 that goes beyond the template, but all required sections are substantively filled.

Full details: Out of Scope Changes check

Explanation

The reviewed changes stay within the scope of #22869. driver.ts changes gate maintenance resolution on a non-empty Server URL and adjust the outdated-server advisory text for configured servers. driver.test.ts adds regressions for loopback and remote configured servers, a blank-URL positive control for native CLI upgrade, and checks for no local CLI probe. docs/user/providers-opencode.md clarifies that configured servers are updated through their host application or tool. Each change supports the manual-update behavior for configured servers or keeps the existing local-managed behavior. No unrelated code path was identified in the reviewed summary and the focused driver diff. The behavioral tradeoff for the shared sidebar update shortcut is a consequence of the design and not an unrelated change.

Full details: Linked Issues check

Explanation

[#22869] The diff in packages/provider-opencode/src/server/driver.ts sets isExternalServer when serverUrl.trim() is non-empty. For such servers, maintenance resolves with null, so no local opencode upgrade or install command is offered. This removes the misleading Update now action for configured servers. The advisory text now tells users to update the server with the app or tool that started it, restart it when sessions can be interrupted, and refresh provider status. The advisory still uses the running-server version probe, so it clears when the server reports the new version. These parts meet the issue's requirements to avoid automatic termination, to recheck the runtime version, and not to assume a local CLI is the remote server's installation. Two issue expectations are not met. (1) The issue asks to verify the installed CLI version separately from the running server version. The PR adds no CLI verification for configured servers, and the PR description says this is intentional. (2) The issue asks to say 'CLI updated; restart the configured server to apply' when the CLI is current and the server is old. The PR does not emit this message. The change follows a different design, and the PR states this. The docs and driver tests cover the chosen design. No test covers the CLI-updated restart message because the message is not implemented.

Resolution

Either (a) implement the issue's expected behavior for configured servers: probe the installed CLI version separately, and when the CLI is current but the running server is behind latest, show a message that states the CLI is updated and the configured server must be restarted to apply it, with a regression test for that message; or (b) obtain maintainer confirmation in #22869 that the manual-only approach replaces the CLI-verification and restart-message expectations, and record that decision in the linked issue or PR.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Cchatgpt-codex-connector[bot]reviewed · 1 inline thread1d ago
Synced from GitHub

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf64a3ae35

ℹ️ 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".

……@@ -232,10 +233,14 @@ export const OpenCodeDriver: ProviderDriver<
236+ : isExternalServer
237+ ? // A configured URL does not establish ownership of its server installation,
238+ // even on loopback: it can be a desktop bundle or a forwarded remote server.
239+ openCodeUpdateFor(generation.value).resolve(null)

P2 Badge Surface configured-server guidance in mobile settings

When a non-loopback serverUrl points at an OpenCode server on another machine, returning manual-only capabilities here makes canUpdate false, but the mobile settings flow inspected in apps/mobile/src/features/settings/SettingsEnvironmentDetailRouteScreen.tsx:363-367 ignores the advisory's new message and tells the user to “Update this provider on the environment's machine.” That is the wrong installation for this supported remote-server case, so the change still directs mobile users to the target it is meant to avoid; render versionAdvisory.message (or equivalent configured-server guidance) there.

AGENTS.md reference: AGENTS.md:L70-L70

Useful? React with 👍 / 👎.