Repository navigation
fix(presets): reconcile command files after priority changes - #5113
mikamikasuki wants to merge 2 commits into
Conversation
Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
There was a problem hiding this comment.
🟡 Changes recommended
Priority changes can still produce incorrect agent artifacts for disabled presets and convention-provided command layers.
3 open issues
What changed in this PR
Addresses #5087 by refreshing generated agent artifacts when preset set-priority changes command precedence.
Changes:
- Reconciles affected commands and skills against the updated priority stack.
- Adds best-effort failure warnings and a Gemini CLI regression verifying that generated command content switches winners.
Validation relies on the reported before-and-after results; tests were not rerun.
AI disclosure: GitHub Copilot (model unknown; automated review) generated this review for the requesting contributor.
| File | Description |
|---|---|
tests/specify_cli/presets/test_command_set_priority.py |
Adds a CLI regression for generated command refresh. |
src/specify_cli/presets/command_set_priority.py |
Adds command and skill reconciliation after priority updates. |
Review effort: Max
|
Please address Copilot feedback |
Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
|
Review follow-up by @mikamikasuki with OpenAI Codex (GPT-6, autonomous). AI authored the review analysis, implementation, regression tests, and this summary. Updated priority reconciliation to include convention-based command files and to leave artifacts untouched when the target preset is disabled. Added coverage for skills-mode rematerialization and for command reconciliation failures while preserving the saved priority and constitution reconciliation. Validation: Commit: |
| # Presets may also provide conventional commands without declaring | ||
| # them in preset.yml. Include those names so a priority change can | ||
| # rematerialize the command they participate in. | ||
| convention_commands = manager.presets_dir / preset_id / "commands" | ||
| if convention_commands.is_dir(): | ||
| command_names.extend( | ||
| path.stem for path in convention_commands.glob("*.md") | ||
| ) |
| command_names.extend( | ||
| path.stem for path in convention_commands.glob("*.md") | ||
| ) |
| command_names = list(dict.fromkeys(command_names)) | ||
| if command_names: | ||
| manager._reconcile_composed_commands(command_names) | ||
| manager._reconcile_skills(command_names) |
| assert "FROZEN" in command_file.read_text() | ||
|
|
||
| with patch.object(Path, "cwd", return_value=project_dir): | ||
| result = CliRunner().invoke( | ||
| app, ["preset", "set-priority", "disabled-priority", "25"] | ||
| ) | ||
|
|
||
| assert result.exit_code == 0, result.output | ||
| assert PresetManager(project_dir).registry.get("disabled-priority")["priority"] == 25 | ||
| assert "FROZEN" in command_file.read_text() |


Description
When a preset priority changes, the resolver can select a different command layer while the generated agent command file still contains the previous winner. Reconcile the affected command and skill artifacts against the full priority stack after updating the registry.
Closes #5087
Testing
specify preset set-priorityin a temporary Gemini project and verifies the generated command switches to the new winner.AI Disclosure
AI disclosure: OpenAI Codex (GPT-6; reasoning effort not exposed in this task; autonomous); issue analysis, reproduction, code and regression-test generation, and validation.