Repository navigation
fix(platform): re-queue the documents an embedding config unblocks - #3218
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 texttold 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 /embeddingnow re-queues them and answers with the count, so the pagecan report the recovery instead of looking as though nothing happened.
Why the selection is by error code
embedding_not_configuredis stamped by exactly this cause(
knowledge/service.ts, theEmbeddingNotConfiguredarm), so the affectedrows 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
queuedwith no job to drain it — the state the watchdogwould 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:
console.warnwith the real errorassistant_tools.tslogs it with the org idKNOWLEDGE_UNAVAILABLE_FOR_MODELVerification
selects on the error CODE, not merely on failed statusclears the stale failure so the UI stops showing itenqueues at default priority — a drain must not outrank an uploadscopes to the organization and respects the skip flagClearing 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
typecheck0 errors,oxlint --type-awareclean,oxfmt --checkclean,knowledge suites 58 passed (7 files).