Commit d7a81fa
committed
fix: clean up extension skills across all agents on remove (#2948)
Addresses Copilot review feedback: remove() called
_unregister_extension_skills() without a directory, so its fast
path removed skill files only from the resolved active-agent
directory whenever one resolved, and never scanned the
directories of other agents whose skills were rendered via the
new multi-agent registration paths added earlier in this PR —
leaving those orphaned on the filesystem after removal.
_unregister_extension_skills() now always scans every known
agent skills directory (previously this broader scan only ran
as a fallback when no active-agent directory could be resolved
at all), in addition to any explicitly-passed or resolved
directory. Each candidate directory's matching skill
subdirectories are still verified against the SKILL.md
metadata.source field before removal, so this doesn't touch
the existing safety guarantees or the registered_skills schema
(intentionally kept as a flat, deduped list rather than a
per-agent dict, to avoid a breaking registry-schema change for
this fix).
Tests:
- Added test_remove_cleans_up_skills_for_non_active_agent,
covering removal after skills were rendered for both an
active and a non-active agent.
- pytest tests/ -k extension: 620/620 pass (619 previous + 1 new).
- git diff --check: clean.
Note: a related Copilot suggestion to also have plain
'integration install' immediately register extension
commands/skills for the newly-installed agent was evaluated but
not applied here, since it directly conflicts with the
maintainer-requested, explicitly-tested deferred-registration
design from #2886 (see
tests/integrations/test_integration_subcommand.py::TestIntegrationInstall::test_install_defers_extension_commands_until_use).
Flagging this for maintainer input rather than silently
reversing that prior decision.1 parent acab576 commit d7a81fa
2 files changed
Lines changed: 55 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1299 | 1299 | | |
1300 | 1300 | | |
1301 | 1301 | | |
1302 | | - | |
1303 | | - | |
1304 | | - | |
1305 | | - | |
1306 | | - | |
1307 | | - | |
1308 | | - | |
1309 | | - | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
1310 | 1310 | | |
1311 | 1311 | | |
1312 | 1312 | | |
1313 | 1313 | | |
1314 | | - | |
| 1314 | + | |
1315 | 1315 | | |
1316 | 1316 | | |
1317 | 1317 | | |
| |||
1365 | 1365 | | |
1366 | 1366 | | |
1367 | 1367 | | |
1368 | | - | |
1369 | | - | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
1370 | 1375 | | |
1371 | 1376 | | |
1372 | 1377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2034 | 2034 | | |
2035 | 2035 | | |
2036 | 2036 | | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
0 commit comments