⚡ Sangsakala Proxy 🏠 Home
Skip to content

fix(file-search): claim owners woken by a file write ahead of backfill reconciliation - #9655

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/file-search-dispatch-priority
Nov 4, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/file-search-dispatch-priority

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The backfill walk wakes every owner a page passes so the dispatcher reconciles its builds. Those wake-ups entered the owner queue never dispatched, exactly like an owner the file trigger wakes for a write, and each claim pass takes never-dispatched owners first in enqueue order. A page across many small owners put dozens of wake-ups with nothing to claim ahead of a fresh upload, which then waited several passes (minutes) to be indexed. Owners with pending work that had been dispatched before waited behind every one of them, so a busy workspace could go an hour between turns.
  • Backfill wake-ups now enter the queue as if just dispatched. Write-woken owners are claimed first; the wake-ups still rotate in by dispatch age, so reconciliation and backfill-found work are delayed behind fresh writes but never starved. An owner already queued keeps its place (the upsert is unchanged).
  • Only the backfill enqueue changes. The release, reaper, and trigger paths still enqueue never-dispatched, per-owner (2) and global (100) caps are unchanged, no migration. README notes the ordering.

Type of Change

  • Bug fix

Testing

  • dispatcher.integration.ts (real PostgreSQL, bun run test:integration dispatcher.integration), three new tests:
    • a write-woken owner is claimed on the next pass behind a page of 250 reconciliation wake-ups — red on the old code (claimed nothing)
    • with one free slot per pass, a fresh write is claimed before work the backfill found, then the backfill work on the next pass — red on the old code (backfill work won, the write was not claimed in two passes)
    • an owner already queued by a write stays ahead of an owner served earlier when a backfill page passes it — red on a mutant whose upsert stamps existing rows
    • writes go through the real workspace_file_search_mark_pending trigger, not hand-written queue rows
  • Whole suite 37/37; also ran owners.integration 18/18, chunks.integration 49/49 (1 opt-in skip), index-plan.integration 9/9, content-rendered.integration 31/31, dispatcher.test.ts + enqueue-dispatch.test.ts 17/17
  • lint and type-check (pre-push hooks); remaining audits in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…l reconciliation

The backfill walk wakes every owner a page passes so the dispatcher reconciles its builds. Those
wake-ups entered the owner queue never dispatched, the same as an owner the file trigger woke
for a write, and claims take never-dispatched owners first in enqueue order. A page across many
small owners therefore put dozens of wake-ups with nothing to claim ahead of a fresh upload,
which then waited several passes to be indexed. Owners with pending work that had been
dispatched before waited behind all of them.

Backfill wake-ups now enter as if just dispatched, so write-woken owners are claimed first and
the wake-ups still rotate in by dispatch age. An owner already queued keeps its place.
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 4, 2026 2:20am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Backfill wake-ups now enter the owner queue with lastDispatchedAt set, letting never-dispatched owners go first.

  • Fresh file writes reach indexing before backfill wake-ups.

Intent recorded: waleedlatif1 explicitly states that existing queue positions remain unchanged and backfill wake-ups wait behind fresh writes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Backfill page wakes owner] --> B{Already queued?}
  B -->|Yes| C[Keep existing position]
  B -->|No| D[Set lastDispatchedAt]
  D --> E[Wait behind never-dispatched owners]
  C --> F[Existing claim order and rotation]
  E --> F
Loading

Reviews (1) · Last reviewed commit: "fix(file-search): claim owners woken by ..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — b8f605cf Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant