Skip to content

fix: register enabled extensions for agent on integration install/upgrade#2949

Open
PascalThuet wants to merge 5 commits into
github:mainfrom
PascalThuet:fix/2886-install-upgrade-register-extensions
Open

fix: register enabled extensions for agent on integration install/upgrade#2949
PascalThuet wants to merge 5 commits into
github:mainfrom
PascalThuet:fix/2886-install-upgrade-register-extensions

Conversation

@PascalThuet

@PascalThuet PascalThuet commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

integration install and integration upgrade only set up the integration's own core commands. Only integration switch re-registered the enabled extensions' commands for the target agent. So a second integration added via install (or refreshed via upgrade) silently lacked the extension commands the existing agents already had — e.g. the bundled agent-context extension's /speckit.agent-context.update.

This wires install and upgrade to call register_enabled_extensions_for_agent too, so newly added or refreshed agents reach command-registration parity with switch. The shared logic is extracted into a _register_extensions_for_agent helper (best-effort: a registration failure warns via _print_cli_warning but never aborts the surrounding install/upgrade/switch).

Tests

  • test_install_registers_extension_commands_for_new_agent
  • test_install_does_not_register_disabled_extensions
  • test_upgrade_backfills_extension_commands_for_agent
  • test_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_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. The skills pass is now gated on the target being the active agent; switch is 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_skills pair). A skills-mode agent registered while it is not active — e.g. Copilot --skills installed as a secondary integration — receives command files rather than skills here. This matches what extension add already does across multiple agents; install/upgrade stay consistent with it. switch differs only because it makes the target the active agent before registering. Proper per-agent skills parity is tracked in #2948.

Closes #2886

…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.
@PascalThuet PascalThuet requested a review from mnriem as a code owner June 12, 2026 04:54
…-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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: integration install/upgrade don't register extension commands for the new agent (only switch does)

1 participant