Fix agent model cache identity#142
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
d26d04b to
244dc6f
Compare
244dc6f to
73e7064
Compare
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
Fixes a runtime cache bug where agent-level model overrides could reuse a stale compiled Deep Agents graph.
Root Cause
_model_cache_key()collapsed plain string model IDs tostr, so different string IDs such asus.amazon.nova-lite-v1:0andglobal.anthropic.claude-sonnet-5could share the same graph cache entry. The cache also lacked a resolved provider/config identity, leaving same-model/different-provider or same-model/different-base-url cases vulnerable to stale graph reuse.Changes
_model_cache_key().DeepAgentStreamingServiceintoCognitionAgentParams/RuntimeContext.resolve_model_for_session()tuple behavior while adding richerresolve_runtime_model_for_session()metadata.ROADMAP.md.Validation
PYTHONPATH=. uv run pytest tests/unit/test_pluggability.py tests/unit/test_provider_resolution.py tests/unit/test_agent_def_field_wiring.py -qpassed, 45 testsPYTHONPATH=. uv run pytest tests/unit -qpassed, 797 passed, 4 skippeduv run ruff check .passedPYTHONPATH=. uv run mypy server/app/agent/cognition_agent.py server/app/agent/resolver.py server/app/llm/deep_agent_service.py --ignore-missing-importspassed