graphify icon indicating copy to clipboard operation
graphify copied to clipboard

[Bug]: --update stamps the manifest before Step 4, so a refused graph write is never retried

Open pedrosatin opened this issue 3 weeks ago • 1 comments

Pre-flight checks

  • [x] I have checked the Troubleshooting section in the README

What happened?

On --update, the merge block in references/update.md saves the manifest before Steps 4 to 8 run. If to_json in Step 4 then refuses the write (shrink guard or missing saved semantic nodes), the changed files are already stamped as done. graph.json keeps the old content, and the next --update reports nothing to do.

A routine edit is enough to trigger it. Renaming one Markdown section does it, even when the node count stays the same.

Expected: a refused write leaves those files queued so a retry re-attempts them. The library path already works this way: graphify/cli.py:5701-5716 exits before the manifest write.

The text is generated from these fragments:

  • tools/skillgen/fragments/references/shared/update.md:186 has the save_manifest call, and :191 says "Then run Steps 4–8".
  • tools/skillgen/fragments/core/core.md:445 has the Step 4 export that refuses, rendered at graphify/skill.md:516-520.

Steps to reproduce

  1. Build a graph through the skill on a small project that has a notes.md with a ## Gadget section.
  2. Rename that section to ## Flange.
  3. Run the --update runbook: the first three blocks of references/update.md, Part A, Part B, Part C, cp graphify-out/graph.json graphify-out/.graphify_old.json, the merge block, then Step 4 with IS_FORCE=False.
  4. Run the first block of references/update.md again.

Removing one function, and a deletion-only update, give the same result.

Error output or graph output

[graphify update] Manifest saved.       (notes.md hash 8702542586 -> 7bf086d065)
[graphify] WARNING: Refusing to overwrite — saved semantic node(s) are missing from the new graph: notes_gadget.
ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).
[exit 1]
graph.json: still has notes_gadget, no notes_flange
next block 1: "new_total": 0 ... No files changed since last run. Nothing to update.

Restoring the pre-merge manifest with the same files on disk gives new_total: 1, so the manifest write is what hides the change.

Graphify version

0.9.104 from PyPI (tag v0.9.104, 433a57a0). The default branch v8 at 6c8002ec has the same lines.

Operating System

Linux

Python Version

3.12

Installation Method

pip, in a virtual environment created with uv

Additional Environment Details

No provider environment variables were set. It reproduced in an isolated virtual environment with a clean HOME and PYTHONNOUSERSITE=1, using the PyPI wheel. The semantic chunk in Part B was written by hand, so no LLM call was involved.

Additional context

/graphify --update --force does not recover from this, because it stops at the first block, which sees no changes. Re-running Step 4 with force in the same session works, and so does a full build with --force.

Step 9 already writes the manifest on --update, so one option is to drop the early write from the merge block or move it after a successful Step 4.

Related: #3477 mentions this as a loose end and #1392 item 17 reported the deletion case, but neither fix changed the order.

pedrosatin avatar Nov 09 '26 00:11 pedrosatin

Thanks for opening this issue, @pedrosatin. 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.

github-actions[bot] avatar Nov 09 '26 00:11 github-actions[bot]