Any engine fix: The machine drops and reconnects over and over

The machine keeps reconnecting

A long-lived WebSocket does not stay up forever, and the redial that follows is usually nothing at all. The interesting case is a machine that cannot stay up for a minute.

Another agent is already connected to Termdeck with this machine
Printed by Termdeck.

Diagnosis

What it actually is

The edge recycles long-lived sockets

A proxy in front of the service closes tunneled WebSockets periodically and says so in the close code. The agent redials in about a second and nothing is lost. A handful of these a day is the system working rather than failing.

Two agents are holding one token

A second agent that keeps retrying produces a regular rhythm rather than the random spacing of an edge recycle: connect, refusal, wait, repeat, on a timer. The tell is how even the interval is.

One oversized frame tears the tunnel down

A reply larger than the frame ceiling errors on the receiving side and takes the connection with it. What made this so hard to spot is that the next dial-in re-read the same file and hit the same wall: one machine in production flapped for about seven hours on a single fat transcript before the read path was chunked to fit.

Check

Confirm it before you fix it

Run thisWhat a good answer looks like
grep -c "Connection problem" ~/.termdeck/logs/agent.logA count rather than a read. Dozens in an hour is a flap; a handful in a day is the edge doing its job.
grep -i "already connected" ~/.termdeck/logs/agent.logFinds a token conflict directly. That line names both the cause and the fix.

Every command here has been run on a real machine. Termdeck answers the same questions for every machine you have connected, without opening a terminal on any of them.

Fix

Cheapest thing first

1. Leave a slow, occasional reconnect alone

It is self-healing and costs nothing. A turn in flight survives a gap of a few minutes on its own.

2. Find the second agent

One machine, one token. The second is usually an install command pasted on another computer, or a copy started by hand on this one.

3. Update an old agent

The read path behind the frame problem is capped on the service side, so old agents are already healed. An agent that is old for other reasons is still worth updating.

Not this

What will not help

Restarting the agent in a loop

Every restart is another dial. Where two agents are fighting over one token, restarting either of them is how the fight continues.

FAQ

The machine drops and reconnects over and over, answered

Is a reconnect every few hours a problem?

No. Proxies recycle long-lived connections deliberately, and the agent is built to redial in about a second.

Do I lose a turn when this happens?

Not to a short gap. A running turn parks on the machine and rebinds when the link returns.

Can two computers share one machine token?

No. Add the second computer in the dashboard and install it with the token that account hands you.