Skip to content

[bug] A rejected relay socket retries forever and the console shows only an unexplained amber dot #237

Description

@serge-ivo

What happens

Each instance gets its own relay socket (packages/cli/src/commands/runner/relay.ts). On close
it reconnects with exponential backoff capped at 30s and never gives up — including when the
server is rejecting it deliberately:

ev.code === 4409  → " — run `pags up --force` to take over"

A 4409 (another runner already holds this instance+node) therefore loops forever at 30s
intervals. The other instances on the same machine stay connected, so:

  • Terminals / Settings report the machine as online.
  • That one agent reports not attached — amber, "machine online, agent not attached".
  • The console never surfaces the reason or the remedy, even though the CLI knows both: it prints
    the close code and the hint to its own stdout, which nobody is watching.

The user experience is an agent that is silently unusable with no explanation, on a machine that
looks healthy. Every runner-backed tool (repo_tree, repo_read_file, repo_git,
repo_remote) fails with "No runner is connected" while the dot says the machine is up.

Fix

The close code is already known client-side. Report it:

  • Persist the last relay rejection per (instance, node) — code + reason — and expose it on
    /v1/terminals/nodes and /v1/instances/:id/runtime/status.
  • Render it where the amber dot is: "another runner holds this agent on RLs-MacBook-Air.local —
    run pags up --force", not just "agent not attached".
  • Consider surfacing repeated 4409s in pags up's own summary line rather than only as a scrolled
    log line.

Related

Same amber symptom, different cause: #236 (the runner's instance list is frozen at startup). The
two are indistinguishable in the UI today, which is the actual problem — there is no way for a
user to tell which one they have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions