Skip to content

OpenCode: Cancelling a submit_plan call leaves the review server running, so the next submit_plan fails #1046

Closed

Description

@fabians-px

When using plannotator with OpenCode, calling submit_plan opens the plan review UI. If the user cancels that tool call with ESC+ESC, the review server keeps running in the background. The next time the agent tries submit_plan, it fails because the port is still occupied.

How to reproduce

  1. Set up plannotator with OpenCode, using a fixed port (e.g., PLANNOTATOR_PORT=4117).
  2. Ask the agent to submit a plan.
  3. When the review UI opens, press ESC+ESC to cancel the tool call.
  4. Ask the agent to submit a plan again.

What the user sees

After step 4, the tool fails with an error saying the port is already in use:

73052 |   } else {
73053 |     decisionPromise = new Promise(() => {});
73054 |   }
73055 |   let server2 = null;
73056 |   for (let attempt = 1;attempt <= MAX_RETRIES; attempt++) {
73057 |       server2 = Bun.serve({
                                 ^
error: Failed to start server. Is port 4117 in use?
 syscall: "listen",
   errno: 0,
    code: "EADDRINUSE"

      at startPlannotatorServer (/$bunfs/root/plannotator:73057:26)

The agent cannot submit another plan until the stale server is killed manually.

Expected behavior

Cancelling the tool call should stop the review server and free the port, so the next submit_plan succeeds.

Actual behavior

The server from the cancelled review stays alive, blocking all future plan submissions on that port.

Environment

  • OpenCode with the plannotator plugin
  • Fixed port configured via PLANNOTATOR_PORT
  • plannotator 0.23.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions