Skip to content

fix(platform): re-queue the documents an embedding config unblocks - #3218

Merged
Israeltheminer merged 1 commit into
mainfrom
fix/requeue-on-embedding-config
Sep 4, 2026
Merged

Israeltheminer merged 1 commit into
mainfrom
fix/requeue-on-embedding-config

Conversation

@Israeltheminer

Copy link
Copy Markdown
Contributor

Part of #2988 — the third of its problems, "fixing it does not fix it".

Configuring an embedding model fixed nothing for the documents that had
already failed for want of one. Each stayed failed, and its own failure text
told the operator to set a model "under Settings → Data residency … then retry
indexing" — following that instruction exactly left them no better off, one
document at a time.

POST /embedding now re-queues them and answers with the count, so the page
can report the recovery instead of looking as though nothing happened.

Why the selection is by error code

embedding_not_configured is stamped by exactly this cause
(knowledge/service.ts, the EmbeddingNotConfigured arm), so the affected
rows are precisely identifiable. A document that failed on a detected secret,
a PII block, or an unreadable file is left alone — its operator still has the
per-document Retry.

Getting that wrong is expensive in both directions: too narrow leaves the
stall in place, too wide silently retries a blocked document on every config
save. Both directions are asserted.

The flip and the enqueues share one transaction, so a crash between them
cannot leave a row queued with no job to drain it — the state the watchdog
would then have to guess about.

Enqueued at default priority. This is a backlog drain, not the one file
somebody is watching, so it must not push ahead of a live upload. (That
distinction is #3217; this PR is consistent with it either way.)

What was already fixed on main

Three of #2988's five asks are done, which is why this PR is only the third:

Ask State
the degraded path emits a console.warn with the real error done — assistant_tools.ts logs it with the org id
the model gets a stable, non-leaking message done — KNOWLEDGE_UNAVAILABLE_FOR_MODEL
every "Settings → Knowledge" corrected done — the sandbox bridge now says there is no such page
saving a config re-queues the blocked documents this PR
an org-level knowledge-health signal still open

Verification

Mutation Went red
widen the selection to any failed row selects on the error CODE, not merely on failed status
stop clearing the stale failure clears the stale failure so the UI stops showing it
give the drain interactive priority enqueues at default priority — a drain must not outrank an upload
drop the skip-flag guard scopes to the organization and respects the skip flag

Clearing the stale text matters for the reason the third mutation shows:
leaving the old error on a now-queued row reads as "queued and broken" in
the document dialog.

Gate

typecheck 0 errors, oxlint --type-aware clean, oxfmt --check clean,
knowledge suites 58 passed (7 files).

Configuring an embedding model fixed nothing for the documents that had
already failed for want of one. Each stayed `failed`, and its failure text
told the operator to set a model "under Settings → Data residency … then
retry indexing" — following that instruction exactly left them no better
off, one document at a time.

`POST /embedding` now re-queues them and answers with the count, so the
page can report the recovery instead of looking as though nothing happened.

Scoped by `rag_error_code`, not by status. `embedding_not_configured` is
stamped by exactly this cause, so a document that failed on a detected
secret, a PII block, or an unreadable file is left alone — its operator
still has the per-document Retry. Getting that selection wrong is expensive
in both directions: too narrow leaves the stall, too wide silently retries
a blocked document on every config save.

The flip and the enqueues share ONE transaction, so a crash between them
cannot leave a row `queued` with no job to drain it.

Enqueued at DEFAULT priority: a backlog drain must not push ahead of the
file somebody is watching.

## Tests

| Mutation | Went red |
| --- | --- |
| widen the selection to any failed row | `selects on the error CODE, not merely on failed status` |
| stop clearing the stale failure | `clears the stale failure so the UI stops showing it` |
| give the drain interactive priority | `enqueues at default priority — a drain must not outrank an upload` |
| drop the skip-flag guard | `scopes to the organization and respects the skip flag` |

Refs #2988.
@Israeltheminer
Israeltheminer merged commit fe27bd3 into main Sep 4, 2026
48 checks passed
@Israeltheminer
Israeltheminer deleted the fix/requeue-on-embedding-config branch September 4, 2026 14:54
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