Skip to content

feat(tui): attach to configured server by default#30977

Open
jensenojs wants to merge 3 commits into
anomalyco:devfrom
jensenojs:feat/server-attach-tui
Open

feat(tui): attach to configured server by default#30977
jensenojs wants to merge 3 commits into
anomalyco:devfrom
jensenojs:feat/server-attach-tui

Conversation

@jensenojs
Copy link
Copy Markdown
Contributor

@jensenojs jensenojs commented Jun 5, 2026

Issue for this PR

Closes #17322, About 40% of this diff is focused test coverage.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This adds a server.attach config value for the default TUI path.

When configured, opencode checks the target server's /global/health endpoint and attaches to it instead of starting the embedded server. When unset, existing behavior is unchanged.

  {
    "server": {
      "attach": "http://127.0.0.1:4096"
    }
  }

For local attach targets, the TUI can start opencode serve when no server is already listening. That auto-started server shuts down after the last client disconnects, avoiding stale local server processes while preserving the current embedded default for users who do not opt in.

How did you verify your code works?

Added focused tests covering the config-driven attach path, preserved embedded fallback behavior, local auto-start failures/success, and last-client shutdown for auto-started serve processes.

Screenshots / recordings

This enables shared-server workflows where multiple clients connect to the same opencode session.

bidirectional sync demo

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@jensenojs jensenojs force-pushed the feat/server-attach-tui branch from 964b7a1 to 3dfefeb Compare June 6, 2026 02:46
@jensenojs jensenojs requested a review from adamdotdevin as a code owner June 6, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Config option to auto-attach to a remote server

1 participant