Skip to content

fix: save init options before re-registering extensions (#5321) - #5322

Open
chelsealong wants to merge 3 commits into
github:mainfrom
chelsealong:fix/codex-spec-kit-5321
Open

chelsealong wants to merge 3 commits into
github:mainfrom
chelsealong:fix/codex-spec-kit-5321

Conversation

@chelsealong

Copy link
Copy Markdown
Contributor

Description

Fixes #5321. Forced init now saves the selected integration mode before re-registering installed extensions and presets, so extension files use the selected mode.

Testing

  • Regression test: skills mode failed before the fix; skills and command modes pass after it.
  • .venv/bin/python -m pytest tests/integrations/test_cli.py tests/test_agent_config_consistency.py -q — 111 passed.
  • .venv/bin/specify --help and git diff --check — passed.
  • Ruff reported 39 findings on both the unmodified baseline and the patch.

AI Disclosure

Codex (GPT-6, autonomous mode) generated the code and tests and ran local validation. No human review or testing is claimed.

@chelsealong
chelsealong requested a review from mnriem as a code owner November 9, 2026 01:25
Copilot AI adaptive review requested due to automatic review settings November 9, 2026 01:25

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.

🟡 Changes recommended

Forced initialization can overwrite files outside the project through symlinked skill subdirectories because individual destination directories are not validated.

1 open issue
What changed in this PR

Fixes #5321 by saving the selected integration mode before forced init re-registers installed extensions and presets.

Changes:

  • Moves init-option persistence ahead of re-registration so it uses the current mode.
  • Adds regression coverage for skills and command modes when saved options are absent.
File Description
tests/​integrations/​test_cli.py Verifies forced init generates extension files only in the selected mode.
src/​specify_cli/​command_init.py Saves init options before extension and preset re-registration.

Review effort: Balanced (auto)

init_opts["ai_skills"] = True
else:
init_opts.pop("ai_skills", None)
save_init_options(project_path, init_opts)
@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Nov 9, 2026
@mnriem

mnriem commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

@mnriem mnriem added the author-awaiting Waiting on author response label Nov 9, 2026
Assisted-by: Codex (model: GPT-6, autonomous)
Copilot AI adaptive review requested due to automatic review settings November 15, 2026 11:54
@chelsealong

Copy link
Copy Markdown
Contributor Author

Thank you for identifying the destination-directory gap. Commit 6e3f8a9 validates each skill directory with the existing safe-directory helper before any directory creation or file write.

The regression reproduces an external SKILL.md overwrite on the previous head, including through specify init --here --force. With the fix, the external bytes and directory symlink remain unchanged, while ordinary extension skills still register. The extension-skills and CLI integration suites pass all 210 tests.

Posted on behalf of chelsealong. Codex (model GPT-6, autonomous) implemented the follow-up, ran the tests, and drafted this summary.

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.

🟡 Changes recommended

Symlink setup in the extension-skills and CLI tests lacks an OSError skip guard, causing failures on Windows accounts without symlink privileges before registration is exercised.

2 open issues

Review effort: Balanced (dynamic)

Comment thread tests/test_extension_skills.py Resolved
Copilot AI adaptive review requested due to automatic review settings November 15, 2026 12:19
@chelsealong

Copy link
Copy Markdown
Contributor Author

I added OSError skip guards to the directory-symlink setup in both regression tests. When symlink creation succeeds, the existing assertions still run. Both affected suites pass: 210 tests. Ruff reports 35 findings on both HEAD and the patch; git diff --check and specify --help pass.

Posted on behalf of chelsealong. Codex (GPT-6, autonomous mode) made the test changes, ran validation, and drafted this reply.

Commit: 1fe9169

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.

🔵 Needs a closer look

Reordering active-mode persistence and forced initialization introduces interacting lifecycle, file-ownership, and partial-failure effects that require broader review than a straightforward local change.

1 open issue
1 resolved since last review

Review effort: Balanced (dynamic)

@mnriem

mnriem commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author-awaiting Waiting on author response triage-must-have Verdict: high-value, important work for Spec Kit — do first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

init --force registers extensions before ai_skills is saved (skills-mode init writes command files)

3 participants