Skip to content

OpenCode AI tab: spawns new opencode serve instead of reusing existing server (port conflict) #513

@alexey-igrychev

Description

@alexey-igrychev

Description

When using the AI tab in the code review UI with the OpenCode provider, Plannotator spawns a new opencode serve process instead of connecting to the already running OpenCode server.

Steps to reproduce

  1. Start OpenCode normally (it listens on port 4096)
  2. Open Plannotator code review (plannotator review or /plannotator-review)
  3. Select OpenCode as the AI provider in the AI tab
  4. Send a message

Expected behavior

Plannotator should connect to the already running OpenCode server on port 4096 (or whatever port it's using).

Actual behavior

Plannotator spawns a new opencode serve --hostname=127.0.0.1 --port=4096, which crashes because the port is already in use:

Server exited with code 1 Server output: Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.
Error: Unexpected error, check log file at /Users/.../.local/share/opencode/log/2026-04-07T183619.log for more details
Failed to start server on port 4096

The log file contains only 3 lines — the process crashes during config loading before it can detect the port conflict gracefully.

If OpenCode is not running, Plannotator successfully spawns a new server, but this leads to issue #514.

Environment

  • Plannotator: v0.17.1 (CLI), @plannotator/opencode@latest (plugin)
  • OpenCode: v1.3.15
  • OS: macOS (Apple Silicon)
  • Bun: v1.3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions