fix: self-heal agent-context extension
Description
Moves the agent-context extension repair path out of integration helpers and into the top-level CLI project startup path. Older projects now restore the bundled extension on normal CLI invocation while integration commands only update the active context config.
Fixes #2881.
Testing
uv run python -m pytest tests/test_agent_config_consistency.py -quv run python -m pytest tests/extensions/test_extension_agent_context.py::TestExtensionEnabledGate tests/extensions/test_extension_agent_context.py::TestAgentContextSelfHeal tests/integrations/test_integration_subcommand.py::TestIntegrationInstall::test_install_backfills_agent_context_extension_when_missing tests/integrations/test_integration_subcommand.py::TestIntegrationSwitch::test_switch_backfills_agent_context_extension_when_missing tests/integrations/test_integration_subcommand.py::TestIntegrationUpgrade::test_upgrade_backfills_agent_context_extension_when_missing -q
Moved this to the top-level CLI startup path in aac1f2c: non-init commands now call _self_heal_agent_context_extension(Path.cwd()), and integrations only update agent-context-config.yml.
Rebased onto current main; the branch is now mergeable. Validation passed:
uv run python -m pytest tests/test_agent_config_consistency.py -q-> 28 passeduv run python -m pytest tests/extensions/test_extension_agent_context.py::TestExtensionEnabledGate tests/extensions/test_extension_agent_context.py::TestAgentContextSelfHeal tests/integrations/test_integration_subcommand.py::TestIntegrationInstall::test_install_backfills_agent_context_extension_when_missing tests/integrations/test_integration_subcommand.py::TestIntegrationSwitch::test_switch_backfills_agent_context_extension_when_missing tests/integrations/test_integration_subcommand.py::TestIntegrationUpgrade::test_upgrade_backfills_agent_context_extension_when_missing -q-> 9 passedgit diff --check origin/main...HEAD-> exit 0
Please address Copilot feedback
Addressed the review feedback in nkgotcode/spec-kit@3196cbc.\n\nValidated locally:\n- uv sync --extra test\n- uv run pytest tests/extensions/test_extension_agent_context.py::TestAgentContextSelfHeal tests/extensions/test_extension_agent_context.py::TestExtensionConfigWriters -q\n- uv run pytest tests/integrations/test_integration_subcommand.py::TestIntegrationInstall::test_install_backfills_agent_context_extension_when_missing tests/integrations/test_integration_subcommand.py::TestIntegrationInstall::test_install_non_default_refreshes_init_options_version_only tests/integrations/test_integration_subcommand.py::TestIntegrationUpgrade::test_upgrade_non_default_refreshes_init_options_version_only -q\n- uv run specify --help
Addressed the follow-up review notes in b6d77be: self-heal now skips when the bundled extension is unavailable, restores prior config on install failure, and remains side-effect free for help output.
Validated locally:
uv run pytest tests/extensions/test_extension_agent_context.py::TestAgentContextSelfHeal tests/extensions/test_extension_agent_context.py::TestExtensionConfigWriters -q-> 14 passeduv run pytest tests/integrations/test_integration_subcommand.py::TestIntegrationInstall::test_install_backfills_agent_context_extension_when_missing tests/integrations/test_integration_subcommand.py::TestIntegrationInstall::test_install_non_default_refreshes_init_options_version_only tests/integrations/test_integration_subcommand.py::TestIntegrationUpgrade::test_upgrade_non_default_refreshes_init_options_version_only -q-> 3 passeduv run specify --help-> exit 0git diff --check origin/main...HEAD-> exit 0
Closed by #2882
Actually closed by #2885
Thank you for working on this. In spite of another PR making it in before this one. Sometimes that happens and with the influx of so many issues and PRs this sometimes happens. Again thank you!