Skip to content

fix(pre-pr-review-wts): stop false-positive finding-beads (po-formulas-software-dev-8q5)#22

Open
ryanholtschneider2 wants to merge 1 commit into
mainfrom
agentic-po-formulas-software-dev-8q5
Open

fix(pre-pr-review-wts): stop false-positive finding-beads (po-formulas-software-dev-8q5)#22
ryanholtschneider2 wants to merge 1 commit into
mainfrom
agentic-po-formulas-software-dev-8q5

Conversation

@ryanholtschneider2

Copy link
Copy Markdown
Owner

What & why

pre-pr-review-wts filed 13 P1 false-positive finding-beads across one epic series (po-formulas-software-dev-8q5) — every one a false positive, a stale finding the agent already fixed, or a cross-retry duplicate. Three independent root causes, all fixed in wts/po_formulas_wts/pre_pr_review.py (backend-agnostic; verified on the current beads-rust backend).

3a — timing / quiescence gate

A new gate blocks the run early (validation=blocked, no finding-beads) when the worktree still has uncommitted tracked changes or any epic child is still open. The cumulative review now only runs against the final, committed state — so it can't file findings the agent will (or already did) resolve in a later commit. _quiescence_block_reason / _worktree_dirty_paths / _open_child_ids.

Chose the gate over reordering epic_wts because epic_finalize closes the epic; filing child finding-beads after the epic is closed would be wrong.

3b — dedup across retries

po retry / a fresh epic-wts re-discovered the same findings and re-filed identical beads with new ids. _file_findings_as_beads now skips a finding whose constructed [source] title already exists as an open child of the epic (the title is the signature — beads-rust has no finding-key metadata), and dedups within a batch. _existing_open_finding_titles.

3c — tool-errors must not masquerade as data-findings

  • _baseline_checkout is now lossless: git stash create only snapshots, so the old code's git checkout aborted on a dirty tree. It now git reset --hard HEAD (restored via stash apply in finally) before checkout, and raises the actual git error if checkout still fails.
  • A failed cumulative-diff computation surfaces the real git error as the pillar-2 verdict (could not compute cumulative diff: …) with no findings, instead of writing an empty diff the agent reports as "zero work".

Tests

11 new unit tests (each fix + its error paths); all existing pre_pr_review tests stay green. 26 pre_pr_review + 111 full wts unit tests pass; ruff clean.

Closing the loop (real-setting, no mocks)

  • Drove the real pre_pr_review flow against a genuinely dirty worktree → validation=blocked, accurate reason, bead_ids=[].
  • Exercised _baseline_checkout in a real temp repo with the exact incident shape (dirty tracked file) → checkout no longer aborts, baseline checked out, uncommitted edit losslessly restored.

Evidence: .planning/software-dev-agentic/po-formulas-software-dev-8q5/review-artifacts/close-the-loop.md.

…s-software-dev-8q5)

pre-pr-review-wts filed 13 P1 false-positive finding-beads across one epic
series. Three independent root causes, all fixed in pre_pr_review.py
(backend-agnostic; verified on beads-rust):

3a — quiescence gate: block early (validation=blocked, no finding-beads) when
the worktree has uncommitted tracked changes or any epic child is still open,
so the cumulative review only runs against the final committed state.

3b — dedup across retries: skip a finding whose bead title already exists as an
open child of the epic (title is the signature; beads-rust has no finding-key
metadata), and dedup within a batch.

3c — tool-errors stay tool-errors: _baseline_checkout now cleans the tree
(git reset --hard, lossless via stash snapshot) before checkout so a dirty
worktree no longer aborts it; a failed cumulative-diff computation surfaces the
real git error as the pillar-2 verdict instead of an empty diff the agent reads
as "zero work".

Adds 11 unit tests covering each fix and its error paths.
@ryanholtschneider2
ryanholtschneider2 marked this pull request as ready for review June 14, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant