fix: self-heal agent-context extension#2882
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #2881 by ensuring the bundled agent-context extension is backfilled (installed + registered) before integration flows update agent-context-config.yml, preventing projects from ending up with an inert config file and no runnable extension.
Changes:
- Add
_ensure_agent_context_extension()to install the bundledagent-contextextension when an integration has acontext_file. - Update integration init-options/config update flow to ensure the extension exists before touching its config.
- Add integration install/switch/upgrade tests that simulate missing
agent-contextand verify it is restored.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/integrations/_helpers.py |
Ensures agent-context is installed before integration flows update its config. |
tests/integrations/test_integration_subcommand.py |
Adds regression tests asserting backfill behavior for install/switch/upgrade when agent-context is missing. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
mnriem
left a comment
There was a problem hiding this comment.
The agent-context extension should self-heal at the extension-system level — not get backfilled by integration flows. Integrations are consumers of the config API, not owners of extension lifecycle.
How it should work:
agent-contextauto-enables and self-heals at a top-level CLI hook (or duringspecify init)- Integration layer just writes to
agent-context-config.yml, assumes the extension is there - Older projects get fixed on any CLI invocation, not only on integration install/switch/upgrade
Can you move the backfill logic out of _helpers.py and into the extension system instead?
9772946 to
aac1f2c
Compare
|
Moved this to the top-level CLI startup path in Rebased onto current
|
|
Please address Copilot feedback |
|
Addressed the review feedback in nkgotcode/spec-kit@3196cbc.\n\nValidated locally:\n- |
|
Addressed the follow-up review notes in Validated locally:
|
|
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! |
Description
Moves the
agent-contextextension 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