fix: don't log async queue-time ingests as "permanently rejected"#361
fix: don't log async queue-time ingests as "permanently rejected"#361Marvinthebored wants to merge 1 commit into
Conversation
The daemon ingests asynchronously: ingest_markdown_document returns at queue-time, before the embed/commit runs, so the feedback reports nodesAccepted=0 (and nodesRejected=0) even though the chunk was successfully queued and commits moments later. The chunk loop treated nodesAccepted===0 as a permanent rejection — logging "Chunk permanently rejected" and pointlessly shrinking the chunk budget — which under load (a backed-up WAL) fired on nearly every chunk, flooding logs with false data-loss alarms even though the content committed fine. Gate the rejection path on nodesRejected > 0 (the only signal of an actual rejection). A real rejection still shrinks-and-retries on a lower reported tokenBurstLimit, and otherwise logs an accurate "Chunk rejected" with the nodesRejected count. The normal async-queued case (nodesRejected === 0) is now treated as success: no warning, no shrink, advance. Adds unit tests: async queue-time nodesAccepted=0/nodesRejected=0 produces no rejection warning and submits the whole document; a real nodesRejected>0 with a lower burst limit shrinks and retries the same offset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughIn Async ingest rejection fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
compoodment
left a comment
There was a problem hiding this comment.
Vale Review — PR #361
Quality: Q3/5 — promising
Head: 8e583c8
Findings:
None
Proof gaps: Targeted tests were not run by Vale; live-daemon proof is PR-author supplied. Mixed feedback with both nodesAccepted > 0 and nodesRejected > 0 is still not covered by the new unit tests, so the feedback contract should stay on the reviewer radar.
Verdict: comment-only — focused fix with relevant tests, but not independently verified in this run.
– Vale
Summary
The chunk ingest loop (
src/ingest-queue.ts) logsChunk permanently rejectedand shrinks the chunk budget whenever the daemon'singest_markdown_documentreturnsnodesAccepted === 0. But the daemon ingests asynchronously — the RPC returns at queue-time, before the embed/commit runs — so a perfectly good ingest reportsnodesAccepted: 0(andnodesRejected: 0) on return; the content commits moments later as the WAL drains.Under load (a backed-up WAL)
nodesAccepted: 0is the normal return, so this fired on nearly every chunk, flooding logs with falseChunk permanently rejectedwarnings even though nothing was rejected and all content committed.Evidence (running daemon, GGUF backend): the ingest feedback for a wide range of inputs — a full 8.9 KB document, a 2 KB slice, an 80-char slice, even plain English — is uniformly:
nodesRejectedis0throughout; the WAL depth climbs (queued) and the documents are retrievable seconds later.Fix
Gate the rejection path on
nodesRejected > 0— the only signal of an actual rejection — instead ofnodesAccepted === 0:nodesRejected === 0(the normal async-queued case) → success: no warning, no shrink, advance.nodesRejected > 0→ a real rejection: shrink-and-retry the same offset if the daemon reported a lowertokenBurstLimit, otherwise log an accurateChunk rejectedincluding thenodesRejectedcount.This removes the false-alarm flood without weakening genuine rejection handling. (The
ok === falsetransport-error path is unchanged.)Testing
tsc --noEmitclean; unit suite green (5/5), including two new tests:nodesAccepted=0 / nodesRejected=0produces no rejection warning and submits the whole document;nodesRejected > 0with a lower burst limit shrinks and retries the same offset.errors=0, and the previously-"rejected" dense documents are retrievable. Driving the three worst offenders straight through the patched queue (fresh hashes, bypassing dedup) produced 0 warnings.Note
This supersedes #360, which I closed — that PR chased a chunk-size theory, but the symptom was never a size rejection (the daemon never set
nodesRejected > 0); it was this async-queue mislabeling. Apologies for the detour.Fixed chunk ingest handling so async queue-time ingests with
nodesAccepted === 0andnodesRejected === 0are treated as successful instead of being logged as permanently rejected.nodesRejected > 0tokenBurstLimitis reportedChunk rejectedwith the rejection countComplexity: