Skip to content

fix(graph): give the zero-results miner the same honest-failure contract - #85

Merged
Cipher208 merged 1 commit into
masterfrom
fix/zero-results-miner-silent-failure
Oct 7, 2026
Merged

Cipher208 merged 1 commit into
masterfrom
fix/zero-results-miner-silent-failure

Conversation

@Cipher208

Copy link
Copy Markdown
Owner

Same shape as the bug just fixed in miner_embedding (#84), found by grepping the file after that fix landed.

The bug

    try:
        ...
        for r in rows:
            await g.find_or_add_entity(...)
            surfaced += 1
    except Exception:
        logger.debug("zero-result surfacing failed", exc_info=True)
        return {"edges": 0}

{"edges": 0} is the value meaning "there was nothing to surface", and the reason is reported at debug, which is invisible at the level this service runs at. A failure in find_or_add_entity therefore looked exactly like a quiet night, and no trace reached memory.log.

Why it matters now

After #84, 0 means something specific: this miner looked and found no work. Leaving a second path that returns 0 on failure would make that contract a lie again — and the new per-miner log line (miner edges: layer=user ... zero_results=0) could not tell the two apart either.

The fix

The exception escapes to the handler in graph_enrich that records edges: -1 with a warning. The reachable return {"edges": 0} for "the journal had no repeated misses" stays — that one is genuine.

Scope

This was the only other swallow in the file. The remaining except Exception in graph_miners is _get_ner, which probes whether spaCy is installed: a legitimate probe, not a miner, and correctly silent.

Tests

One new: a backend failure escapes miner_zero_results. The two existing zero-result tests still pin the genuine zero (edges == 0 when the journal has one miss, >= 1 when it repeats), so the change is scoped to the failure path only.

Full suite: 2086 passed.

`miner_zero_results` had the same shape as the bug just fixed in
`miner_embedding`: one `except Exception` that returned `{"edges": 0}` — the
value meaning "there was nothing to surface" — and reported the reason at
`debug`, which is invisible at the level this service runs at. A failure in
`find_or_add_entity` would therefore look exactly like a quiet night, and the
record of what happened would not reach `memory.log`.

After the previous commit, `0` means something specific: this miner looked and
found no work. Leaving a second path that returns `0` on failure would make
that contract a lie again, and the two cases would be indistinguishable by the
new per-miner log line as well.

The exception now escapes to the handler in `graph_enrich` that records
`{"edges": -1}` plus a warning. The reachable `return {"edges": 0}` for "the
journal had no repeated misses" stays — that one is genuine.

This is the only other swallow in the file. The other `except Exception` left
in `graph_miners` is `_get_ner`, which probes whether spaCy is installed and
is a legitimate probe rather than a miner.

Test: a backend failure escapes `miner_zero_results`, alongside the two
existing zero-result tests that pin the real zero.

Full suite: 2086 passed.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: Cipher208/a-memory/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a4ac503-fe94-4392-a02f-ed72becff171
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the fix label Oct 7, 2026
@Cipher208
Cipher208 merged commit a96d803 into master Oct 7, 2026
19 checks passed
@Cipher208
Cipher208 deleted the fix/zero-results-miner-silent-failure branch October 7, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant