Skip to content

fix(tmux): handle serverUrl throw getter from upstream opencode refactor#2419

Open
guazi04 wants to merge 1 commit intocode-yeongyu:devfrom
guazi04:fix/serverurl-throw-getter
Open

fix(tmux): handle serverUrl throw getter from upstream opencode refactor#2419
guazi04 wants to merge 1 commit intocode-yeongyu:devfrom
guazi04:fix/serverurl-throw-getter

Conversation

@guazi04
Copy link

@guazi04 guazi04 commented Mar 10, 2026

Summary

OpenCode upstream commit 89d6f60d (refactor(server): extract createApp function) changed PluginInput.serverUrl from Server.url() to a throw getter:

// opencode/src/plugin/index.ts
get serverUrl(): URL {
  throw new Error("Server URL is no longer supported in plugins")
}

This causes the entire oh-my-opencode plugin to crash during initialization because TmuxSessionManager constructor accesses ctx.serverUrl:

this.serverUrl = ctx.serverUrl?.toString() ?? `http://localhost:${defaultPort}`

Optional chaining (?.) does not prevent the throw — the getter executes on property access before the nullish check.

Impact: All agents, hooks, and tools fail to register. The plugin appears to load but silently crashes.

Fix

Wrap the serverUrl access in a try-catch, falling back to http://localhost:{port}:

try {
  this.serverUrl = ctx.serverUrl?.toString() ?? `http://localhost:${defaultPort}`
} catch {
  this.serverUrl = `http://localhost:${defaultPort}`
}

Notes

  • The OpenCode change (89d6f60d) is not yet released (current npm is v1.2.17), but affects anyone running from source.
  • This is a defensive fix — it preserves existing behavior when serverUrl is available, and gracefully degrades when it's not.

Summary by cubic

Prevent tmux subagent crash after upstream opencode made PluginInput.serverUrl a throwing getter. Guard ctx.serverUrl with try/catch and default to http://localhost:${OPENCODE_PORT || 4096} so agents, hooks, and tools register.

Written for commit 309a3e4. Summary will update on new commits.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Defensive try-catch fix for an upstream breaking change; safely handles a throwing getter with a fallback and restores functionality without side effects.

@guazi04 guazi04 force-pushed the fix/serverurl-throw-getter branch from b860880 to 309a3e4 Compare March 10, 2026 07:45
@guazi04
Copy link
Author

guazi04 commented Mar 10, 2026

recheck

@acamq
Copy link
Collaborator

acamq commented Mar 10, 2026

Oh dear

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants