#2908·graphify

--update leaves stale graph nodes when files leave scan scope

Author: hopstreaxCreated Aug 20, 2026Updated Sep 28, 2026

Summary

The --update skill flow can leave stale graph nodes behind when a file remains on disk but leaves the active scan scope, for example after being added to .graphifyignore.

detect_incremental() correctly classifies the file as excluded_files, but the skill update flow only passes deleted_files to build_merge().

At the end of the update, save_manifest(..., scan_corpus=...) removes the excluded file from the manifest. This leaves the graph and manifest inconsistent, and on subsequent runs the stale graph nodes are no longer detectable through incremental manifest-based detection.

Reproduction

  1. Build a graph containing a file A.py.
  2. Confirm that A.py is present in both the graph and manifest.
  3. Add A.py to .graphifyignore while leaving the file on disk.
  4. Run the --update skill flow.

Observed:

deleted_files = []
excluded_files = [A.py]

The current skill flow passes only deleted_files to build_merge():

python
prune = list(deleted) or None

G = build_merge(
    [new_extraction],
    ...,
    prune_sources=prune,
)

As a result, A.py's existing graph nodes remain.

The subsequent manifest save uses the current scan scope and removes A.py from the manifest.

After the first update:

graph.json:
    A.py nodes still present

manifest.json:
    A.py absent

Run --update again without changing anything else.

The second run reports:

deleted_files = []
excluded_files = []

because A.py is no longer present in the manifest.

The stale A.py graph nodes therefore remain indefinitely.

Expected behavior

When a previously indexed file leaves the scan scope, its graph contribution should be removed during the same incremental update that removes it from the manifest.

The expected transition is:

included file
    ↓
file becomes excluded
    ↓
excluded_files = [A.py]
    ↓
prune A.py from graph
    ↓
remove A.py from manifest
    ↓
clean steady state

If the file is later brought back into the scan scope, it should be treated as a new file and indexed again.

CLI comparison

The CLI incremental path already includes both deleted_files and excluded_files when constructing prune_sources:

python
_prune_sources = list(deleted_files)

for _src in list(excluded_files) + graph_stale_sources:
    if _src not in _prune_sources:
        _prune_sources.append(_src)

Running the same scenario through the CLI correctly removes the graph nodes for A.py while also removing its manifest entry.

The skill --update flow does not currently mirror this behavior.

Root cause

excluded_files was introduced to distinguish files that are still alive on disk but have left the scan scope from files that have actually been deleted.

The manifest handling was subsequently updated to remove excluded files from the manifest, but the skill --update merge step continued to pass only deleted_files to build_merge().

This creates an inconsistent transition:

graph:
    A.py still present

manifest:
    A.py removed

Once the manifest entry is removed, subsequent incremental runs have no manifest record from which to discover the stale graph contribution.

Evidence

Reproduced on current v8 with a minimal corpus containing:

python
def hello():
    return "world"

Initial state:

  • A.py exists on disk
  • A.py is present in the manifest
  • A.py contributes 2 nodes to the graph

After adding A.py to .graphifyignore and running the skill update:

  • deleted_files = []
  • excluded_files = [A.py]
  • graph still contains 2 nodes sourced from A.py
  • manifest no longer contains A.py

After a second unchanged update:

  • deleted_files = []
  • excluded_files = []
  • graph still contains the 2 A.py nodes
  • manifest remains empty

The equivalent CLI flow prunes the nodes correctly.

Related

This was discovered while investigating #2870.

The original #2870 condition — incorrectly treating live files that leave the scan scope as deleted_files — is already handled by the current detect_incremental() implementation.

This issue concerns the downstream handling of those correctly identified excluded_files in the skill --update flow.