gabriel / musehub public
fix patch fix/agent-model-staleness #2 / 2
AI Agent gabriel · 9 days ago · Jul 7, 2026 · Diff

fix: agent_model reflects most recently used model, not genesis value

Two contributing bugs, both root-caused in musehub#132: - MusehubIdentity.agent_model was seeded once at first-ever auto-provisioning and never refreshed. - The derived-agent seed query ordered by commit timestamp ascending, picking the oldest commit instead of the newest.

Adds latest_agent_model_id() as the single source of truth for an agent's current model, computed live from its most recent commit across all repos. Wired into all three read sites that previously trusted the stale identity.agent_model column: the profile page's _resolve_identity, the derived-agent fallback branch, and build_profile_manifest (used by the profiles API and MCP tool).

sha256:a0ca8d1a4c81154489ff38bd6454fe654acdc5de66e5d42ebdae4cd01b6b078f sha
+21 ~2 symbols
sha256:271692dc2fa9c8ca85c4f38a2e9df4c937fdb2feedfb07ba7902b03c5d9f1dd3 snapshot
+21
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 23 symbols
~ tests/test_agent_model_staleness.py .py 19 symbols added
+ _add_commit function async_function _add_commit L31–49
+ _utc function function _utc L27–28
+ AsyncSession import import AsyncSession L20–20
+ MusehubCommit import import MusehubCommit L23–23
+ MusehubIdentity import import MusehubIdentity L22–22
+ annotations import import annotations L15–15
+ blob_id import import blob_id L24–24
+ datetime import import datetime L17–17
+ long_id import import long_id L24–24
+ pytest import import pytest L19–19
+ timedelta import import timedelta L17–17
+ timezone import import timezone L17–17
+ test_build_profile_manifest_uses_live_model_for_agent function async_function test_build_profile_manifest_uses_live_model_for_agent L170–188
+ test_latest_agent_model_id_returns_newest_commit function async_function test_latest_agent_model_id_returns_newest_commit L58–66
+ test_latest_agent_model_id_returns_none_without_commits function async_function test_latest_agent_model_id_returns_none_without_commits L70–75
+ test_resolve_identity_derived_agent_uses_newest_commit function async_function test_resolve_identity_derived_agent_uses_newest_commit L149–161
+ test_resolve_identity_human_unaffected function async_function test_resolve_identity_human_unaffected L125–140
+ test_resolve_identity_registered_agent_falls_back_when_no_commits function async_function test_resolve_identity_registered_agent_falls_back_when_no_commits L106–121
+ test_resolve_identity_registered_agent_uses_live_model function async_function test_resolve_identity_registered_agent_uses_live_model L84–102
+ MusehubCommit import import MusehubCommit L23–23
+ latest_agent_model_id function async_function latest_agent_model_id L28–43

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:a0ca8d1a4c81154489ff38bd6454fe654acdc5de66e5d42ebdae4cd01b6b078f --body "your comment"