Skip to content

fix(skill): aider and devin code-only --update reach the merge (#4447) - #4456

Closed
Deepjyoti-Sarmah wants to merge 3 commits into
Graphify-Labs:v8from
Deepjyoti-Sarmah:fix/4447-aider-devin-code-only
Closed

Deepjyoti-Sarmah wants to merge 3 commits into
Graphify-Labs:v8from
Deepjyoti-Sarmah:fix/4447-aider-devin-code-only

Conversation

@Deepjyoti-Sarmah

@Deepjyoti-Sarmah Deepjyoti-Sarmah commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Part of #4447: this fixes the aider and devin skills only. The 14 generated hosts are fixed by #4313, and this PR does not touch that file (tools/skillgen/fragments/references/shared/update.md) or any generated references/update.md.

Merge order: independent of #4313. Either can land first, and they touch different files. #4313 fixes the 14 generated skills, this PR fixes aider and devin. Once both are in, I'll add the 14 skills to this PR's test so all 16 are covered.

Summary

On a code-only --update the aider and devin runbooks said "run only Step 3A, then go straight to merge". Part A writes .graphify_ast.json, the merge reads .graphify_extract.json, and nothing wrote it. Part C would write it, but it reads .graphify_semantic.json unconditionally, and in these two files the Part B fast path is prose only.

aider / devin skill, code-only path

 --update, "If code_only is True"
-  run only Step 3A, go straight to merge
+  Step 3A (AST) -> Part B fast path -> Part C -> merge

 Part B, "Fast path:"
+  block writes an empty .graphify_semantic.json     (Part C reads it unconditionally)

 only-deletions guard (aider only)
-  writes graphify-out/.graphify_extract.json        (the aider merge reads ./.graphify_extract.json)
+  writes .graphify_extract.json

 commit 2 (separate bug)
 --update section
+  block writes .graphify_detect.json from .graphify_incremental.json
   (Part A reads it, Step 9 deletes it, nothing in the section wrote it again)

Three commits:

  1. fix(skill): aider and devin code-only runs reach the merge (#4447): the paragraph, the fast-path block, aider's guard path, the test, and the gen.py audit entry for these lines.
  2. fix(skill): aider and devin --update populate .graphify_detect.json: a separate bug found while testing. Fixes [Bug]: aider and devin --update never write .graphify_detect.json, so Part A fails #4455. Without it Part A fails first after any full build. It can be dropped without affecting commit 1.
  3. test(skill): keep graphify off PATH and satisfy pyright in the update test: bash runs the backticked text in Part C's comment when graphify is on PATH, which broke the test in CI. The test keeps graphify off PATH for the blocks it runs, and three Optional values are narrowed for pyright. The test checks the same things.

Plain first-time code-only builds on aider and devin also failed. The full-build text says "skip Part B entirely and go straight to Part C", and Part C then raised FileNotFoundError for the semantic file. The fast-path block fixes that when the agent runs it. The literal "skip Part B" sequence without the block still fails. Project with two .py files, detect, Part A, Part C:

unfixed (v8 fe085ced)
  aider  [Part C] exit 1  FileNotFoundError: [Errno 2] No such file or directory: '.graphify_semantic.json'
  devin  [Part C] exit 1  FileNotFoundError: [Errno 2] No such file or directory: 'graphify-out/.graphify_semantic.json'

fixed, with the fast-path block between Part A and Part C
  aider  [Part B fast path] exit 0   [Part C] exit 0  Merged: 4 nodes, 2 edges (4 AST + 0 semantic)
  devin  [Part B fast path] exit 0   [Part C] exit 0  Merged: 4 nodes, 2 edges (4 AST + 0 semantic)

fixed, same sequence without the block
  aider / devin  [Part C] exit 1  FileNotFoundError (same message as above)

Evidence

  • Before: tests/test_code_only_update_all_hosts.py on unfixed v8, 2 failed and 7 passed. The reader's unit tests are the 7; devin and aider fail at the merge:

    • devin: FileNotFoundError: [Errno 2] No such file or directory: 'graphify-out/.graphify_extract.json'
    • aider: FileNotFoundError: [Errno 2] No such file or directory: '.graphify_extract.json'

    After: 9 passed. The route the test runs is the one the rendered paragraph names, ['A', 'B', 'C', 'merge']. After the merge, Step 4 also ran on both skills (Graph: 5 nodes, 3 edges, 2 communities, graph.json labels a.py, b.py, f(), f_new(), g()).

  • Commit 2 on its own: with the detect block removed the same test fails on both skills with the --update section never wrote .graphify_detect.json; with it, 9 passed.

Merge Danger

Door: two-way. Instruction text, one new block per skill and one new gen.py audit entry per commit. No stored format changes. Reverting is one commit each.

Blast Radius: narrow. Two skills, aider and devin. Nothing in graphify/*.py changes.

Not covered

  • The 14 generated hosts. They are fix: materialize extraction for code-only incremental updates #4313's. The test file keeps the shared anchors and the windows handling, unused, with # shared hosts: add the params back once #4313 lands.
  • aider's code_exts lacks .lua and .toc, which devin has, so a Lua change makes aider's code_only False.
  • The transcribe block in aider: Step 2 writes .graphify_detect.json in the cwd but the video transcribe block reads graphify-out/.graphify_detect.json. Only the video path is affected.
  • aider keeps its .graphify_*.json in the project root, where detect_incremental scans them. A leftover .graphify_semantic.json from an interrupted run lands under new_files.code and flips code_only to False.
  • A code-only update that also deletes a file: Step 4's shrink guard (Prevent partial-chunk overwrite in --update: pre-build node-count assertion + build_merge() helper #479) refuses the smaller graph. Separate problem, not touched.
  • The "plain build" case needs the agent to run the new block. The "skip Part B entirely and go straight to Part C" sentence is unchanged.
  • Part C of every skill has backticks inside a double-quoted python -c block, for example # `graphify update` deleted it .... With graphify on PATH, bash runs that text and pastes its output into the Python source. This is why the test keeps graphify off PATH. Not fixed here: it touches the shared fragments for all hosts.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Tests or CI
  • Refactor
  • Security fix

Verification & Invariants

Invariant: when the code-only paragraph of an aider or devin runbook is followed as written, the merge reads a .graphify_extract.json that this run's Part C built from the fresh AST, and a stale .graphify_semantic.json or the semantic cache cannot reach the result.

  • tests/test_code_only_update_all_hosts.py renders the skill, reads the code-only paragraph, runs only the blocks it names (Part A, the Part B fast path if named, Part C if named, then the merge), and checks: the merge exits 0; the printed node count is the baseline plus the new function; where the merge writes the extraction, f_new() is in it and a seeded stale semantic label is not; the semantic cache files are byte-identical before and after.

  • The paragraph is read by a small reader: first mention of each step counts, code spans and clauses with a negation are dropped, and an unmapped step name raises. It has its own unit cases, including fix: materialize extraction for code-only incremental updates #4313's paragraph verbatim and the issue's second route (the merge builds from the AST file).

  • The test does not hard-code the route. A paragraph that names too little fails, which is the bug.

  • Generated or persisted state this invalidates: none. --bless rewrites only the aider and devin entries in expected/ (the other 132 are content-identical).

  • Read the CONTRIBUTING.md guide.

  • Reproduced the issue and identified the invariant.

  • Made the smallest fix necessary.

  • Added a regression test (if bug fix) or isolated boundary test.

  • Kept the PR description synchronized with the final implementation.

  • Documented any limitations / unsupported cases explicitly.

How was this tested?

Run from /var/tmp or the worktree with PYTHONPATH=/var/tmp/wt-4447-fix and the repo venv's Python, so the code under test is this branch. graphify.__file__ was checked to be inside the worktree.

python -m pytest tests/test_code_only_update_all_hosts.py -q --basetemp=/var/tmp/pt-4447-fix -p no:cacheprovider
  unfixed v8:        2 failed, 7 passed
  commit 1 only:     9 passed (with the .graphify_detect.json seed)
  both commits:      9 passed in 5.03s

python -m tools.skillgen --bless              -> blessed 134 artifact(s) into expected/.
python -m tools.skillgen
python -m tools.skillgen --check              -> check OK: 134 artifact(s) match committed output and expected/.
python -m tools.skillgen --monolith-roundtrip -> monolith-roundtrip OK: each monolith matches v8 modulo the enum unification.

python -m pytest -q --basetemp=/var/tmp/pt-4447-fix-full -p no:cacheprovider
  8006 passed, 14 skipped, 2042 warnings in 368.20s (0:06:08)

ruff check .
  All checks passed!

pyright tools/skillgen/gen.py tests/test_code_only_update_all_hosts.py
  0 errors, 0 warnings, 0 informations   (gen.py on v8: 0 errors)

# the full suite above ran at the second commit; after the third commit
# the new test file was re-run on its own with graphify on PATH:
#   python 3.13: 9 passed
#   python 3.10 (uv run --frozen): 9 passed
# CI on the final commit: test (3.10, 3.12, 3.13, 3.14), skillgen-check, pr-standards all green

Graphify-specific checklist

  • I updated generated skill artifacts (uv run python -m tools.skillgen --bless) when changing their source fragments.
  • I confirmed that AST/structural extraction remains deterministic (no ambient state dependencies like ENV variables).
  • I reviewed changes for security implications (no unsafe interpolation into shell/Python).
  • I confirmed no API keys or local-only graph data are included.
  • (If applicable) I disclosed AI authorship in my commit messages.

…Labs#4447)

On aider and devin nothing wrote .graphify_semantic.json for a code-only
run, so Part C raised FileNotFoundError, and the --update paragraph sent
the agent from Part A to a merge that reads .graphify_extract.json.

Part B now has the fast-path block, the paragraph names Step 3A, the
fast path, Part C and the merge, and aider's only-deletions guard writes
the file its merge reads.

Adds tests/test_code_only_update_all_hosts.py for the two monoliths and
a skillgen audit entry for the new lines; the 14 generated hosts are
left to Graphify-Labs#4313.
Part A reads .graphify_detect.json and Step 9 deletes it, but the aider
and devin --update sections never wrote it again, so Part A raised
FileNotFoundError after any full build.

The sections now write it from .graphify_incremental.json, as the
generated references/update.md does, with each file's own path
convention.

The test no longer seeds the file; it asserts the update section wrote
it.
@github-actions github-actions Bot added the contributor Pull request from a returning community contributor label Oct 14, 2026
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @Deepjyoti-Sarmah. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic.

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 2 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; no formal proof of the changed code.


Graphify review — findings

Fixes the code-only --update path in the aider and devin skills so it reaches the merge with this run's AST. The Part B fast path now writes an empty .graphify_semantic.json so Part C's unconditional read no longer hits FileNotFoundError, and the code_only paragraph now names the fast path and Part C, which builds .graphify_extract.json from the fresh AST result. Incremental runs also rewrite .graphify_detect.json with the changed subset in files and the full corpus in all_files, but total_files comes from the changed subset while total_words comes from the full corpus. The deletion-only branch in aider now checks for .graphify_extract.json at the cwd-relative path, which can pick up a stale extraction from a prior run. Adds a test that reads the rendered code_only paragraph, runs only the blocks it names, then runs the merge. It currently covers devin and aider; the 14 shared hosts are deferred until #4313 lands. The skillgen drift guard gains line predicates that sanction the new text in the monoliths, but some of them also accept generic lines like })) anywhere in the file.

Worth a look

  • Deletion-only update can reuse stale extraction — graphify/skill-aider.md:855 · Escalate · medium
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
  • Drift-guard predicate sanctions generic lines (code fences, import json, ", }))) anywhere in the monolith — tools/skillgen/gen.py:1290 · Escalate · medium
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 415 functions depend on the 335 functions this change touches.

Health — this change adds coupling hotspots:

  • new: test_code_only_update_follows_its_paragraph_and_merges_the_new_function() — 0 callers, 6 callees

Verification — 415 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 415 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

419 of 419 test file(s) selected (100%) via static blast radius.

Escalated to a full run for safety — the selection is not trustworthy on its own (see below). CI should run the whole suite.

  • tests/pi.test.ts — full-run-safety
  • tests/test_affected_cli.py — full-run-safety
  • tests/test_affected_defines.py — full-run-safety
  • tests/test_affected_member_seed.py — full-run-safety
  • tests/test_affected_overrides.py — full-run-safety
  • tests/test_agents_platform.py — full-run-safety
  • tests/test_alias_folding.py — full-run-safety
  • tests/test_analyze.py — full-run-safety
  • tests/test_anthropic_custom_endpoint.py — full-run-safety
  • tests/test_antigravity_install.py — full-run-safety
  • tests/test_apm_fallback_version.py — full-run-safety
  • tests/test_architecture_doc.py — full-run-safety
  • tests/test_astro_extraction.py — full-run-safety
  • tests/test_astro_import_ids.py — full-run-safety
  • tests/test_atomic_canvas_export.py — full-run-safety
  • tests/test_atomic_version_stamp.py — full-run-safety
  • tests/test_atomic_writes.py — full-run-safety
  • tests/test_backend_env_isolation.py — full-run-safety
  • tests/test_backend_extras.py — full-run-safety
  • tests/test_benchmark.py — full-run-safety
  • tests/test_benchmark_raw_graph.py — full-run-safety
  • tests/test_benchmark_real_query.py — full-run-safety
  • tests/test_blade_extractor.py — full-run-safety
  • tests/test_build.py — full-run-safety
  • tests/test_build_located_semantic_identity.py — full-run-safety
  • tests/test_build_merge_dedup_scope.py — full-run-safety
  • tests/test_build_merge_hyperedges_and_prune.py — full-run-safety
  • tests/test_build_merge_shrink_guard.py — full-run-safety
  • tests/test_builtin_global_type_refs.py — full-run-safety
  • tests/test_c_include_resolution.py — full-run-safety
  • tests/test_cache.py — full-run-safety
  • tests/test_cache_stale_import_target.py — full-run-safety
  • tests/test_callflow_html.py — full-run-safety
  • tests/test_cargo_introspect.py — full-run-safety
  • tests/test_cargo_missing_manifest.py — full-run-safety
  • tests/test_carried_hyperedge_remap.py — full-run-safety
  • tests/test_case_sensitive_resolution.py — full-run-safety
  • tests/test_charmap_encoding.py — full-run-safety
  • tests/test_chunking.py — full-run-safety
  • tests/test_cjs_module_extension.py — full-run-safety
  • tests/test_claude_cli_backend.py — full-run-safety
  • tests/test_claude_md.py — full-run-safety
  • tests/test_cli_broken_pipe.py — full-run-safety
  • tests/test_cli_export.py — full-run-safety
  • tests/test_cli_help.py — full-run-safety
  • tests/test_cloud_cta.py — full-run-safety
  • tests/test_cluster.py — full-run-safety
  • tests/test_cluster_ambiguous_scale.py — full-run-safety
  • tests/test_cluster_exclude_hubs.py — full-run-safety
  • tests/test_cobol_extractor.py — full-run-safety
  • … and 369 more

non-code file(s) changed (graphify/skill-aider.md, graphify/skill-devin.md, tools/skillgen/expected/graphify__skill-aider.md, tools/skillgen/expected/graphify__skill-devin.md, tools/skillgen/fragments/core/aider.md …) → running the full suite for safety (a code graph can't see config/fixture/data deps)

changed code file(s) with no mapped test (graphify/skill-aider.md, graphify/skill-devin.md, tools/skillgen/expected/graphify__skill-aider.md, tools/skillgen/expected/graphify__skill-devin.md, tools/skillgen/fragments/core/aider.md …) — a coverage gap or a missing link — running the full suite rather than only the selected tests

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Docs that may be stale (advisory)

…and 10 more.

· 1 grounded finding(s) anchored inline below.



@pytest.mark.parametrize("host,anchors", HOSTS)
def test_code_only_update_follows_its_paragraph_and_merges_the_new_function(host, anchors, tmp_path):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_code_only_update_follows_its_paragraph_and_merges_the_new_function()

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

… test

bash runs the backticked text in Part C's comment when graphify is on PATH, which broke the test in CI. The blocks do not need it. Also narrow three Optional values for pyright. The test checks the same things.
@safishamsi

Copy link
Copy Markdown
Member

@safishamsi safishamsi closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor Pull request from a returning community contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: aider and devin --update never write .graphify_detect.json, so Part A fails

2 participants