spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

fix: self-heal agent-context extension

Open nkgotcode opened this issue 5 months ago • 2 comments

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 -q
  • uv 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

nkgotcode avatar Jun 06 '26 14:06 nkgotcode

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 passed
  • uv 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 passed
  • git diff --check origin/main...HEAD -> exit 0

nkgotcode avatar Jun 11 '26 15:06 nkgotcode

Please address Copilot feedback

mnriem avatar Jun 16 '26 20:06 mnriem

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

nkgotcode avatar Jun 17 '26 14:06 nkgotcode

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 passed
  • 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 -> 3 passed
  • uv run specify --help -> exit 0
  • git diff --check origin/main...HEAD -> exit 0

nkgotcode avatar Jun 17 '26 16:06 nkgotcode

Closed by #2882

mnriem avatar Jun 17 '26 17:06 mnriem

Actually closed by #2885

mnriem avatar Jun 17 '26 17:06 mnriem

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!

mnriem avatar Jun 17 '26 18:06 mnriem