You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(extensions): restore native outputs after a failed install - #5625
Use the existing file journal during native extension registration. If registration fails, the journal restores the files the attempt replaced and removes the outputs it created. It also removes newly created output directories when they are empty.
Ran .venv/bin/python -m pytest tests/test_extension_skills.py tests/test_extensions.py tests/specify_cli/extensions/test_skill_resources.py tests/specify_cli/extensions/test_command_add.py tests/specify_cli/integrations/test_command_switch.py tests/integrations/test_file_changes.py -q on macOS with Python 3.13. All 942 tests passed.
Confirmed the registry-failure regression fails before the journal is applied and passes afterward. Existing coverage also checks a hook registration failure and survival of unrelated user files.
AI Disclosure
I used AI assistance for this contribution.
Claude Code (Claude Fable 5, supervised, as recorded in the original commit trailer) helped develop the initial fix and regression tests. Codex (GPT-6, autonomous agent mode) integrated the journal, added rollback coverage, ran verification, and drafted this PR on behalf of @aarjang.
… add
When install_from_directory failed after command registration (hook
registration or the final registry write), the rollback removed the
installed package and registry entry but left the native skill outputs
(<skills dir>/speckit-<ext>-<cmd>/SKILL.md) and command files written
by the attempt behind. They were recorded nowhere, so no later
lifecycle operation owned them. The generic route's
rollback_generic_registration already retires its outputs; the failure
path now does the same for non-generic agents by unregistering the
commands and skills this attempt registered. Both unregister paths
only remove outputs they can verify as spec-kit's own, so user skills
are untouched.
Fixesgithub#5379
Assisted-by: Claude Code (model: Claude Fable 5, supervised)
Restore the exact output files touched by a failed native installation, including prior contents, without broad unregistration.
Assisted-by: Codex (model: GPT-6, autonomous)
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical failure path during native force reinstalls replaces recovered user configuration with packaged defaults if registry registration fails, and a plain retry does not restore the backup.
Addresses #5379 by applying the existing file journal to native extension registration, restoring replaced outputs and removing newly created outputs when installation fails.
Changes:
Wrap native registration in a rollback journal while respecting existing lifecycle transactions.
Track output-directory creation so rollback can remove newly created empty directories.
Add regressions for hook and registry failures, output restoration, and preservation of unrelated user skills.
AI-generated review for the requester by GitHub Copilot (model: unknown; autonomous).
File
Description
tests/test_extension_skills.py
Adds native-output rollback regression tests.
src/specify_cli/integrations/_lifecycle.py
Adds the extension-registration journal context manager.
src/specify_cli/extensions/__init__.py
Applies journaling to native registration and tracks skill directories.
src/specify_cli/agents.py
Uses journal-aware directory creation for command outputs and caches.
…guard
Use FileHelper for trusted root identities and keep the output publication step separate from journal setup.
Assisted-by: Codex (model: GPT-6, autonomous)
Reuse the durable kept-config recovery path for native force reinstalls so a registration failure can be retried without replacing user settings.
Assisted-by: Codex (model: GPT-6, autonomous)
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The rollback logic can lose user configuration after a failed forced reinstall, while symlinked command directories can cause installation to succeed without publishing commands.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A forced native reinstall can remove the existing installation before rejecting a symlinked config, and the output journal starts too late to restore it.
Unused nonexistent HOME blocks project-local installs
src/specify_cli/integrations/_lifecycle.py:531
Project-local native installs now fail when HOME points to a nonexistent directory: the caller includes Hermes's home scope even when another integration is active, and FileHelper(home) requires an existing root. This happens after the extension package has been copied, despite registration not needing any home output. Derive home scopes from the actual registration targets so unused home directories do not block installation.
AI-generated review: GitHub Copilot, model unknown, autonomous; entirely AI-authored for the requesting user (identity unavailable).
Add rollback tests for symlinked and home-scoped paths
src/specify_cli/integrations/_lifecycle.py:542
The new path remapping lacks rollback coverage for symlinked project roots and home-scoped outputs; the added failure tests use ordinary project-local Claude paths. Add failure-path tests for lexical/canonical project aliases and a home-scoped Hermes destination, checking restoration of existing bytes, removal of new outputs, and preservation of existing directories. These tests are needed because the remapping determines which paths rollback overwrites or deletes.
AI-generated by GitHub Copilot (model: unknown; autonomous), entirely AI-authored for the requesting reviewer.
The native install rollback and config recovery follow-ups are pushed in 3fd4a3ba. All 943 focused tests passed locally on macOS, including the retry regression for preserving user config. Ruff and the FileHelper migration check also passed.
Could a maintainer approve the pending GitHub Actions workflows for this fork PR so Test Python, Lint & Security, and CodeQL can run?
AI disclosure — Codex (GPT-6, autonomous agent mode) implemented the follow-ups, ran the local tests, and drafted this comment on behalf of aarjang.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A symlinked skills destination can leave newly created directories behind because validation happens after directory creation and rollback rejects the same path.
I pushed both earlier follow-ups in ae7faa6c. A refused output write now stops the install before the registry is committed, and force reinstall checks kept configuration before removing the existing extension. All 1,052 focused tests passed locally, along with Ruff and the FileHelper migration check.
Could a maintainer re-review the PR and mark conversations resolved once their fixes are verified? GitHub already marks the two earlier threads resolved. The new directory-creation thread remains open for review.
AI disclosure — Codex (GPT-6, autonomous agent mode) implemented the follow-ups, reran verification, and drafted this comment on behalf of aarjang.
Apply the extension journal’s existing destination checks before creating registration directories. Cover both command and native Skill layouts in the blocked-destination regression.
Assisted-by: Codex (model: GPT-6, autonomous)
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because force-reinstall cleanup can fail on directory symlinks, leaving commands and skills unregistered while the extension remains marked as installed.
The directory-creation fix is pushed in d3235b61. Extension registration now validates the output directory before creating it. The regression test covers both Claude skills and Gemini commands, and all 1,053 focused tests passed locally.
Could a maintainer re-review this change and resolve the directory-creation thread if the fix addresses the concern?
AI disclosure — Codex (GPT-6, autonomous agent mode) implemented the fix, ran the tests, and drafted this comment on behalf of aarjang.
Remove links in the old extension package without traversing their targets. Cover forced reinstall and preservation of user configuration and registered skills.
Assisted-by: Codex (model: GPT-6, autonomous)
The forced-reinstall cleanup fix is pushed in 8dfff347. Cleanup now removes a directory link while preserving its target and the user's configuration. The new regression failed before the fix, and all 1,054 focused tests passed locally afterward.
Could a maintainer re-review the fix and resolve the conversation if it addresses the cleanup concern?
Assert that a failed force reinstall preserves the original link and identifies the same settings file even when Windows reports an extended-length target.
Assisted-by: Codex (model: GPT-6, autonomous)
Pushed 9385c889. The force-reinstall regression now checks that the original symlink and its target file are preserved, including when Windows reports an extended-length path. The local run also covered the Claude and Gemini cases for the directory-creation thread, with and without an outer transaction. The 1,236 focused tests and 698 adapter tests passed locally on macOS, along with Ruff and the FileHelper migration check.
Could a maintainer approve the GitHub Actions workflows for this commit and re-review the PR?
AI disclosure: OpenAI Codex (GPT-6, Default mode, autonomous) implemented and tested the fixes and drafted and posted this update on behalf of @aarjang at their request.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A registry save failure leaves the cache marking a rolled-back extension as installed, blocking retries because the cached registry snapshot is not restored.
Scope the working-directory change to each relative-project test so it is restored before the temp_dir fixture runs. Windows cannot remove the process working directory and raised WinError 32 for four cases during teardown.
Assisted-by: Codex (model: GPT-6, autonomous)
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because a failed registry save can leave an extension marked installed in memory, blocking retries or republishing the failed entry later.
…stall
Restore the native registry snapshot when publishing fails so the same manager can retry. Cover failures before and after the registry file is written.
Assisted-by: Codex (model: GPT-6, autonomous)
Pushed 3df50a07. A failed native registry save now restores the in-memory registry so a retry can succeed with the same manager. The regression covers failure both before and after the registry write. This revision also includes 9e4ee613, which restores the working directory before temporary-directory cleanup in the Windows regression tests. All 1,237 focused tests passed locally on macOS, including the destination-directory cases.
Could a maintainer approve the GitHub Actions workflows for the new commit and re-review the PR?
AI disclosure: OpenAI Codex (GPT-6, Default mode, autonomous) implemented and tested the changes and drafted and posted this update on behalf of @aarjang at their request.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Failed-install regression coverage is missing for home-scoped outputs, including restoration of existing files, cleanup of new outputs and project markers, and preservation of unrelated files.
Verify failed registry publication restores existing home output, removes new skills and the project marker, preserves unrelated home files, and permits retry.
Assisted-by: Codex (model: GPT-6, autonomous)
Pushed 600f8911. The Hermes regression verifies that a failed registry write restores existing home-scoped skills, removes new skills and the project marker, preserves unrelated files, and allows a retry. The Claude and Gemini cases for validation before directory creation also passed. All 1,238 focused tests passed locally.
Could a maintainer approve the GitHub Actions workflows for this commit and re-review the PR?
AI disclosure: OpenAI Codex (GPT-6, Default mode, autonomous) implemented and tested the changes and drafted and posted this update on behalf of @aarjang at their request.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Interacting changes to nested rollback ownership, project/home output scopes, registry commits, and force-reinstall config recovery exceed the scope of a straightforward, limited-consequence review.
I traced both open threads to tests on 600f8911. The Claude/Gemini regression verifies that a blocked destination leaves the shared directory empty, both with and without an outer journal. The Hermes regression verifies that a registry failure restores existing home output, removes new output and the project marker, preserves unrelated files, and allows a retry. The local rerun passed all 1,238 focused tests.
Could a maintainer approve the pending workflows and re-review the two threads with these test cases?
AI disclosure: OpenAI Codex (GPT-6, Default mode, autonomous) verified the local tests and drafted and posted this update on behalf of @aarjang at their request.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
triage-must-haveVerdict: high-value, important work for Spec Kit — do first
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5379.
Use the existing file journal during native extension registration. If registration fails, the journal restores the files the attempt replaced and removes the outputs it created. It also removes newly created output directories when they are empty.
Related work is open in #5384.
Testing
.venv/bin/specify --help..venv/bin/python -m pytest tests/test_extension_skills.py tests/test_extensions.py tests/specify_cli/extensions/test_skill_resources.py tests/specify_cli/extensions/test_command_add.py tests/specify_cli/integrations/test_command_switch.py tests/integrations/test_file_changes.py -qon macOS with Python 3.13. All 942 tests passed.AI Disclosure
Claude Code (Claude Fable 5, supervised, as recorded in the original commit trailer) helped develop the initial fix and regression tests. Codex (GPT-6, autonomous agent mode) integrated the journal, added rollback coverage, ran verification, and drafted this PR on behalf of @aarjang.