Skip to content

fix(server): reject empty patrol batch; survive broadcast lag#157

Open
tieguy wants to merge 1 commit into
mainfrom
fix-server-empty-batch-and-lag
Open

fix(server): reject empty patrol batch; survive broadcast lag#157
tieguy wants to merge 1 commit into
mainfrom
fix-server-empty-batch-and-lag

Conversation

@tieguy

@tieguy tieguy commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Two edges on the patrol/WS path:

  • A present-but-empty batch_rev_ids panicked on rev_ids[0]. Now validated up front and rejected with invalid_payload.
  • A Lagged broadcast error killed the WS forwarding task instead of skipping the missed events. Now logs a warning and continues.

🤖 Generated with Claude Code

@tieguy
tieguy requested a review from schiste as a code owner July 14, 2026 16:53
Two independent robustness fixes on the localhost server:

- A patrol request with an explicit empty batch_rev_ids ([]) reached
  rev_ids[0] on an empty Vec and panicked the handler (the None fallback
  only fires on a missing batch, and validation never rejected an empty
  one). validate_action_request now rejects a present-but-empty batch with
  400, and the executor uses split_first so the index panic is unreachable
  even if validation is bypassed.

- The coordination WebSocket fan-out task treated broadcast RecvError::Lagged
  as loop termination, so a slow operator panel that fell more than the
  room's 128-message buffer behind silently stopped receiving all further
  updates on an otherwise-open socket. It now logs the skip and resyncs to
  live, only exiting on Closed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tieguy
tieguy force-pushed the fix-server-empty-batch-and-lag branch from 0b1cffe to 62a2d7e Compare July 16, 2026 19:47
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