fix(queue): rank reembed_backfill right after seal in claim_next - #169
Conversation
The deduped reembed_backfill row is the only writer of chunk vectors since extract_chunk stopped embedding inline, and it shares the single-permit LLM gate with every extract_chunk. In the ELSE bucket, the 50 ms gate-busy defer round-robined it behind the whole extraction backlog, so vectors trailed extraction by the length of the backlog (bursts 7 to 12 minutes apart in the field). Rank it second so each freed permit goes to the backfill while it has work; it still embeds one bounded batch, defers REEMBED_BACKFILL_REVISIT_MS and settles Done once covered, so extraction is not starved in return. Adds two store tests pinning the claim ladder and updates the job-queue gitbook to match the query. Closes tinyhumansai#168
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe queue now claims ChangesQueue priority
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change prioritizes re-embedding backfills ahead of extraction backlog work while retaining the existing queue behavior. The documented ordering and tests align with the intended behavior, with no current merge-blocking risk identified. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
How this change flows1 changed behaviour across 12 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 41 further behaviours left out to keep the diagram readable. flowchart LR
n0["claim_next<br/>changed"]:::changed
n1["enqueue"]:::impacted
n2["test_config"]:::impacted
n3["extract_job"]:::impacted
n4["get_job"]:::impacted
n5["mark_failed"]:::impacted
n6["mixed_outcomes_stress"]:::impacted
n6 -->|calls| n0
n6 -->|tests| n0
n6 -->|calls| n1
n6 -->|tests| n1
n6 -->|calls| n2
n6 -->|tests| n2
n6 -->|calls| n3
n6 -->|tests| n3
n6 -->|calls| n4
n6 -->|tests| n4
n6 -->|calls| n5
n6 -->|tests| n5
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge. |
There was a problem hiding this comment.
tinysweeper found nothing blocking. Approving.
$0.0075 · 81,734 in / 1,145 out · 0 cached (0%) · deepseek/deepseek-v4-flash, openrouter/openai/text-embedding-3-small · 412 embedded
critique: $0.0033 · 36,281 in / 288 out · 0 cached (0%) · deepseek/deepseek-v4-flash
security: $0.0023 · 24,607 in / 466 out · 0 cached (0%) · deepseek/deepseek-v4-flash
tests: $0.0012 · 13,900 in / 95 out · 0 cached (0%) · deepseek/deepseek-v4-flash
description: $0.0005 · 5,926 in / 105 out · 0 cached (0%) · deepseek/deepseek-v4-flash
Picks up tinyhumansai/tinycortex#169 (`claim_next` ranks `reembed_backfill` right after `seal`, so the only path that writes chunk vectors is no longer round-robined behind the whole `extract_chunk` backlog by the LLM-gate defer; tinycortex#168), the v0.1.2 release (crate version 0.1.1 -> 0.1.2, `dirs` 5 -> 6) and the dependabot bumps between the two pins. Both lockfiles follow the pin; the `dirs` bump lets cargo drop the second copies of `dirs` / `dirs-sys` / `redox_users` / `thiserror 1.x` and the `windows-sys 0.48` family they alone pulled in.
Summary
claim_nextnow ranksreembed_backfillsecond, right afterseal:seal>reembed_backfill>flush_stale>append_buffer> everything else, thenavailable_at_ms. The deduped backfill row is the only writer of chunk vectors sinceextract_chunkstopped embedding inline, and it shares the single-permit LLM gate with everyextract_chunk. In theELSEbucket, the 50 ms gate-busy defer round-robined it behind the whole extraction backlog, so vectors arrived in bursts 7 to 12 minutes apart in the field (Sources row warns "Stored without vectors" for a transient embedding backlog after a large sync openhuman#6025).is_llm_boundunchanged). Each step still embeds one bounded batch, defersREEMBED_BACKFILL_REVISIT_MS(750 ms) and settlesDoneonce the space is covered, so extraction is not starved in return.LLM_GATE_RETRY_MSis untouched (the issue lists it as optional and separate).claim_next_prefers_reembed_backfill_over_older_extract_chunk(the issue's case) andclaim_next_ranks_seal_then_backfill_then_flush_then_append_then_age(pins the whole ladder with explicitavailable_at_ms, so rank, not age, decides).gitbooks/job-queue.md"Claiming and ordering" updated to match the query.Notes for reviewers
extract_chunkrows). Expected lag from chunk write to vector drops from one full rotation of the backlog to a handful of extract completions, i.e. tens of seconds. A fully deterministic hand-off would need a kind-specific gate-busy defer for the backfill; a 0 ms defer at rank 2 would hot-spin the row aboveflush_stale/append_bufferand starve them while the gate is busy, so that is deliberately left out.vendor/tinycortexand cuts a patch release, then openhuman re-pins the module.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test(default features)cargo test --all-targets --no-default-features --features tokiocargo build --all-targets --all-featuresandcargo test --all-featurescargo clippy --all-targets --all-features -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-depsCloses #168
Summary by CodeRabbit
Improvements
Documentation