Skip to content

[Bug]: /graphify skill "Step 1 - Ensure graphify is installed" exits 0 and leaves empty graphify-out files when a write fails; .graphify_root readers trim folder names #4346

Open

Description

@Deepjyoti-Sarmah

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 run
  • graphify-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 prints bash: : command not found, and nothing points back to Step 1 or the full disk.
  • graphify update with no path reads the empty .graphify_root as Path(""), 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/v8 at b4e6307, 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 (WriteAllText throws 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 /tmp while 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.md lines 32-40: writes .graphify_python and .graphify_root with open(...).write(...)
  • tools/skillgen/fragments/core/aider.md and core/devin.md: their own copies of Step 1 (ending at lines 100 and 113)
  • tools/skillgen/fragments/shell/powershell.md lines 59 and 68: the Windows Step 1, writing both files with WriteAllText

Bug 2, the readers that call .strip() on .graphify_root:

  • graphify/cli.py line 2552: graphify update with no path
  • graphify/build.py line 624: _infer_merge_root
  • graphify/hooks.py lines 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

I'm happy to send a PR for both bugs.

Activity

  1. added
    bug
    on Oct 11, 2026
  2. github-actions commented on Oct 11, 2026

    @github-actions

    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.

  3. added 20 commits that reference this issue on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions