Repository navigation
Tighten Studio instruction-file cleanup boundaries - #7097
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the cleanup logic in studio/setup.sh to find and remove symlinks (-type l) as well as regular files for AGENTS.md and CLAUDE.md, and adds a corresponding test. The review feedback suggests improving the test's robustness by checking for bash availability on the host system and using Path.lexists() instead of Path.exists() to correctly verify symlink deletion.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| subprocess.run( | ||
| ["bash", "-c", function + '\n_remove_agent_instruction_files "$1"', "bash", str(managed)], | ||
| check = True, | ||
| ) | ||
|
|
||
| assert not instruction.exists() | ||
| assert external.read_text(encoding = "utf-8") == "external" |
There was a problem hiding this comment.
Robustness and Correctness Improvements
- Bash Availability Check: On Windows environments where developer mode is enabled (allowing symlink creation to succeed),
bashmight still be missing from thePATH. Skip tests that invoke platform-specific shells (likebash) via subprocesses when those shells are unavailable on the host system. - Symlink Deletion Assertion: Using
Path.lexists()instead ofPath.exists()is more robust for verifying symlink deletion.Path.exists()returnsFalseif the symlink is broken (i.e., its target is missing or unreadable), which could lead to false positives.Path.lexists()checks for the existence of the symlink itself without following it.
import shutil
if not shutil.which("bash"):
pytest.skip("bash is not available on this system")
subprocess.run(
["bash", "-c", function + '\n_remove_agent_instruction_files "$1"', "bash", str(managed)],
check = True,
)
assert not instruction.lexists()
assert external.read_text(encoding = "utf-8") == "external"References
- Skip tests that invoke platform-specific shells (like 'sh' or 'pwsh') via subprocesses when those shells are unavailable on the host system (e.g., using pytest.mark.skipif), or structure the test suite to run the native shell of each platform.
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Follow-up to #7096 after a full before/after installer audit.
What changed
AGENTS.mdorCLAUDE.mdas cleanup candidates in the Bash installer.node_modulestrees instead of scanning a developer's entire local source tree.Why
The original Bash helper used
find -type f, which excludes symbolic links. The audit also found that scanning all offrontendand the OXC source tree could delete an intentionally authored, untracked instruction file from a--localdeveloper checkout. The actual reproduced dependency artifact is undernode_modules, while the repository-owned i18n guide was already renamed toREADME.mdin #7096.Impact
No hardware detection, GPU selection, build flags, frontend application code, runtime paths, or CI workflows change. Cleanup still removes exact
AGENTS.md/CLAUDE.mddependency artifacts, does not follow directory links or junctions, preserves external link targets, and no longer touches unrelated source-tree files.Validation
install.sh --localbefore/after/follow-up runs completed successfully with redirected HOME, caches, Studio home, no Torch, no autostart, and a user-owned linked llama treeAGENTS.md, while the new wheel containsREADME.mdand no instruction-file entriesAGENTS.md, installedREADME.md, and left 0 instruction files