Repository navigation
Description
Pre-flight checks
- I have checked the Troubleshooting section in the README
What happened?
Step 1 of the /graphify skill ("Step 1 - Ensure graphify is installed") saves two files that every later step depends on:
graphify-out/.graphify_python: which Python to rungraphify-out/.graphify_root: which folder is being scanned
There are two bugs around these files.
Bug 1: Step 1 reports success when it can't write them
Actual: Step 1 writes each file with open(path, 'w').write(...). Opening the file creates it right away, so when the write fails (for example on a full disk), Python prints OSError: [Errno 28] No space left on device, but the empty file stays behind and Step 1 exits 0. After that:
- Every later step runs
$(cat graphify-out/.graphify_python) -c "...", which becomes an empty command. Bash printsbash: : command not found, and nothing points back to Step 1 or the full disk. graphify updatewith no path reads the empty.graphify_rootasPath(""), which is the current directory, so it rebuilds whatever folder you're in instead of the project, without a warning.
The Windows version of Step 1 does the same: [System.IO.File]::WriteAllText throws, PowerShell prints the error, and the script keeps going.
Expected: if Step 1 can't write a file, it exits non-zero with a message naming the file (for example could not write graphify-out/.graphify_root (disk full?)), and it doesn't leave an empty file behind.
Bug 2: readers trim spaces off the saved folder name
Actual: Linux and macOS allow a folder name to end with a space, such as proj . Step 1 saves the path exactly, but graphify update (cli.py), _infer_merge_root (build.py) and both git hook scripts (hooks.py) read it back with .strip() and get proj. If a proj folder also exists, they work on that folder instead.
Expected: readers use the path exactly as Step 1 saved it. They only remove a UTF-8 byte-order mark (added by Windows PowerShell 5.1, see #3028) and a trailing newline.
Steps to reproduce
Linux, from the root of a `v8` checkout (commit `b4e6307`). No root access needed. The full disk is a private 2 MB filesystem that disappears when the command ends.
**Setup (both bugs):** save Step 1 from the skill to a script.
python3 - > /tmp/step1.sh <<'EOF'
import re
text = open("graphify/skill.md").read()
blocks = re.findall(r"\n(.*?)\n", text, re.S)
print(next(b for b in blocks if "graphify_root" in b))
EOF
**Bug 1: run Step 1 on a full disk**
unshare -rm bash -c '
mkdir -p /tmp/fullfs && mount -t tmpfs -o size=2M tmpfs /tmp/fullfs
mkdir -p "/tmp/fullfs/work/my project"
dd if=/dev/zero of=/tmp/fullfs/fill bs=64k 2>/dev/null # fill the disk
cd /tmp/fullfs/work
sed "s|^INPUT_PATH\$|/tmp/fullfs/work/my project|" /tmp/step1.sh > /dev/shm/step1.sh
bash /dev/shm/step1.sh; echo "Step 1 exit code: $?"
stat -c "%s bytes %n" graphify-out/.graphify_python graphify-out/.graphify_root
$(cat graphify-out/.graphify_python) -c "print(1)"; echo "next step exit code: $?"
'
Output:
OSError: [Errno 28] No space left on device (printed twice)
Step 1 exit code: 0
0 bytes graphify-out/.graphify_python
0 bytes graphify-out/.graphify_root
bash: line 9: : command not found
next step exit code: 127
**Bug 2: a folder name ending in a space**
mkdir -p /tmp/sp/"proj " /tmp/sp/proj && cd /tmp/sp
sed "s|^INPUT_PATH\$|/tmp/sp/proj |" /tmp/step1.sh | bash
python3 -c "
from pathlib import Path
saved = Path('graphify-out/.graphify_root').read_text(encoding='utf-8-sig')
print('Step 1 saved:', repr(saved))
print('readers get: ', repr(saved.strip()))
"
Output:
Step 1 saved: '/tmp/sp/proj '
readers get: '/tmp/sp/proj'
`/tmp/sp/proj` is a different, existing folder, so `graphify update` and the git hooks would work on it instead of `proj `.Error output or graph output
**Bug 1: what Step 1 prints on a full disk**
Python reports both failed writes, but only as "Exception ignored" while shutting down, so neither the command nor Step 1 fails:
Exception ignored in: <_io.TextIOWrapper name='graphify-out/.graphify_python' mode='w' encoding='utf-8'>
Traceback (most recent call last):
File "<string>", line 1, in <module>
OSError: [Errno 28] No space left on device
Exception ignored in: <_io.TextIOWrapper name='/tmp/fullfs/work/graphify-out/.graphify_root' mode='w' encoding='utf-8'>
Traceback (most recent call last):
File "<string>", line 1, in <module>
OSError: [Errno 28] No space left on device
Step 1 exit code: 0
What's left on disk, and what the next step prints:
0 bytes graphify-out/.graphify_python
0 bytes graphify-out/.graphify_root
bash: line 9: : command not found
next step exit code: 127
How an empty `.graphify_root` is read by `graphify update` (no path):
Path("") -> current directory
**Bug 2: the saved folder vs. what readers get**
Step 1 saved: '/tmp/sp/proj '
readers get: '/tmp/sp/proj' <- a different folder that exists
There's no graph output to show: both bugs happen before or around the graph build, by pointing it at the wrong folder or stopping it with an unclear error.
Graphify version
0.9.85 (v8 branch, commit b4e6307)
Operating System
Linux
Python Version
3.13
Installation Method
uv tool install (recommended)
Additional Environment Details
- Provider environment variables: none set (no OPENAI_API_KEY, ANTHROPIC_API_KEY, GRAPHIFY_* or similar). Neither bug involves a provider: both happen in Step 1's file writes and in the readers of
.graphify_root, before any extraction. - Clean checkout: yes. Both bugs reproduced in a fresh worktree of
upstream/v8atb4e6307, with no local changes. - OS: Fedora 43 (Linux, x86_64), bash 5.3. Bug 2 also applies to macOS. Windows doesn't allow trailing spaces in folder names, but its Step 1 has the same write problem as Bug 1 (
WriteAllTextthrows and the script continues). - Full disk was simulated with a private 2 MB tmpfs (
unshare -rm), as in the steps above. I first hit Bug 1 on a real full/tmpwhile running the test suite.
Additional context
Where the code is (line numbers on v8 at b4e6307)
Bug 1, where Step 1 writes the files. The skill text is generated from these fragments, so a fix goes here and then python -m tools.skillgen --bless:
tools/skillgen/fragments/shell/posix.mdlines 32-40: writes.graphify_pythonand.graphify_rootwithopen(...).write(...)tools/skillgen/fragments/core/aider.mdandcore/devin.md: their own copies of Step 1 (ending at lines 100 and 113)tools/skillgen/fragments/shell/powershell.mdlines 59 and 68: the Windows Step 1, writing both files withWriteAllText
Bug 2, the readers that call .strip() on .graphify_root:
graphify/cli.pyline 2552:graphify updatewith no pathgraphify/build.pyline 624:_infer_merge_rootgraphify/hooks.pylines 227 and 302: the post-commit and post-checkout hook scripts. These are templates copied into.git/hooks, so hooks that are already installed keep the old code until they're reinstalled.
How I found it
While running the test suite for #4309, /tmp filled up, because some tests create a ~168 MB home folder each. After that, test_step1_still_resolves_a_legitimate_path started failing with the repo folder where the project folder should be. The cause was Bug 1: Step 1 had left .graphify_root empty, and the test read Path(""), which resolves to the current directory.
Related
- skill.md: shell injection through
LABELS_DICTandINPUT_PATHinpython -c "..."blocks, plus three smaller robustness gaps (v0.9.84) #4309: its PR addsread_scan_root(), which reads.graphify_rootwith.strip()like the readers above. Whichever fix lands second should update it. - Windows PowerShell 5.1: Out-File -Encoding utf8 BOM in .graphify_python/.graphify_root breaks post-commit hook rebuild (WinError 123) #3028: why the readers decode with
utf-8-sig(Windows PowerShell 5.1 adds a byte-order mark). A fix should keep that.
I'm happy to send a PR for both bugs.
Activity
github-actions commentedon Oct 11, 2026
Thanks for opening this issue, @Deepjyoti-Sarmah. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
fix(paths): read_scan_root() keeps spaces in the saved root (Graphify…
test: Step 1 must not leave empty marker files; readers keep the save…
fix(skill): Step 1 fails loudly instead of leaving empty marker files (…
fix: read .graphify_root exactly, keeping spaces; stop update on an e…
fix: watch and reflect read .graphify_root exactly too (Graphify-Labs…
fix(paths): read_scan_root() keeps spaces in the saved root (Graphify…
test: Step 1 must not leave empty marker files; readers keep the save…
fix(skill): Step 1 fails loudly instead of leaving empty marker files (…
fix: read .graphify_root exactly, keeping spaces; stop update on an e…
fix: watch and reflect read .graphify_root exactly too (Graphify-Labs…
fix(paths): read_scan_root() keeps spaces in the saved root (Graphify…
test: Step 1 must not leave empty marker files; readers keep the save…
fix(skill): Step 1 fails loudly instead of leaving empty marker files (…
fix: read .graphify_root exactly, keeping spaces; stop update on an e…
fix: watch and reflect read .graphify_root exactly too (Graphify-Labs…
fix(paths): read_scan_root() keeps spaces in the saved root (Graphify…
test: Step 1 must not leave empty marker files; readers keep the save…
fix(skill): Step 1 fails loudly instead of leaving empty marker files (…
fix: read .graphify_root exactly, keeping spaces; stop update on an e…
fix: watch and reflect read .graphify_root exactly too (Graphify-Labs…
test: raise the lean-core line cap to 900