Skip to content

fix(gui): rate-limit remote drop logs and skip event mirroring while NATS is offline - #101

Merged
tallcode merged 2 commits into
mainfrom
claude/quirky-villani-ba2222
Aug 6, 2026
Merged

tallcode merged 2 commits into
mainfrom
claude/quirky-villani-ba2222

Conversation

@tallcode

@tallcode tallcode commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

The remote bridge's per-event drop log flooded the terminal the moment the NATS publish queue saturated (e.g. the NATS server was restarted/down): the single drain task blocks on publish().await, so every subsequent tool_delta dropped and printed remote: event publish queue full — one line per event, forever.

Two fixes in gui/src-tauri/src/remote/mod.rs:

  1. Rate-limited drop logging — a DropCounters episode state machine: one line when an episode starts, one cumulative line per 10s while it persists, one line on recovery. Event-driven (runs on the hot path every event passes through) because the drain task can't reach its own timer while blocked on publish.
  2. Skip mirroring while NATS is offline — publish_event now checks client.connection_state() before serializing/enqueueing, so a dead link no longer piles up to 4096 events that can't be sent. This is the root-cause fix for the server-restart scenario.

Clients still heal any gap via get_events_since backfill on reattach — a dropped event is never data loss.

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --check (workspace + gui/src-tauri) — clean
  • cargo test (agent) — 856 passed
  • cargo test --lib (gui/src-tauri) — 184 passed, incl. 2 new DropCounters unit tests (rate-limit episodes; recovery + reset)

🤖 Generated with Claude Code

tallcode and others added 2 commits August 6, 2026 15:01
…NATS is offline

The remote bridge's per-event "event publish queue full" eprintln flooded the
terminal the moment the queue saturated (e.g. NATS server down/restarted): the
drain task blocks on publish().await so every subsequent tool_delta dropped and
printed a line. Drop reporting is now a rate-limited episode state machine
(first line, then one per 10s, then a single recovery line), and publish_event
checks the NATS connection state before serializing/enqueueing so events can't
pile into a queue that has no live link to send them. Clients still heal any
gap via get_events_since backfill.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@tallcode
tallcode enabled auto-merge (squash) August 6, 2026 07:03
@tallcode
tallcode merged commit 9829e71 into main Aug 6, 2026
17 checks passed
@tallcode
tallcode deleted the claude/quirky-villani-ba2222 branch August 6, 2026 07:08
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