🐾 fix: resolve registry capabilities per agent, not once globally #6
Reference in New Issue
Block a user
Delete Branch "fix/registry-per-agent-capabilities"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
_build_registrycomputed a singlecapabilitiesdict from the globaldefault_modeland attached it to every agent entry, ignoring the per-agentmodel:/model_capabilities:overrides thatserver.pyactually applies at startup (_start_agentoverwritesAgentConfig.modelfor every agent in the module). Any deployment using an override would advertise the wrong model to Daedalus.Second, smaller bug: when
model_capabilitiesis absent butdefault_modelis set, the registry publishedcontext_window: null/max_output_tokens: null— while_register_one_modelregistered that same model with an effective131072/16384. The registry now advertises what was actually registered.Changes
registry.py:_load_model_capabilities()→_load_fastagent_defaults()(returns the raw globals) plus a new_resolve_capabilities(agent, default_model, default_capabilities)called inside the agent loop.server.py:131072/16384hoisted toDEFAULT_CONTEXT_WINDOW/DEFAULT_MAX_OUTPUT_TOKENSand imported byregistry.py, so the two cannot drift — that agreement is the whole point of the fix. No import cycle:server.pyimportspallas.registrylazily inside a function, never at module scope.tests/test_registry.py: new, 9 tests — first coverage forregistry.py.agents.yamlfield table omittedagents.<name>.modelandagents.<name>.model_capabilitiesentirely; the Capabilities section andpallas_integration.mdboth claimed capabilities are published only whenmodel_capabilitiesis configured, which was wrong before and after.Preserved: the provider prefix stays stripped (
anthropic.claude-opus-4-7→claude-opus-4-7), andfastagent.config.yamlis still re-read per request.Behaviour delta
model:overridemodel_capabilities:overridedefault_model, nomodel_capabilitiesnull/null131072/16384model:Please sanity-check the last row against your deployments — it's a deliberate consequence of the agent-model-falls-back-to-global rule, not an accident, but it is newly-published output.
Verification
pytest tests/ -q→ 76 passed (67 existing + 9 new).Diffed real output against
~/git/mentor's actualagents.yaml+fastagent.config.yaml, old code vs new:Model name unchanged, nulls replaced with the effective values. No checked-in
agents.yamlin the estate uses a per-agentmodel:today, so no currently-published model name changes.Notes
pyproject.tomlversion deliberately not bumped.🤖 Generated with Claude Code
_build_registry built one capabilities dict from the global default_model and attached it to every entry, so any agent with an `agents.<name>.model` or `model_capabilities` override was advertised under the wrong model — even though server.py applies those overrides at startup. Resolve capabilities per agent, mirroring _register_unknown_models. Also stop emitting null context_window / max_output_tokens when model_capabilities is absent: _register_one_model registers the model with 131072 / 16384, so the registry now advertises those effective values. The defaults are hoisted to module constants in server.py so the two cannot drift. Verified against mentor's config: capabilities go from {"context_window": null, "max_output_tokens": null} to {131072, 16384}, model name unchanged. No checked-in deployment uses per-agent overrides today, so no currently-published model changes. Adds tests/test_registry.py (9 tests, first coverage for registry.py) and documents agents.<name>.model / model_capabilities, which the agents.yaml field table omitted entirely. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>