Skip to content

fix(integrations): don't write an inert agent-context config when the extension is absent#2885

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

fix(integrations): don't write an inert agent-context config when the extension is absent#2885
PascalThuet wants to merge 1 commit into
github:mainfrom
PascalThuet:fix/2881-agent-context-backfill

Conversation

@PascalThuet

@PascalThuet PascalThuet commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #2881.

Per your review, I dropped the back-fill approach (no more auto-install on install/switch/upgrade) and cut this down to the underlying bug.

integration install/switch/upgrade go through _update_init_options_for_integration, which wrote agent-context-config.yml whenever the config file already existed and created it from defaults otherwise. A project without the extension ended up with an inert config nothing reads. It now writes that config only when the extension is actually registered (registry.is_installed("agent-context")). Nothing gets installed or back-filled, and init is unchanged.

Tests (pytest tests/extensions tests/integrations tests/test_agent_config_consistency.py): 2381 passed, 15 skipped. Added unit + end-to-end coverage for both cases (extension absent, extension present).

Left out, can split into follow-ups:

  • is_installed doesn't check the enabled flag, so a disabled-but-installed extension still gets its config updated.
  • init still writes the config if the extension install itself fails (pre-existing).

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We are phasing using agent context files completely and the extension will only be available as an opt-in for single agent install. We are NOT going to support it for multi install and it will be entirely an opt-in at 0.0.12. So please limit to scope to that

… extension is absent

integration install/switch/upgrade go through _update_init_options_for_integration, which wrote agent-context-config.yml whenever the config file already existed and created it from defaults otherwise, leaving projects without the extension with an inert config nothing reads. Write it only when the extension is registered (registry.is_installed("agent-context")). No install or back-fill on any path; init is unchanged.

Fixes github#2881
@PascalThuet PascalThuet force-pushed the fix/2881-agent-context-backfill branch from ab5ad24 to fc2d0a4 Compare June 9, 2026 11:59
@PascalThuet PascalThuet changed the title fix(extensions): back-fill agent-context extension in integration install/switch/upgrade fix(integrations): don't write an inert agent-context config when the extension is absent Jun 9, 2026
@PascalThuet

Copy link
Copy Markdown
Contributor Author

Thanks. Dropped the back-fill, so there's no auto-install on any path now. This just stops install/switch/upgrade from leaving an inert agent-context-config.yml when the extension isn't installed: the write now keys off registry.is_installed("agent-context") instead of the config file existing. init is unchanged. Can narrow it further if you'd prefer.

@PascalThuet PascalThuet requested a review from mnriem June 9, 2026 13:07

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the investigation. The scenario this addresses — agent-context config written when the extension is absent — only occurs when a user upgrades the CLI but skips the documented project update step (specify init --here --force --integration <agent>). Our upgrade guide already covers this two-step process, and the worst case is an inert YAML file that causes no harm.

Additionally, agent-context is moving to fully opt-in at 0.0.12, so adding defensive infrastructure around it is working against the direction we're heading.

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

2 participants