fix: write Codex dev skills as files
Description
Fixes #2930.
specify extension add --dev created symlinked Codex SKILL.md files, but Codex currently does not load those symlinked skills. This keeps dev-mode symlinks for other agents while writing Codex SKILL.md outputs as regular files in both the agent command registration path and the extension skill registration path.
Normal non-dev installs are unchanged, and existing Copilot dev symlink behavior remains covered by the existing test.
Testing
- [x] Tested locally with
uv run specify --help - [x] Ran existing tests with
uv sync && uv run pytest - [ ] Tested with a sample project (if applicable)
Commands run:
uv run --extra test pytest tests/test_extensions.py -k "add_dev_writes_codex_skills_as_files" -q(failed before the fix, passed after)uv run --extra test pytest tests/test_extensions.py -quv sync --extra test && uv run pytest -quv run specify --helpgit diff --check
AI Disclosure
- [ ] I did not use AI assistance for this contribution
- [x] I did use AI assistance (describe below)
Codex assisted with issue scouting, code-path inspection, and local review. I reviewed the final diff and ran the listed checks locally.
Thanks for tracking this down — the bug in #2930 is real and the behavior here is correct: Codex can't load symlinked SKILL.md files, so writing them as real files is the right outcome.
My concern is with how it's special-cased rather than the fix itself. The change hardcodes agent_name == "codex" in CommandRegistrar._write_registered_output (agents.py) and selected_ai != "codex" in _register_extension_skills (extensions.py). Both are generic, agent-agnostic code paths, and we have an integration architecture specifically so per-agent knowledge lives in one declarative place. AGENT_CONFIGS is already derived from INTEGRATION_REGISTRY via _build_agent_configs(), and CodexIntegration is a clean self-contained class — "Codex can't use dev symlinks" really belongs there, not in shared plumbing. (The existing agent_name == "copilot" carve-out is the same debt; I'd rather not grow it.)
Could we route this through integration metadata instead? Roughly:
- Add
dev_no_symlink = TruetoCodexIntegrationand propagate it into the config dict in_build_agent_configs()the same wayinvoke_separatoralready is. - In
_write_registered_output, swap the string check for a metadata lookup:if not link_outputs or agent_config.get("dev_no_symlink"): - In
_register_extension_skills, replaceselected_ai != "codex"withlink_outputs and not agent_config.get("dev_no_symlink").
This follows the existing inject_name convention (opt-in flag, absent means the established default of symlinking), keeps the constraint owned by the Codex integration as the single source of truth, and means any future agent with the same limitation just sets the flag — no edits to shared code. The test you added is great and would carry over almost unchanged.
Please resolve test & lint errors
Resolved the conflict and the dev-mode regression after rebasing on current main.
The follow-up keeps the Codex no-symlink policy on integration metadata and also prevents inactive agents that share the same skills directory from overwriting Codex dev skills as symlinks.
Verified with:
.venv/bin/python -m pytest tests/test_extensions.py::TestExtensionAddCLI::test_add_dev_replaces_existing_codex_skill_symlink tests/test_extensions.py::TestExtensionAddCLI::test_add_dev_writes_codex_skills_as_files -q.venv/bin/python -m pytest tests/test_extension_skills.py -k "shared_skills_dir or codex_dev_skill_registration" -q.venv/bin/python -m pytest tests/test_extensions.py -q.venv/bin/python -m pytest tests/test_extension_skills.py tests/test_agent_config_consistency.py -q.venv/bin/python -m pytest -quv run --with ruff ruff check src/specify_cli/agents.py tests/test_extensions.py tests/test_extension_skills.py tests/test_agent_config_consistency.pygit diff --check
Please address Copilot feedback
Addressed the Copilot feedback in 42fec17.
I removed the broad suffix-based _is_extension_skill_dev_symlink() check and now only refresh the exact expected dev cache symlink for the current extension. I also added a regression test that keeps an unrelated user-owned symlink untouched.
Verified with:
.venv/bin/python -m pytest tests/test_extension_skills.py -k "codex_dev_skill_registration" -q.venv/bin/python -m pytest tests/test_extension_skills.py tests/test_extensions.py::TestExtensionAddCLI::test_add_dev_replaces_existing_codex_skill_symlink tests/test_extensions.py::TestExtensionAddCLI::test_add_dev_writes_codex_skills_as_files -q.venv/bin/python -m pytest tests/test_extensions.py tests/test_extension_skills.py tests/test_agent_config_consistency.py -quv run --with ruff ruff check src/specify_cli/extensions/__init__.py tests/test_extension_skills.pygit diff --check
Thank you!