Skip to content

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

Closed
jensenojs wants to merge 2 commits into
anomalyco:devfrom
jensenojs:feat/server-attach-tui
Closed

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

Conversation

@jensenojs

@jensenojs jensenojs commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

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

@mikhail-shevtsov-wiregate

Copy link
Copy Markdown

Would be cool if this merged. Tired to typing attach url each time

@jensenojs
jensenojs force-pushed the feat/server-attach-tui branch 2 times, most recently from c844442 to 155fc99 Compare July 1, 2026 08:04
@jensenojs
jensenojs force-pushed the feat/server-attach-tui branch from 155fc99 to 4d7fe3f Compare July 2, 2026 06:49
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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

2 participants