Repository navigation
fix: mechanical subset of #1064 (awaitDrain leak, codex toml block-end, session-pool reload cap, drop-only echo) - #1113
Merged
Conversation
…l block-end, session-pool reload cap, drop-only echo re-injection Split from #1072 per review (issuecomment-5771332368): these four fixes are pure mechanical repairs with no policy/behavior trade-offs, extracted so they can merge independently of the behavioral changes that stay in #1072: - awaitDrain one-shot shared settle (server/stream-io.ts) — removes all 3 listeners per backpressure wait instead of leaking two; forward() call site now uses it - codex config.toml block-end (plugin-install.ts) — block ends at the next table header (optional indent, matching codexRemove); a refresh no longer deletes everything after an indented table - session pool reload cap (session.ts) — memory-miss reload evicts at MAX_SESSIONS before insert; evict-then-revisit can no longer grow the pool - echoReplaced drop-only (server.ts prepareResponses) — only a real replacement suppresses forge-time summary re-injection; a blob-less legacy drop re-injects via the developer message Gates: typecheck, full suite (0 fail), build.
Closed
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1113Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1113.tgz
npm install -g packageInstall instructions are refreshed on each push. |
ranxianglei
pushed a commit
that referenced
this pull request
Sep 22, 2026
#1113 (merged as aba2bff) carries the four mechanical fixes — awaitDrain listener leak, codex config.toml block-end, session-pool reload cap, drop-only echo re-injection — byte-identical to what this branch had, including their regression tests. Dropped those duplicated hunks here. Retained (observable behavior/policy, for standalone review): - stopIdleTimer lifetime split (fetch-util.ts; degenerate-retry/reasoning-guard callers keep client-abort coverage while dropping the idle watchdog) - imageBillingFor threaded into all three localInputEstimate sites - withConversationIdNote in the compress-loop system rebuild - MAX_ANTHROPIC_BETA_WINDOW 10M clamp (#12) - prefix-affinity w === TAIL_WINDOW trust threshold (#13 interim mitigation; design-level follow-up tracked in #1115) References #1064, #1113, #1115.
This was referenced Sep 22, 2026
Closed
Merged
This was referenced Nov 17, 2026
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.
Part of #1064, split from #1072 per review (#1072 (comment)).
Why split
#1072 bundles three classes of change: pure mechanical repairs, bug fixes with observable behavior shifts (retry-path abort lifetime, image-billing estimate → earlier compress triggers), and policy/hardening decisions (#13 tail-window trust threshold, #12 beta-window cap). Per the one-issue-one-scope discipline the mechanical subset is extracted here so it can merge independently; the behavioral and policy changes stay in #1072 for their own review.
What's in (4 fixes, each with a regression test that reproduces the original defect)
awaitDrainlistener leak (src/server/stream-io.ts): the old code registeredonce("drain")+once("close")+once("error")and resolved on the first fire, leaking the other two on every backpressure wait (MaxListenersExceededWarning on long streams). One shared settle removes all three.forward()now calls it instead of the inlinePromise.race.config.tomlblock-end (src/plugin-install.ts): the[mcp_servers.bili]block ended atindexOf("\n["), which misses an INDENTED next-table header — the block ran to EOF and a refresh deleted everything after it (data-loss class). End detection now matchescodexRemove: next table-header line, optional indent.src/session.ts): a memory-miss disk reload inserted a new resident entry without the MAX_SESSIONS guard (the guard below only runs for new sessions) — evict-then-revisit grew the pool past the cap unboundedly. Reload now evicts first.echoReplaceddrop-only (src/server.tsprepareResponses): an echoed legacy compaction item without a sentinel blob is DROPPED, nothing inserted — but the oldreplaced > 0 || dropped > 0setechoReplacedanyway, suppressing the forge-time summary re-injection and silently losing the summaries. Only a real replacement (summary actually injected) suppresses re-injection now.What stays in #1072
stopIdleTimerlifetime split (fetch-util.ts+ degenerate-retry/reasoning-guard callers) — retry-path policy: client abort now cancels upstreamimageBillingForthreading into the 3localInputEstimatesites — image-heavy sessions trigger compression earlierwithConversationIdNoteon the forward() compress system promptMAX_ANTHROPIC_BETA_WINDOWclampw === TAIL_WINDOWhardening (a design-level follow-up issue is being filed)After this merges, #1072 should rebase and drop the duplicated hunks.
Pre-flight
npm run typecheck✅npm run build✅d3bb77d(includes fix: invert the Responses instructions fingerprint into a codex/claude-only allowlist #1107 fingerprint allowlist — untouched)