Make the boot-time LLM posture provider-aware, not Anthropic-only - #697
Merged
Conversation
derive_llm (backing boot.llm_posture and /readyz) checked only anthropic_api_key, so any argo or local deployment logged "off" and served /readyz as llm: off while actually calling out on every request. build_llm was already provider-aware; derive_llm was a second, stale copy of the wiring rule that could disagree with it. Extract llm_provider_configured in build_llm.py as the one place that matches settings.llm_provider against the credential each provider reads (via the existing per-provider extractor functions), and have both build_llm and derive_llm consult it instead of restating the match. Add a differential test asserting the two authorities agree across the full provider x credential x llm_enabled matrix, since a predicate that merely looks correct can still drift from build_llm and only a comparison test catches that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
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.
Summary
derive_llm(backingboot.llm_postureand/readyz) checked onlyanthropic_api_key, so anargoorlocaldeployment loggedllm: offat boot and on every readiness probe while actually serving every call through that provider.build_llmwas already provider-aware;derive_llmwas a second, stale copy of the wiring rule that could disagree with it.llm_provider_configuredinbuild_llm.pyas the single authority for "does the selected provider have its own configuration present", built from the same per-provider extractor functionsbuild_llmalready used to construct adapters (_anthropic_credential,_argo_identity,_local_endpoint). Bothbuild_llmandderive_llmnow consult it instead of restating the per-provider match.derive_llmdoes not callbuild_llm: it only calls the pure predicate, so a probe on/readyznever constructs a live adapter or HTTP client.Test plan
uv run pytest tests/unit tests/architecture(45171 passed, 633 skipped)uv run pyright src/cora tests/unit(0 errors)uv run ruff check && uv run ruff format --check(build_llm(s) is not None) == (derive_llm(s) == "live")across the full provider x credential xllm_enabledmatrix (anthropic/argo/local, each with credentials present/absent, switch on/off)derive_llmunit tests for the argo and local arms, including the exact regression case (argo selected, no Anthropic key configured, argo username present ->live)Out of scope: the eight unwritten OTel columns on
entries_decision_inferences(separate known issue).Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com