fix(agent): add per-platform skill_commands cache to prevent cross-platform leakage (#14536)#15375
Conversation
|
Thanks for the contribution. Closing in favor of #18739 which salvages #14570 — a parallel PR that actually filters per platform. The bug is that To actually fix this, the scan itself needs to rerun when the active platform changes (or the filter needs to be applied at read time). #18739 takes the rescan approach. Appreciate the thorough tests here — they'd be a good addition to that PR if you want to rebase them on top. |
|
Thanks @teknium1 — agreed our per-platform-cache tests were tied to the wrong fix and don't translate. I opened #19042 with three fresh regression tests on top of #18739, targeting code paths the existing rescan test doesn't exercise:
Test-only, +131 lines, no source changes. |
Summary
Fixes #14536.
skill_commands.pyuses a module-level_skill_commandsdict as a process-global cache. When the gateway serves multiple platforms (Telegram, Discord, Slack),get_skill_commands()returns the same dict to all. If a skill is disabled for one platform and that platform's handler removes it from the cache, the removal leaks to all other platforms sharing the same process.Changes
agent/skill_commands.py:_skill_commands_by_platform: Dict[str, Dict]for per-platform cache isolationplatformparameter toget_skill_commands()(defaults to""for backward compatibility)Validation
Targeted test:
tests/agent/test_skill_commands_platform_cache.py— 4 tests:get_skill_commandsacceptsplatformparameter_skill_commands_by_platformdict existsTested on macOS (Python 3.14).