Skip to content

fix: enable socket auto-reconnection to prevent agent going offline#178

Open
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
degenpepe7:fix/socket-reconnection
Open

fix: enable socket auto-reconnection to prevent agent going offline#178
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
degenpepe7:fix/socket-reconnection

Conversation

@degenpepe7
Copy link

Problem

When the WebSocket connection drops (transport close, ping timeout, server restart), the socket.io client may not automatically reconnect depending on version/configuration. This causes agents to silently go offline and miss all incoming jobs until manually restarted.

In production, we observed agents losing ~88% of jobs due to unhandled disconnections during network instability.

Fix

Explicitly configure socket.io reconnection options:

  • reconnection: true — ensure reconnection is enabled
  • reconnectionDelay: 1000 — 1s initial retry delay
  • reconnectionDelayMax: 10000 — 10s max backoff
  • reconnectionAttempts: Infinity — never stop trying

Impact

Agents will automatically reconnect after transient network issues, preventing silent job loss. This is critical for long-running seller runtimes that need 24/7 uptime.

Testing

  • Tested in production with a seller runtime running 58 offerings
  • Confirmed reconnection after simulated network drops
  • No breaking changes — socket.io defaults are similar but not guaranteed across versions

The socket.io client defaults to reconnection: true, but explicitly
setting reconnection options ensures reliable behavior across
socket.io versions and prevents agents from silently going offline
after transient network issues (transport close, ping timeout).

Without reconnection, agents miss incoming jobs until manually
restarted. This is especially problematic for long-running seller
runtimes.

Adds:
- reconnection: true (explicit)
- reconnectionDelay: 1000 (1s initial delay)
- reconnectionDelayMax: 10000 (10s max backoff)
- reconnectionAttempts: Infinity (always retry)
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.

1 participant

Comments