Skip to content

fix: backfill agent-context extension for integrations#2882

Open
nkgotcode wants to merge 1 commit into
github:mainfrom
nkgotcode:fix/2881-agent-context-backfill
Open

fix: backfill agent-context extension for integrations#2882
nkgotcode wants to merge 1 commit into
github:mainfrom
nkgotcode:fix/2881-agent-context-backfill

Conversation

@nkgotcode

Copy link
Copy Markdown

Description

Backfills the bundled agent-context extension before integration install, switch, and upgrade flows write agent-context-config.yml. This keeps recovered or older projects from ending up with only the config file and no runnable agent-context extension files.

Fixes #2881.

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv run python -m pytest tests/integrations/test_integration_subcommand.py tests/extensions/test_extension_agent_context.py tests/test_agent_config_consistency.py -q
  • Tested with a sample project: initialized Copilot, removed .specify/extensions/agent-context plus its registry entry, then ran specify integration upgrade copilot --script sh --force and verified the extension files and config were restored.

Validation output:

uv run specify --help
Usage: specify [OPTIONS] COMMAND [ARGS]...
Commands: init, check, version, self, extension, preset, integration, workflow

uv run python -m pytest tests/integrations/test_integration_subcommand.py tests/extensions/test_extension_agent_context.py tests/test_agent_config_consistency.py -q
128 passed in 12.62s

sample backfill OK: .github/copilot-instructions.md

AI Disclosure

  • I did use AI assistance (describe below)

This fix was prepared and validated with AI-assisted coding-agent support under human-operated OSS factory workflow controls.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bundled agent-context extension when an integration has a context_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-context and 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

Comment on lines 344 to +348
# Update the agent-context extension config BEFORE init-options.json
# so a failure here doesn't leave init-options partially updated.
ext_cfg_path = project_root / _AGENT_CTX_EXT_CONFIG
if integration.context_file:
_ensure_agent_context_extension(project_root)
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]: agent-context extension is only installed by 'specify init' — other paths write an inert config that stops updating context files at v0.12.0

3 participants