Let a deployment designate which Agent each LLM subscriber acts as - #701
Merged
Conversation
RunDebrieferSubscriber and CautionDrafterSubscriber hardcoded the seeded singleton Agent id, and both seeded Agents declare provider=anthropic. Every LLM adapter refuses a request whose model_ref.provider is not its own, so on a deployment where api.anthropic.com is unreachable (2-BM's controls network has no internet) the autonomous path is structurally dead: LLM_ENABLED=true would defer every completed Run instead of debriefing it. The on-demand regenerate_run_debrief path already lets an operator name the Agent; the subscribers did not. Add run_debriefer_agent_id / caution_drafter_agent_id settings (UUID | None, default None = the seeded singleton, so nothing changes on upgrade). Thread the id through both subscribers as a keyword-only constructor argument so the class stays unit-testable without Settings. Validation lives on the per-apply gate path, gated on designation being explicit: a designated Agent that doesn't exist or is the wrong kind skips with a named reason; the seeded default stays exempt from the existence check the way regenerate_run_debrief already exempts it. caution_drafter.py never served the Agent's declared model (unlike run_debriefer.py, which already did); fixed so designating a CautionDrafter Agent that declares a reachable provider actually changes what gets served. report_designated_agents(deps), called from main.py after both singleton seeds, logs which Agent is effective for each subscriber and warns on a provider mismatch. It is a report, never a gate: the adapter already refuses the call at request time and is the authority, so a second gate here would re-decide a verdict that already exists. The warning exists only because that refusal otherwise arrives per-event, hours later, as a deferred Decision that never names the mismatch. ModelRef stays immutable; no update_agent_model_ref command is added. The approved-model catalog gate is not re-checked at designation (define_agent already checked it). Co-Authored-By: Claude Sonnet 5 <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
provider=anthropic, and every LLM adapter refuses a request whosemodel_ref.providerisn't its own, so on a deployment that cannot reachapi.anthropic.com(2-BM's controls network) the autonomous path was structurally dead.run_debriefer_agent_id/caution_drafter_agent_idsettings (defaultNone= seeded singleton, so nothing changes on upgrade), threaded through both subscribers as a keyword-only constructor arg.regenerate_run_debrief.caution_drafter.py, which never served the Agent's declared model (unlikerun_debriefer.py).report_designated_agents(deps), called frommain.pyafter both singleton seeds: a boot-time report (never a gate) naming the effective Agent per subscriber and warning on a provider mismatch.ModelRefstays immutable; noupdate_agent_model_refcommand added. The approved-model catalog gate isn't re-checked at designation..env.exampleanddocs/deployments/2-bm/llm_debrief.md(which already covered exactly this gap).Test plan
pytest tests/unit/agent— 948 passedpytest tests/unit(full) — 13954 passed, 1 pre-existing skippytest tests/integration/test_run_debriefer_subscriber_postgres.py tests/integration/test_caution_drafter_subscriber_postgres.py— 13 passedpytest tests/integration/scenarios/test_2bm_run_debriefer*.py— 3 passedruff check/ruff format --checkcleanpyrightclean (with--all-extrassynced)🤖 Generated with Claude Code