fix: register enabled extensions for agent on integration install/upgrade#2949
Open
PascalThuet wants to merge 5 commits into
Open
fix: register enabled extensions for agent on integration install/upgrade#2949PascalThuet wants to merge 5 commits into
PascalThuet wants to merge 5 commits into
Conversation
…rade install and upgrade only set up the integration's own core commands; only switch re-registered the enabled extensions' commands for the target agent. A second integration added via install (or refreshed via upgrade) was therefore silently missing the extension commands the existing agents already had (e.g. the bundled agent-context extension). Extract switch's registration into a shared _register_extensions_for_agent helper and call it from install and upgrade too, so every installed agent ends up with every enabled extension's commands — full parity with switch. Closes github#2886
limitation Extension skill rendering is scoped to the active agent (init-options track a single ai / ai_skills pair), so a skills-mode agent registered while not active (e.g. Copilot --skills installed as a secondary integration) gets command files rather than skills. install/upgrade match extension add here; only switch renders skills, because it activates the target first. Add a regression test pinning this behavior and document the limitation on the shared helper. Per-agent skills parity is tracked separately in github#2948.
…-active agent register_enabled_extensions_for_agent runs an active-agent-scoped skills pass (_register_extension_skills resolves the skills dir from init-options["ai"], ignoring the passed agent). Routing install/upgrade of a secondary integration through it re-rendered the *active* skills-mode agent's extension skills as a side effect — resurrecting skill files the user had deliberately deleted. Gate the skills pass on the target being the active agent; switch is unaffected because it activates the target first. Also harden the skills-mode install test (assert a core skill so --skills is load-bearing, drop a vacuous registered_skills assertion) and add a regression test. Surfaced by review of the PR; skills parity for non-active agents stays tracked in github#2948.
…st-commit Review cleanups, no behavior change on the success path: - Extract the best-effort ExtensionManager scaffold (lazy import, instantiate, except -> _print_cli_warning) into _best_effort_extension_op. Both _register_extensions_for_agent and a new _unregister_extensions_for_agent delegate to it, removing the duplicate block left inline in switch. - Invoke the best-effort extension registration AFTER the install/switch/upgrade try/except has committed, so a failure in it can never trigger the rollback (install and switch teardown on except).
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.
What
integration installandintegration upgradeonly set up the integration's own core commands. Onlyintegration switchre-registered the enabled extensions' commands for the target agent. So a second integration added viainstall(or refreshed viaupgrade) silently lacked the extension commands the existing agents already had — e.g. the bundled agent-context extension's/speckit.agent-context.update.This wires
installandupgradeto callregister_enabled_extensions_for_agenttoo, so newly added or refreshed agents reach command-registration parity withswitch. The shared logic is extracted into a_register_extensions_for_agenthelper (best-effort: a registration failure warns via_print_cli_warningbut never aborts the surrounding install/upgrade/switch).Tests
test_install_registers_extension_commands_for_new_agenttest_install_does_not_register_disabled_extensionstest_upgrade_backfills_extension_commands_for_agenttest_install_skills_mode_secondary_agent_registers_commands(pins the behavior described below)test_upgrade_non_active_agent_preserves_active_agent_skills(regression for the side-effect below)Full suite: 3730 passed, 45 skipped locally.
Side effect fixed in review
register_enabled_extensions_for_agentruns an active-agent-scoped skills pass (_register_extension_skillsresolves the skills dir frominit-options["ai"], ignoring the passed agent). Routinginstall/upgradeof a secondary integration through it re-rendered the active skills-mode agent's extension skills as a side effect — resurrecting skill files the user had deliberately deleted. The skills pass is now gated on the target being the active agent;switchis unaffected (it activates the target first).Known limitation (tracked separately)
Extension skill rendering is scoped to the active agent (init-options track a single
ai/ai_skillspair). A skills-mode agent registered while it is not active — e.g. Copilot--skillsinstalled as a secondary integration — receives command files rather than skills here. This matches whatextension addalready does across multiple agents;install/upgradestay consistent with it.switchdiffers only because it makes the target the active agent before registering. Proper per-agent skills parity is tracked in #2948.Closes #2886