Skip to content

Oracle step 5: follow findings from one run to the next - #57

Merged
joshsiaw merged 2 commits into
mainfrom
oracle-step5
Nov 27, 2026
Merged

joshsiaw merged 2 commits into
mainfrom
oracle-step5

Conversation

@joshsiaw

Copy link
Copy Markdown
Contributor

Summary

Step 5 of Oracle's build order: each run is compared with the previous one. Every open finding comes out as new, still open, fixed, guarded or broke, and keeps one id across runs. Design: Step 5 in agents/oracle/DESIGN.md.

The first live runs showed why this can't be a simple diff:

  • Findings are rewritten from scratch each run. Fingerprints by file set matched only 3 of 82–92 findings across two runs of the same commit.
  • One run sees about two thirds of what is there, so a finding missing from a run has usually not been fixed: the run just didn't see it.

How it works

  1. Match by meaning. One model call (prompts/compare.md, no tools) pairs the previous run's open findings with this run's. A paired finding keeps its id.
    • Several earlier findings matched to one current finding are duplicates: the oldest id is kept and the others are marked merged.
    • One earlier finding matched to several current ones keeps its id on the first; the others are split, with new ids.
  2. Look at the code before closing. An earlier finding that wasn't found again is carried forward as open if none of its files changed (no model call). If one did, a re-check (prompts/recheck.md, tree tools) reads the places as they are now and returns still_open, fixed, guarded, broke or unsure.
  3. Never falsely fixed. Only a re-check closes a finding. If the changed files can't be determined, every unmatched finding is re-checked. If matching or a re-check fails, or the spending cap stops it, those findings stay open and the run reports why.

Ids are a finding's fingerprint in the run that first saw it, made unique against every id ever issued (issued_ids, closed findings included). They never change, so step 6 can use them to label pull requests.

Backlog. A run's open set is its findings plus changes.json → carried, so weekly runs build up coverage instead of dropping what each run missed.

Changed files are the difference between the previous commit and the tree on disk, relative to the target. Oracle's own shallow clone fetches the previous commit one deep. A local folder target is only read and never fetched into, even if it is a shallow checkout.

Output

  • changes.json: the previous run, the outcome for each earlier finding, the change for each current finding, the carried backlog, issued ids and counts. The counts are also in run.json → changes, for the dashboard summary later.
  • report.md gains a Since the previous run section: broken agreements first (they are bugs now), then fixed, guarded and carried.
  • previousRun() takes needs, so a run that crashed before writing findings is never used as the previous run.
  • prompt_version is bumped to 2026-11-25.

Testing

  • npm test: 674 tests, 668 pass, 0 fail, 6 skipped (unchanged). 26 new tests: matching, merge and split, id uniqueness, carry and re-check, every failure path, and changed files against real temporary git repos (shallow clones, subfolder targets, uncommitted edits, odd file names, no fetch into a local folder).
  • npm run build leaves dist/ unchanged (agents are not bundled yet).
  • An independent review found two bugs, both fixed with tests in the second commit: a shallow local folder was fetched into, and subfolder targets saw no changes.

Not yet done

  • Matching quality on real findings. The compare prompt still needs checking against a hand-reviewed reference (two runs of one commit, 48 pairs) before the first scheduled runs.
  • Remote mode, the dashboard summary and step 6 come next, as in Build order.

🤖 Generated with Claude Code

joshsiaw and others added 2 commits November 25, 2026 16:29
Each run rewrites its findings and sees about two thirds of what is there,
so findings are paired with the previous run's by meaning (one model call),
a paired finding keeps its id, and an earlier finding not found again is
carried forward as open unless one of its files changed — then a re-check
reads the code and may close it as fixed, guarded or broke. Nothing is
closed without that re-check; if matching or a re-check fails, the findings
concerned stay open. Writes changes.json; the report gains "Since the
previous run". A local folder target is never fetched into.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fetch the previous commit only into Oracle's own clone: a local folder
  target that is itself a shallow checkout was fetched into.
- Changed files relative to the target (--relative), so a target inside a
  bigger repository sees its changes; against the tree on disk, so a local
  folder's uncommitted edits count; -z so unusual file names are not quoted.
- Places naming a folder, a line anchor or a quoted path match the files
  that changed.
- Ids are unique against every id ever handed out (issued_ids), closed
  ones included, so a closed finding's id is never reused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshsiaw

Copy link
Copy Markdown
Contributor Author

Matching quality check on real findings (the open item in the description).

Input: two runs on one commit of a ~3,000-file TypeScript monorepo, 92 and 82 findings, plus 48 reference pairs judged separately earlier. A Sonnet agent was given only prompts/compare.md and the exact positional listing the pipeline sends; it never saw the reference.

  • All 48 reference pairs found (recall 100%). It made 55 pairs in total.
  • I read the 7 extra pairs by hand: 1 right (the reference missed it); 4 fair, where one finding is a wider or narrower version of the same agreement, which the prompt allows; 1 borderline; 1 wrong (same files, different agreement).
  • So 53–54 of 55 pairs are defensible. A wrong match makes a new finding read as "still open" under an old id. It neither loses nor closes anything.

Prompt left as is. In real runs, watch for matches between findings on the same files for different reasons.

@joshsiaw
joshsiaw added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 24f97f4 Nov 27, 2026
5 checks passed
@joshsiaw
joshsiaw deleted the oracle-step5 branch November 27, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants