Skip to content

fix(platform): re-queue renamed synced files and isolate watchdog faults - #3782

Merged
yannickmonney merged 2 commits into
mainfrom
fix/rag-rescan-file-name-watchdog-faults
Sep 29, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
fix/rag-rescan-file-name-watchdog-faults

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Changes

A synced minutes.docx that failed indexing can now be queued again after its document is renamed to “Minutes 27.09”. Both OneDrive and Google Drive judge the stored file name and type. A .loop file displayed with a .pdf title remains unsupported and does not create an indexing job.

The RAG watchdog continues with later organizations after a slug-read failure, and with later rows after one failed status write. Two consecutive failed writes stop that organization's batch; only a completed write resets the counter. Successful settlements retain their counts and emit document-list hints using a fresh ownership read after the writes. Settlement rules and tenant routing are unchanged.

Validation

  • Independent runtime and tenant-boundary review; no additional source correction required.
  • 228 related server tests across 36 files, including both providers, watchdogs, jobs and document deletion.
  • Negative control reproduced independently: restoring the original runtime makes 14/51 focused tests fail; reviewed runtime bytes were then restored exactly.
  • Full platform type check, typed lint for changed source, and manual-layer checks pass.
  • Repository Opengrep scan exits successfully with zero findings (467 rules, 4,053 files); its log records standard exclusions, partial parses and one unrelated YAML rule timeout.
  • Independent native PostgreSQL run: 28/29 checks across recovery and status-hint lanes. Every selected behavior passes; the sole failure is the fixture's unavailable pg_search BM25 boot probe. This is a filtered run, not a full integration pass.
  • Independent real PostgreSQL probe: another transaction holds the middle of three stale rows while the watchdog runs with a lock timeout. The first and third settle, the middle remains running, the failed count is two, and the organization receives exactly one document-list hint.
  • Both real provider dependency objects requeue the renamed DOCX with one actual pg-boss job, and refuse the PDF-titled Loop file without a job.
  • The complete current-head CI gate is required before merge.

Bounds

The pre-existing extensionless-name mismatch remains: the shared indexability helper can accept a MIME type where the indexer requires a file extension. The organization-specific slug-read failure is covered by a deterministic unit test; the PostgreSQL probe exercises an actual row-lock timeout.

A OneDrive or Google Drive rescan decided whether to queue a file by its
document's title. A title renamed to "Minutes 27.09" reads as extension
09, so a readable minutes.docx whose last run failed went to the terminal
lane on every scan. That lane writes nothing for a name an extractor
reads, and the file was never queued again. The reverse held too: a
title ending in .pdf over a stored standup.loop queued a job the indexer
only refuses.

The scheduler now reads the document for its blob alone and judges the
stored file name and type, the ones the indexer reads. For both
providers, the renamed-title cases now expect the queue, and a title or
document type that reads as a PDF over a .loop expects the terminal lane.
The RAG watchdog read each organization's slug outside any catch, and
its cron handler catches nothing, so a dropped connection or a statement
timeout there ended the tick with every later organization unswept. One
catch also wrapped an organization's whole row loop: a row whose status
write kept throwing, such as one behind a lock held across ticks, deferred
every row queued after it, and since the candidates come in a fixed
order, it did so on every tick.

Each organization's sweep now runs inside its own catch, and each row's
write inside its own. A failing write defers that row alone, and the rows
after it are still settled and told to the lists. Two writes failing in a
row stop the organization, so a dead connection is not sent the rest of
the batch, and only a write that went through ends such a run. The
per-row rules move into one helper unchanged, with a new case for the
already-failed row that takes the corpus error without being counted.
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