fix(gateway): bust agent cache when model.default or model.provider changes - #37880
fix(gateway): bust agent cache when model.default or model.provider changes#37880cmhaoren-sudo wants to merge 2 commits into
Conversation
… rendering - Replace _MARKDOWN_TABLE_RE (force-text) with _SHOULD_USE_CARD_RE - Tables and fenced code blocks now render as schema 2.0 interactive cards - Add _build_card_payload() with schema 2.0 for proper table/code rendering - Add fallback chain: interactive card -> post -> plain text - Align with OpenClaw feishu plugin's shouldUseCard pattern
…hanges
When model.default or model.provider is updated via /model or
hermes config set, the Gateway's agent-pool cache signature
did not include these keys, so the cached (old-model) agent was
reused for new gateway messages.
Add ("model", "default") and ("model", "provider") to
_CACHE_BUSTING_CONFIG_KEYS so a model/provider change triggers
agent recreation.
Fixes: Feature Request NousResearch#20628 — Dynamic Model Switching for Gateway Platforms
|
The cache-busting fix ( However, the diff also includes ~80 lines of unrelated Feishu card rendering changes in
These Feishu rendering changes are a separate concern from the model cache fix. They should be in their own PR so they can be reviewed and tested independently. Bundling unrelated changes makes it harder to bisect regressions and obscures the scope of each change. Suggestion: split into two PRs — one for the |
kuangmi-bit
left a comment
There was a problem hiding this comment.
Thanks for this fix! The 2-line cache-busting change in gateway/run.py is exactly right and should merge quickly.
However, the gateway/platforms/feishu.py changes (+53/−11) introducing _SHOULD_USE_CARD_RE, _build_card_payload, and the interactive card fallback logic are completely unrelated to model cache busting. This makes the PR hard to review and likely explains why it has been sitting since June 3rd with zero reviews.
Request: Split this into two PRs:
- PR A:
gateway/run.py— the 2-line_CACHE_BUSTING_CONFIG_KEYSaddition. This is safe, small, clearly closes #20628, and can merge immediately. - PR B:
gateway/platforms/feishu.py— the interactive card rendering refactor. This deserves its own review and testing cycle.
Also worth noting: this fix handles model.default and model.provider, but config changes to tools, skills, platforms, toolsets, and other sections still require a gateway restart. That broader config hot-reload problem is tracked in #47058 and would benefit from a similar approach — expanding _CACHE_BUSTING_CONFIG_KEYS to cover more config sections.
Once split, happy to approve the cache-busting PR.
|
Thanks for the focused cache analysis. This is an automated hermes-sweeper review; current
The earlier review correctly identified the unrelated Feishu rendering commit; that code targeted the former |
Problem
When
model.defaultormodel.provideris updated via/modelorhermes config set, the Gateway's agent-pool cache signature did not include these keys. The cached (old-model) agent was reused for new gateway messages, requiring a manual Gateway restart to pick up the change.Closes Issue #20628 — Dynamic Model Switching for Gateway Platforms.
Fix
Added
("model", "default")and("model", "provider")to_CACHE_BUSTING_CONFIG_KEYSingateway/run.py. Now when either config key changes, the cache signature is invalidated and a new agent is created with the updated model/provider.Testing
/modelvia Feishu now takes effect immediately without Gateway restart