Parent: #1936
Problem
The scheduled six-hourly RAG full re-index (fanOutRagIndexJobs → per-repo rag-index-repo, src/queue/processors.ts:1068-1107) can run for a repo that already has a pending webhook-driven incremental re-index of changed paths for the same repo (runRagIndexJob with paths, :1124-1146). The two are not coalesced against each other (src/selfhost/queue-common.ts:652-657 keys them separately), so the same repo is re-embedded twice — wasting the free-tier vector budget and piling scheduled work on top of live webhook work.
Requirements
- A scheduled full re-index for a repo should not run while a webhook incremental re-index for that same repo is pending/processing (and vice-versa the full supersedes queued incrementals).
- Preserve correctness: a full re-index must still eventually run; an incremental must not be silently dropped if no full is pending.
Deliverables
- Coalesce-scope the two
rag-index-repo variants by repo so overlapping full/incremental work collapses.
- Tests for full-over-incremental supersession and incremental-preserved-when-no-full.
Acceptance criteria
- No double re-embedding of the same repo in one window; vector-budget spend drops on active repos.
- RAG retrieval freshness is unchanged.
Expected outcome
Scheduled RAG indexing stops duplicating webhook-driven indexing, cutting redundant embedding cost. (Net-new from the #1936 rate-limit/resource audit, rank 14.)
Parent: #1936
Problem
The scheduled six-hourly RAG full re-index (
fanOutRagIndexJobs→ per-reporag-index-repo,src/queue/processors.ts:1068-1107) can run for a repo that already has a pending webhook-driven incremental re-index of changed paths for the same repo (runRagIndexJobwithpaths,:1124-1146). The two are not coalesced against each other (src/selfhost/queue-common.ts:652-657keys them separately), so the same repo is re-embedded twice — wasting the free-tier vector budget and piling scheduled work on top of live webhook work.Requirements
Deliverables
rag-index-repovariants by repo so overlapping full/incremental work collapses.Acceptance criteria
Expected outcome
Scheduled RAG indexing stops duplicating webhook-driven indexing, cutting redundant embedding cost. (Net-new from the #1936 rate-limit/resource audit, rank 14.)