Repository navigation
fix(wireClient): bound the offline queue, time out invokes, dedupe reconnect flush - #210
Merged
currentbits merged 1 commit intoAug 17, 2026
Conversation
Fixes #130. While disconnected every invoke() piled into `queued` unbounded, and reconnect fired the whole backlog at main at once. An invoke was only settled by a matching reply, so a handler that hung in main left the renderer promise pending forever. - Cap `queued` at 64, rejecting the oldest. - Arm a 120s timeout per invoke, covering both a hung handler and a queued call that never gets a reconnect. - Coalesce identical channel+args on flush so repeat poller ticks share one invoke instead of stampeding. Co-Authored-By: Claude Opus 5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
currentbits
deleted the
coder/wireclient-unbounded-offline-queue-no-in-a22e0e
branch
October 3, 2026 16:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #130.
Why
While the WebSocket was down, every
invoke()was pushed intoqueuedwith no size limit, andflushQueue()fired the whole backlog at main in one go on reconnect. The renderer has several interval pollers (devServerStatus every 3-5s, refreshStatus every 60s, summaries every 2s), so a web-server outage meant unbounded memory growth followed by a self-inflicted thundering herd.Separately, an inflight call was only ever settled by a matching
reply. A handler that hung in main left the renderer promise pending forever — the visible symptom being a button stuck in its busy state with no way out.What changed
src/wireClient.ts:"Offline queue full, request dropped"). Rejecting is the point: a silently dropped invoke leaves the same stuck button as an unbounded queue.channel + argsin the flush batch send a single invoke and share its reply. Repeat poller ticks collapse to one call each instead of one per tick.Also folded the existing inline
unrefinscheduleReconnectinto a small shared helper, now that two call sites need it.Tests
Three new cases in
test/wireClient.test.tscovering the cap (oldest rejects, 64 survive the flush), the coalescing (three poller ticks -> one invoke, all three promises resolve from the shared reply), and the timeout (rejects with the channel name, late reply is harmless). Full renderer suite: 715 passing.tsc --noEmitclean.Not done
No staggered flush and no per-channel timeout budgets — the cap plus dedupe already bounds the herd, and one global 120s ceiling is enough until a legitimately slow handler (gh network calls) starts tripping it.