Start when the host has no embedding model configured yet - #77
Open
jasperblues wants to merge 1 commit into
Open
Start when the host has no embedding model configured yet#77jasperblues wants to merge 1 commit into
jasperblues wants to merge 1 commit into
Conversation
Both graph-backend beans resolved the default embedding service while they were being created, via ai.withDefaultEmbeddingService(). That throws when no embedding model is registered, so a host whose provider key arrives at first run rather than at boot could not start — and could not reach the setup flow that would have supplied the key. drivinePropositionRepository now prefers the application's own EmbeddingService bean where there is an unambiguous one (a @primary bean counts), falling back to the platform default. A host that supports late configuration registers a service that reports its own absence and can be switched on later; DrivinePropositionRepository only touches it when it actually embeds, so holding an absent-tolerant one is safe. propositionVectorIndexSchema registers nothing when there is no model, rather than guessing a dimension. An index built at the wrong dimension is worse than no index, because writes to it succeed and a real model later disagrees with everything already stored. The catalog is rebuilt on the next boot, by which time a model configured at first run is registered. Behaviour is unchanged for any deployment that has an embedding model. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
johnsonr
approved these changes
Aug 8, 2026
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.
Problem
Both graph-backend beans resolved the default embedding service while being created:
withDefaultEmbeddingService()throws when no embedding model is registered. A host whose provider key arrives at first run rather than at boot therefore could not start — and so could not reach the setup flow that would have supplied the key.Change
drivinePropositionRepositoryprefers the application's ownEmbeddingServicebean where there is an unambiguous one (a@Primarybean counts), falling back toai.withDefaultEmbeddingService()as before.This matters because a host that supports late configuration registers a service that reports its own absence and can be switched on later.
DrivinePropositionRepositoryonly touches the service when it actually embeds — never in its constructor — so holding an absent-tolerant one is safe.getIfUnique()is deliberate: it returns the@Primarybean when there is one,nullwhen the choice is ambiguous, and the fallback then preserves today's behaviour rather than failing on ambiguity.propositionVectorIndexSchemaregisters nothing when there is no model, instead of guessing a dimension.Why skip rather than guess
An index built at the wrong dimension is worse than no index, because writes to it succeed — a real model configured later silently disagrees with everything already stored. Skipping is recoverable; a corrupted index is not obviously broken until someone notices bad results.
The catalog is rebuilt on the next boot, by which time a model configured at first run is registered. Deployments that restart after first-run setup get this for free.
Compatibility
Unchanged for any deployment that has an embedding model — which is every existing one. The new path is only reachable when resolution would previously have thrown and taken the context down.
The in-memory backend (
inMemoryPropositionRepository) still callswithDefaultEmbeddingService()directly. It is only active when the graph store is not, and was left alone to keep this change to the failing path.Testing
dice-storage+dice-storage-autoconfigure: 100 tests pass, 0 failures🤖 Generated with Claude Code