Skip to content

Make the boot-time LLM posture provider-aware, not Anthropic-only - #697

Merged
xmap merged 1 commit into
mainfrom
fix/llm-readiness-provider-agnostic
Aug 20, 2026
Merged

Make the boot-time LLM posture provider-aware, not Anthropic-only#697
xmap merged 1 commit into
mainfrom
fix/llm-readiness-provider-agnostic

Conversation

@xmap

@xmap xmap commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • derive_llm (backing boot.llm_posture and /readyz) checked only anthropic_api_key, so an argo or local deployment logged llm: off at boot and on every readiness probe while actually serving every call through that provider. build_llm was already provider-aware; derive_llm was a second, stale copy of the wiring rule that could disagree with it.
  • Extracted llm_provider_configured in build_llm.py as the single authority for "does the selected provider have its own configuration present", built from the same per-provider extractor functions build_llm already used to construct adapters (_anthropic_credential, _argo_identity, _local_endpoint). Both build_llm and derive_llm now consult it instead of restating the per-provider match.
  • derive_llm does not call build_llm: it only calls the pure predicate, so a probe on /readyz never 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
  • Added a differential test asserting (build_llm(s) is not None) == (derive_llm(s) == "live") across the full provider x credential x llm_enabled matrix (anthropic/argo/local, each with credentials present/absent, switch on/off)
  • Added targeted derive_llm unit 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

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>
@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  apps/api/src/cora/agent
  build_llm.py
  apps/api/src/cora/api
  _readiness.py
Project Total  

This report was generated by python-coverage-comment-action

@xmap
xmap merged commit afa6533 into main Aug 20, 2026
19 checks passed
@xmap
xmap deleted the fix/llm-readiness-provider-agnostic branch August 20, 2026 19:40
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