Skip to content

Queue unembedded embedding roots when the embedding model becomes ready - #4258

Merged
mstomar125 merged 2 commits into
mainfrom
issue-4252-embed-sweep
Nov 6, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-4252-embed-sweep

Conversation

@mstomar125

@mstomar125 mstomar125 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4252

When a database's embedding service is wired (model ready), NodeEmbeddingService::queue_unembedded_roots queues every embedding root of an embeddable type that has no embedding row and no stale marker, then the processor is woken as before. A general sweep: no version check, no upgrade step.

  • Embedding roots are the three kinds embedding_root_id resolves to: tree roots, filed descendants, children of a chat. The query builds them from the same two predicates (filed_descendant_sql, unembedded_subtree_child_sql) in embedding_roots.rs.
  • SqliteStore::get_unembedded_root_ids: id-ordered keyset pages of participating (non-archived) embedding roots with no embedding rows. Page size is a parameter (queue_unembedded_roots_paged, default 500).
  • Per page: one query, one batched node read, one batched marker insert. Behaviour lookups are cached per node type for the run. A non-embeddable root (a task, empty content) gets no marker, so it is re-read each start; documented in the method comment.
  • A second start queues nothing. A failure is logged and does not stop wiring.

Tests (no model): service-level once/second-run, embedded root skipped, multi-page, archived; crate-level test that tree root, filed descendant and chat child are swept, and filed person, ordinary child and archived are not, agreeing with embedding_root_id. Each of seven mutations fails at least one test.

🤖 Generated with Claude Code

mstomar125 and others added 2 commits November 6, 2026 09:01
A root of an embeddable type with no embedding row and no stale marker was
never embedded until it was edited. When a database's embedding service is
wired, one paged query now finds such tree roots and queues them with stale
markers in batches, so a second start queues nothing again.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ur lookups

The unembedded-root query now selects the same three kinds of embedding root
that embedding_root_id resolves to (tree roots, filed descendants, children
of a chat), built from the same predicates. The page size is a parameter,
behaviour lookups are cached per node type for a run, and the per-start cost
of non-embeddable roots is documented.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-4252-embed-sweep branch from ead0bab to 64a1479 Compare November 6, 2026 08:01
@mstomar125
mstomar125 merged commit ec05a05 into main Nov 6, 2026
@mstomar125
mstomar125 deleted the issue-4252-embed-sweep branch November 6, 2026 08:01
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.

Queue unembedded embedding roots when the embedding service starts

1 participant