You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Evict watermark sessions incrementally at cache capacity #6044
Admitting session 1,025 clears every existing watermark handshake.
Proposed correction
Evict only the least recently used session and refresh recency when a known session is captured or used.
Regression coverage
A full 1,024-session table retains all but the oldest entry, refreshes recency on emit/capture/learn, and does not allocate slots for unknown reads.
Validation
Passed against exact fork commit ffb5a3dcf0ecbf07a6d28e3db54a64bd05193fa8 in an isolated GitHub Actions checkout: validation job. The targeted regression and related suites, npm run typecheck, and npm run build all passed on Node 22. This is targeted verification, not the full upstream CI matrix.
node --import ./tests/preload-storage-baseline.mjs --import ./tests/preload-test-env.mjs --import tsx --test tests/watermark-cache-eviction.test.ts tests/pf-channel.test.ts tests/msgid-rule-parity.test.ts
npm run typecheck
npm run build
Related work checked
Inspected pending protocol PRs #5652 and #5855; both leave the full-clear capacity behavior unchanged.
Duplicate screening: not a duplicate. One open PR targets this exact thread — your own #6054 (same symptom, same mechanism, Closes #6044). Per the one-fix-PR-per-thread rule I adopted and reviewed it instead of opening a parallel PR. A repo-wide sweep for other work on the pf-channel capacity behavior found none: the nearest neighbors are distinct problems (#5813 = count header never emitted due to pre-merge headers; #5855 = fastpath-v6 re-land, which you already checked leaves clear-all untouched).
Verification (bug confirmed at master 4be21b08, which is also the current master tip — the PR sits 0 commits behind):
Root cause is exactly where you pointed: src/agent/pf-channel.tstakeSlot() used tracked.clear() as its capacity policy — the 1,025th distinct conversation in one host process wiped all 1,024 live handshakes, forcing every active session back onto the legacy full-parse path until each got restamped. That's a capacity-strategy defect in the client-side state machine, not a caller or wire problem — your diagnosis hits the mechanism directly.
The LRU fix is complete at the single chokepoint: all consumers (the native-intercept emit/learn sites plus the dsh/pi/omp/opencode capture adapters) funnel through the same three entry points, so no other code path carries the old clear-all assumption. Wire format is byte-identical; proxy mode is untouched (the module is plugin-lane client-side by design).
Ran the targeted validation locally on the PR head: new eviction test + existing pf-channel suite + msgid-rule-parity = 18/18 pass, npm run build OK, npm run typecheck clean.
Test quality check: the regression test has teeth — if clear-all regressed, the retain loop fails on every surviving session; if unknown reads started allocating slots, the 2,000–3,999 probe loop would evict all real sessions and the assertions would blow up. Deterministic, no ports or env luck.
Added one comment-only commit (168e8ca1cd) to the PR branch: the MAX_TRACKED constant's comment still described the old "same hygiene as the old per-lane maps" rationale after the policy changed; it now names the evict-one-LRU behavior. Zero behavioral change.
Labeled PR [PR] fix: evict watermark sessions incrementally at cache capacity #6054 from its own diff: bug / p2 / scope/wiring (degradation only under >1,024 concurrent watermark sessions with graceful fallback → p2, not p1; host↔bili handshake wiring, not kernel/storage). Mirror issue labeled to match.
Live status (checked minutes ago): CI on the updated head 168e8ca1cd has 53 runs registered, zero failures so far (zero-token e2e lanes skip immediately; the test lanes are still running).
Activity
docs(pf-channel): state the LRU eviction policy at the capacity constant
ranxianglei commentedon Nov 9, 2026
(ai: vllm-qwen/qwen3.8-27b)
Duplicate screening: not a duplicate. One open PR targets this exact thread — your own #6054 (same symptom, same mechanism,
Closes #6044). Per the one-fix-PR-per-thread rule I adopted and reviewed it instead of opening a parallel PR. A repo-wide sweep for other work on the pf-channel capacity behavior found none: the nearest neighbors are distinct problems (#5813 = count header never emitted due to pre-merge headers; #5855 = fastpath-v6 re-land, which you already checked leaves clear-all untouched).Verification (bug confirmed at master
4be21b08, which is also the current master tip — the PR sits 0 commits behind):src/agent/pf-channel.tstakeSlot()usedtracked.clear()as its capacity policy — the 1,025th distinct conversation in one host process wiped all 1,024 live handshakes, forcing every active session back onto the legacy full-parse path until each got restamped. That's a capacity-strategy defect in the client-side state machine, not a caller or wire problem — your diagnosis hits the mechanism directly.Review of #6054 + what I did on it:
npm run buildOK,npm run typecheckclean.168e8ca1cd) to the PR branch: theMAX_TRACKEDconstant's comment still described the old "same hygiene as the old per-lane maps" rationale after the policy changed; it now names the evict-one-LRU behavior. Zero behavioral change.Live status (checked minutes ago): CI on the updated head
168e8ca1cdhas 53 runs registered, zero failures so far (zero-token e2e lanes skip immediately; the test lanes are still running).结构化八问:
takeSlot()用tracked.clear()(清全部)而不是逐出单条。根因在状态机的容量策略层,不在任何调用方或线上协议;报告者定位准确。判定:#6054 可合(待 CI 转绿;当前运行中、截至检查时无失败项)。合并为人工操作。
Merge origin/ci-fixes (= master tip 58a8796) into reland-v6 lane
test: reconcile master-side pins with the merged v6 lane