feat(foreman): wire the cross-stage contradiction detector into the reviewer path - #1675
Open
Defilan wants to merge 1 commit into
Open
Conversation
…eviewer path (defilantech#1549) The deterministic contradiction detector in cross_stage.go (contradictions + shouldEscalate) was merged and unit-tested but had no production caller; a .golangci-deadcode suppression kept CI green while the feature never ran. Wire it into the reviewer path of runLLMPath, where it can actually fire and where issue defilantech#1549's second incident landed: a reviewer asserting the branch is empty while the ground-truth diff is non-empty. The new applyCrossStageContradictionsForTask wrapper mirrors the sibling rails (applyCoderGroundingRailForTask, applyNoFunctionalChangeForTask): it builds a StageClaim from the reviewer's verdict + emptiness prose + named files and a BranchFacts from the reviewBase/reviewDiff already in scope, records every contradiction on the terminal result under crossStageContradictions, and logs each one. It is non-blocking: it never changes the verdict and degrades open on a missing diff. Also delete the cross_stage.go entry from .golangci-deadcode.yml, the proof the rail is now live: make lint-deadcode passes with the suppression gone. Add one production-path test (drives Execute -> runLLMPath -> the reviewer block) that asserts the contradiction is recorded on a non-empty branch whose reviewer claims it is empty. Verified non-vacuous via the mutation check: commenting out the call site makes the test fail. Refs defilantech#1549 Signed-off-by: Foreman Bot <chris@mahercode.io>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wires the cross-stage contradiction detector (
pkg/foreman/agent/cross_stage.go)into the reviewer path and deletes its dead-code suppression.
This is the first slice of #1549, not the whole of it. See Scope below — the
coder and gate stages are follow-up work tracked in #1674.
Why
cross_stage.goheld a unit-tested detector with zero production callers,suppressed in
.golangci-deadcode.ymlso CI stayed green while the feature neverran.
Refs #1549
How
applyCrossStageContradictionsForTaskbuilds a reviewerStageClaimfrom theterminal summary and envelope, resolves ground-truth
BranchFactsfrom thebranch the executor already cut, and runs the existing
contradictions()detector. Contradictions are logged and recorded on
Extra["crossStageContradictions"]. Records-and-logs: the reviewer's verdict isleft untouched.
It sits beside the existing rails in
runLLMPathas a smallapply*ForTaskwrapper, matching
applyCoderGroundingRailForTaskandapplyIssueClauseCoverageForTask, so that function's complexity budget isunchanged.
Scope — what this does NOT do
contradictions()implements four rules. This wiring makes two of themreachable, because it builds only a reviewer claim:
ClaimsEditsis never set on a reviewer claimRules 1 and 4 are the two halves of the incident that motivated #1549 (a coder
claiming an edit on a branch with zero commits, then a trivially-passing gate).
They need coder and gate claims, which is #1674. Calling this "wires #1549" would
overclaim, hence
Refs, notFixes.Also deferred to #1674: the issue asks to "mark the task for escalation" and
preserve both claims and the ground facts. This preserves the contradiction
strings only, and nothing escalates.
Verification
applyCrossStageContradictionsForTaskcallsite makes
TestCrossStageContradiction_WiredIntoRunLLMPathFAIL. The testconstrains the wiring, not just the detector.
make lint-deadcodepasses with 0 issues and thecross_stage.gosuppression deleted — no
//nolint, no fake reference.shouldEscalateis areal production caller (
cross_stage_wiring.go:92), not a test-only one.go test ./pkg/foreman/agent/... -count=1green; build, vet, gofmt clean."two rails added in the same place": the
.golangci-deadcode.ymlresolutionremoves
cross_stage.gowhile keeping the three entries already deleted onmain deleted, and
executor_native.gokeeps both the [FEATURE] Require per-clause coverage of the issue's stated expected behaviour #1554 clause-coveragerail and this one.
Checklist
make testpasses locallymake lintpasses locallygit commit -s) per DCOAI assistance
The implementation commit was authored by a Foreman coder agent
(Ornith-1.5-35B-A3B, in-cluster). The rebase, conflict resolution, adversarial
review and scoping above were done with Claude Code. A human owns this review
conversation.