Repository navigation
fix(init): keep other installed integrations on re-init - #5536
Conversation
`specify init --here --force --integration <key>` wrote `.specify/integration.json` with only the selected integration, so a project with two integrations lost the other one's entry and settings. Its files and manifest stayed on disk, but `integration status` no longer listed it, and `integration upgrade <other>` exited 1 with "Integration '<other>' is not installed". docs/upgrade.md gives this command as the fallback for refreshing project files. Read the existing state first, keep its installed integrations and their settings, and refresh only the selected integration's setting and the default. Assisted-by: Codex (model: gpt-6.1-sol, autonomous) Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
There was a problem hiding this comment.
🟡 Changes recommended
Re-initialization without integration options retains stale settings for the selected integration, causing a later upgrade to restore behavior contrary to documented replacement semantics.
1 open issue
What changed in this PR
This PR fixes Specify CLI re-initialization so refreshing one integration does not make other installed integrations disappear from project state.
Changes:
- Preserve installed integration keys and other integrations’ settings while updating the selected integration and default.
- Add regression cases for selecting the default, another installed integration, or a new integration, checking retained files, status, and upgrade behavior.
Review and summary generated by GitHub Copilot (model unknown; autonomous) for the requesting reviewer (identity unavailable). Tests were not run during this review.
| File | Description |
|---|---|
tests/specify_cli/test_command_init.py |
Adds parameterized regression coverage for preserving integrations during re-init. |
src/specify_cli/command_init.py |
Reads existing integration state and retains installed keys and settings during re-init. |
Review effort: Balanced (adaptive)
|
Please address Copilot feedback |
…ration Re-init kept the other installed integrations by starting from the stored settings, but that also kept the selected integration's old options: re-initializing Claude without `--integration-options` after `--no-model-invocation` left `no_model_invocation: true` in state, and the next upgrade applied it again. Rebuild the selected integration's setting from the options passed to init, as docs/integrations/claude.md describes, and keep the others. Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
|
Fixed in 9685f2a. Re-init now rebuilds the selected integration's setting from the options passed to it, as New test Full suite: 17427 passed, 308 skipped, and the same path-length failure in Drafted on behalf of @kartsan03 by Claude Code (model: claude-opus-5-5, autonomous); it also wrote the change and ran the tests. |
There was a problem hiding this comment.
🔵 Needs a closer look
Retaining installed integration keys interacts with re-init and external-lifecycle package cleanup, creating upgrade/uninstall implications that require broader review.
No open issues 🎉
1 resolved since last review
Review effort: Balanced (adaptive)
|
Thanks for addressing the options-reset issue. The deeper review found no blocking defect at Drafted for @mnriem by GitHub Copilot (model: gpt-6.1-sol, autonomous review and test execution; human review pending). |
Before the fix, re-init dropped an installed external adapter's key, and the lifecycle cleanup then removed the adapter's package. Add regressions: a re-initialized default keeps the adapter's package, setting and generated files; the adapter still upgrades and uninstalls; and uninstalling the default falls back to it. Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
|
Added in 051736e (tests only). The three new tests in
With Full suite: 17430 passed, 308 skipped, and the same path-length failure in Drafted on behalf of @kartsan03 by Claude Code (model: claude-opus-5-5, autonomous); it also wrote the tests and ran them. |
There was a problem hiding this comment.
🔵 Needs a closer look
Preserving the installed set during re-init affects external-package retention, later upgrades and uninstalls, and default fallback, requiring cross-command lifecycle analysis beyond a limited local review.
No open issues 🎉
Review effort: Balanced (adaptive)
There was a problem hiding this comment.
🔵 Needs a closer look
Preserving multi-integration state affects external package retention, upgrades, uninstalls, and default fallback, creating interacting lifecycle consequences beyond the limited scope of conservative automated approval.
No open issues 🎉
Review effort: Balanced
|
Thank you! |

Description
specify init --here --force --integration <key>forgets every other installed integration. It rewrites.specify/integration.jsonwith only the selected key ininstalled_integrationsand only its entry inintegration_settings. The other integration's files and manifest stay on disk, butintegration statusno longer lists it.integration upgrade <other>andintegration uninstall <other>both exit 1 withIntegration '<other>' is not installed., so the CLI can no longer refresh or remove those files.docs/upgrade.mdgives this command as the fallback for refreshing project files, anddocs/integrations/cli.mddocuments installing more than one integration, so a project with two integrations hits this the first time it uses the fallback.Repro:
specify init proj --integration claude --ignore-agent-tools --non-interactive --script sh cd proj specify integration install codex --script ps specify init --here --force --integration claude --ignore-agent-tools --non-interactive specify integration upgrade codexmain(a4d5712)installed_integrations["claude"]["claude", "codex"]{"script": "ps", "invoke_separator": "-"}.agents/skills/integration upgrade codexError: Integration 'codex' is not installed., exit 1integration uninstall codexI found it by following the upgrade guide on projects created with the released 0.16.5, 1.0.13, 1.1.3 and 1.2.6. All four behave the same, and so does a project created with
main.The fix: init reads the existing state with
try_read_integration_json(), keeps its installed integrations and their settings, and updates only the selected integration's setting and the default. The selected integration's setting is rebuilt from the options passed to init, asdocs/integrations/claude.mddescribes ("Re-runningspecify initlikewise stores only the options passed to it"), so a re-init without--integration-optionsclears the ones stored before. A state file that can't be read still stops the run in the rollback journal, as onmain. When the selected integration is a new one, it goes into the list next to the ones whose files are already on disk.Testing
Set up this checkout's
.venvand editable install using the local development guide. Run commands from the checkout root..venv/bin/specify --help(Windows PowerShell:.\.venv\Scripts\specify.exe --help).venv/bin/python -m pytest tests -q(Windows PowerShell:.\.venv\Scripts\python.exe -m pytest tests -q); use affected test paths for focused checks andLC_ALL=en_US.UTF-8on macOSNew tests:
tests/specify_cli/test_command_init.py::test_reinit_keeps_other_installed_integrations: a Claude project with Codex installed is re-initialized with Claude (the default), Codex (the other installed one) or Gemini (a new one). The test checksinstalled_integrations, the default, the kept integration's setting, that the kept integration's manifest and files are unchanged byte for byte,integration status --json, and thatintegration upgradeof the kept integration succeeds. With the source reverted tomain, all three cases fail (assert ['claude'] == ['claude', 'codex'], and the same for the other two).tests/specify_cli/test_command_init.py::test_reinit_stores_only_the_options_passed_to_it: Claude installed with--no-model-invocationand Codex with--skills, then a re-init with Claude and no options. Claude's setting must equal a freshinit --integration claude, and Codex keeps--skills. It fails on 72c4a17 (the old options stay) and onmain(Codex's setting is gone).tests/specify_cli/integrations/test_installed_adapters.py, three tests for an external (catalog) adapter installed beside Claude, then a re-init with Claude:test_reinit_keeps_installed_external_adapter: the adapter stays installed with its setting and record, and its package, manifest,packages.jsonand generated skills are unchanged byte for byte.test_reinit_keeps_external_adapter_upgradeable_and_uninstallable:integration upgradeto 2.0.0 and thenintegration uninstallof the adapter both succeed, and the uninstall removes its package and files.test_uninstalling_reinitialized_default_falls_back_to_external_adapter:integration uninstall claudeselects the adapter as the new default.With the source reverted to
main, all three fail: re-init drops the adapter's key, and the lifecycle cleanup removes its package.Full suite on Linux, Python 3.13, with PowerShell 7.6 on PATH: 17430 passed, 308 skipped, 1 failed (
pytest -n 2, 15 min). The failure,test_version_execution.py::TestWindowsUvToolEnvironment::test_non_windows_uv_tool_dry_run_still_previews_installer, fails the same way onmainhere: Rich wraps the dry-run output where my venv path is long. Ruff 0.15.0 (ruff check src tests) passes. I haven't run it on Windows or macOS.AI Disclosure
AI disclosure: Codex CLI (model: gpt-6.1-sol, reasoning effort xhigh, autonomous, offline sandbox) found the bug while running the steps in
docs/upgrade.mdon projects created by older releases, and wrote the fix and the test. Claude Code (model: claude-opus-5-5, autonomous) switched the state read to the non-raising helper, changed the test to use the statemainwrites, reran the repro with the real CLI onmainand on the branch, ran the full suite and lint, and drafted this description. After the Copilot review, Claude Code (model: claude-opus-5-5, autonomous) reset the selected integration's options on re-init, added the test for it and reran the full suite. After the maintainer review, Claude Code (model: claude-opus-5-5, autonomous) added the external adapter tests and reran the full suite. Each commit carries itsAssisted-by:trailers.