Skip to content

Comments

fix(opencode): Avoid default port 4096 in ACP mode#14498

Open
rschaeuble wants to merge 1 commit intoanomalyco:devfrom
rschaeuble:dev
Open

fix(opencode): Avoid default port 4096 in ACP mode#14498
rschaeuble wants to merge 1 commit intoanomalyco:devfrom
rschaeuble:dev

Conversation

@rschaeuble
Copy link

@rschaeuble rschaeuble commented Feb 20, 2026

Issue for this PR

opencode web relies on a stable origin (hostname:port) for browser localStorage, so it is expected to run on localhost:4096 by default.

opencode acp currently shares server startup behavior that prefers port 4096 when no port is explicitly configured. When ACP starts first (for example from IntelliJ), it can claim 4096, causing opencode web to fall back to a random port and use a different localStorage origin.

This creates a misconfigured web experience because preferences are split across origins.

Closes #14500

Type of change

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

What does this PR do?

For call sites except ACP nothing changes. Unless explicitely configured, port 4096 is preferred.
ACP passes a new flag that tells Server.listen to not default to port 4096.

How did you verify your code works?

I ran bun run --cwd packages/opencode --conditions=browser src/index.ts acp. Before the change, it used port 4096 (when it was available). After the change it now uses a random port.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

If you do not follow this template your PR will be automatically rejected.

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Feb 20, 2026
@github-actions
Copy link
Contributor

Hey! Your PR title Avoid default port 4096 in ACP mode doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@rschaeuble rschaeuble changed the title Avoid default port 4096 in ACP mode fix(opencode): Avoid default port 4096 in ACP mode Feb 20, 2026
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Feb 20, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@rschaeuble
Copy link
Author

e2e test failure seems to be unrelated to my changes. Probably caused by upstream issues ("bad gateway").

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.

ACP defaults to port 4096, conflicting with web

1 participant