GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(opencode): recheck MCP reachability when host addresses change by shuv1337 · Pull Request #465 · shuv1337/s2code

Conversation

@shuv1337

@shuv1337 shuv1337 commented Nov 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Owner

Problem

After a reboot, OpenCode 2 threads could start normally but have no s2 MCP tools until the s2 server was restarted. The provider instance took one snapshot of the host addresses before Tailscale had assigned its address and kept the negative reachability result for the life of the instance.

Fix

When preparing a turn with an MCP session, re-read the host addresses while the configured OpenCode connection is classified as unreachable. Cache a positive answer only for that connection, so an already-open thread can recover on its next turn without reconnecting and healthy connections don't keep looking up addresses. Owned servers keep their existing local behavior.

The first skipped registration on each connection logs Skipping MCP registration: OpenCode cannot reach the local MCP endpoint. with serverUrl set to the URL origin only (no credentials, path, query, or fragment).

OpenCode 1.x has no address snapshot to go stale: it excludes all configured external servers from s2 MCP registration. That policy is unchanged. This is a shared server-side fix for web, desktop, and mobile; no client or wire contract changes.

Verification

  • Extended the existing OpenCode2Server external-connection case with an injected address source. On main (422ef23c) the test fails because mcpReachable is a frozen boolean there (TypeError: yield* … is not iterable); with the address read planted back at connect time in the new code, it fails with expected false to be true. With the fix, the same connection recovers, and forgetting it clears the cached answer. No sleeps or real interface changes.

  • nice -n 19 node scripts/check-changed.ts origin/main --concurrency 2 passed (12 tests; typecheck, format, lint, Knip, GraphQL). The 13 existing OpenCode 2 adapter tests matching MCP also passed.

  • Local fixture transcript (in-process fake HTTP service, no live provider turns):

    WARN Skipping MCP registration: OpenCode cannot reach the local MCP endpoint. { serverUrl: 'http://100.64.0.1:49374' }
    Address absent: false
    Address still absent: false
    Address added, same connection: true
    

Upstream candidate: Not standalone. The file exists upstream, but the cached reachability gate comes from the fork's local-configured-server MCP support. This is worth carrying with that support if it goes upstream. No upstream PR was opened.

Model / harness: GPT-6.2 Sol (openai/gpt-6.2-sol) in OpenCode (shuvcode) via T3 Code.

Review notes (lead)

Opus high: APPROVE. Known trade-off, accepted: for a configured server on another machine, each turn with an MCP session re-reads interfaces and resolves the hostname (HostProcess.Addresses, no timeout), where it used to happen once per instance. A broken resolver could slow turn start; not addressed here as unlikely. No info log on unreachable -> reachable (optional nit, skipped).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@shuv1337
fix(opencode): recheck MCP reachability when host addresses change
96b3ee8
@shuv1337
shuv1337 merged commit d3e996a into main Nov 18, 2026
6 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@shuv1337
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.