Repository navigation
fix(close): close automation reads typed fields and exact labels, not prose judges - #1774
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe branch replaces wording-based close decisions with structured review fields, verified fixing-PR sources, and exact security labels. Example: Apply processes an old duplicate-close report without a typed canonical PR
Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains useful and is not implemented on current main. No actionable patch defect was found, and the updated evidence resolves the previous stored-report compatibility blocker. Priority: P2 Before mergeNone. FindingsNone. Provenance
Tests
Agent review detailsHow this fits togetherClawSweeper saves model reviews as reports, then checks current GitHub state before applying eligible close proposals. These changes govern how reports identify replacement PRs and pass close safeguards. flowchart TD
A[Model review] --> B[Stored review report]
B --> C[Structured canonical and fixing PR fields]
C --> D[Live GitHub eligibility checks]
D --> E[Model coverage decision]
E --> F[Final freshness and protection checks]
F --> G[Keep open or close]
Technical reviewBest possible solution: Keep model judgments in structured fields while preserving live replacement, provenance, protection, and freshness checks. Do we have a high-confidence way to reproduce the issue? Not applicable as a policy refactor; source and the supplied main/head comparison establish the changed close decisions. Is this the best way to solve the issue? Yes: existing structured fields replace competing semantic judges, and current GitHub eligibility and freshness safeguards remain. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ef343c0d9cd8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 8, 2026, 7:35 PM ET / 23:35 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What
Close automation now decides only from typed model fields, GitHub facts, and exact labels. This PR deletes every close-path code judge of LLM work in inventory batch C.
clawsweeper-close-decision.ts: deletecloseDecisionHasKeepOpenContradiction(the/^\s*Keep open\s*:/veto on model prose). DeletehasImplementationHistoryEvidenceandhasImplementationReleaseStateEvidence(git blame/log and release/tag/changelog keyword checks on evidence prose). The typed checks stay: evidence with file+sha,fixedSha,fixedRelease/fixedAt, and a GitHub-verifiedfixedPullRequest.pr-close-coverage-proof.ts: delete the word-count and stopword "concreteness" judge that changed a modelcoveredresult tokeep_open. Acoveredresult now changes only when a required field is empty oruniqueSourceWorkis not empty.promotion-facts,review-comment-state,repair/workflow-utils. A canonical PR now comes only fromrootCauseCluster.canonicalRef, or from a fixing PR with high confidence and a GitHub-verified source. The durable comment binds to a canonical PR only through its renderedCanonical:line. The prose PR-ref helpers that are now unused are deleted.fixed_pr_sourcesubstring checks (startsWith/includes("GitHub ")) in close-decision, apply-close-execution and apply-decision-workflow become an exact set. The newFixedPullRequestSourcetype lists the 4 sources the runtime writes. An unknown value maps toreport metadata, which fails closed.label.includes("security")in item-policy, apply-guard-policy, close-decision and repair comment-router-core becomes the exact setSECURITY_PROTECTED_LABEL_NAMES(7 labels, trimmed and lowercased).duplicate_or_supersededmust setrootCauseCluster.canonicalRef.REVIEW_POLICY_VERSIONis now2026-10-08-policy-v35.Why
Maintainer rule: code never judges LLM work; it only validates structure and enforces hard boundaries. Inventory batch C items: the Keep-open veto, the evidence provenance regexes, the supersession keyword regex, the coverage-proof concreteness judge, the
fixed_pr_sourcesubstring checks, and thelabel.includes("security")substring match.Behavior changes (maintainer-approved)
duplicate_or_supersededPR close needs a typedcanonicalRefor a verified fixing PR. Otherwise the PR stays open, with reasonduplicate/superseded PR close has no rootCauseCluster.canonicalRef. Before, a close with no keyword-linked PR ran with no coverage proof. Code promotions writepr_close_requires_canonical_pr: false. This flag replacespr_close_coverage_proof_fallback_refs. The no-diff promotion also clears the typed candidates, so GitHub's zero-file diff alone decides that close.Proof
Real duplicate closes. I scanned 400 closed, unmerged openclaw/openclaw PRs that ClawSweeper commented on with "superseded" (closed after 2026-09-01). 3 of them have a durable
clawsweeper-verdict:close reason=duplicate_or_supersededcomment:Canonical:#111277. The old keyword matcher also picked up the keyword-signaled refs #130804 and #146127, so the old path could gate this close on unrelated PRs. The new path uses only #111277.Canonical:#149992. Same result before and after.Canonical:#118755. Same result before and after.All 3 real duplicate closes carry a typed canonicalRef, so the fail-closed rule removes none of them.
Security labels. I listed live labels whose name contains "security" in openclaw/openclaw, clawhub, clawsweeper, fs-safe, openclaw-facetime, openclaw-enterprise and crabbox with
gh label list. Result:security,area: security,impact:security,security-review-required,security-sensitive-changed,merge-risk: 🚨 security-boundary,clawsweeper:needs-security-review. All 7 are in the set, so no live label loses protection.fixed_pr_source.git log -pover src shows that only 4 sources were ever written: "GitHub closing PR reference", "GitHub commit PR lookup", "GitHub linked-issue current closing PR", "GitHub reviewed implementation landing". These are exactly the verified set.Tests. 218/218 close-path tests pass after the rebase on fix(review): stop code from rewriting model findings, ratings and proof status #1773 (close-reasons, coverage proof, duplicate proof, supersession safety, promotion, runtime budget, repair workflow-utils).
pnpm run lintpasses. Before the last rebase,pnpm run checkpassed 6929 tests. The 3 runtime-budget failures in that run are fixed.target-dispatcher-workflowandsetup-codex-actionfailed under the parallel check load, but both pass 26/26 alone and on main.Tests: deleted 23 tests that pinned removed heuristics (prose PR-ref parsing, the Keep-open veto, provenance keywords, the concreteness judge). Rewrote about 35 fixtures to use a typed canonicalRef or an exact label. Added 2: "model covered decision trusted regardless of wording", and "a prose-only canonical PR fails closed".
Stored data compatibility
Where the old flag can exist. On main, only the no-diff and stale promotions (
upgradeNoDiffPullRequestReportandupgradePullRequestClosePromotionReport) writepr_close_coverage_proof_fallback_refs. Apply then persists the promoted report, so a storeditems/<n>.mdcan carrydecision: close,close_reason: duplicate_or_superseded, the old flag set tofalse, and no typed canonical PR. Stored records live in the canonical record store (scripts/hydrate-state.tsreads them withCLAWSWEEPER_RECORDS_SECRET). That secret is not available here, so I could not list the live records that carry the flag. No saved report under~/Developer/.agents/handoffs/clawsweeper-review-qualityor/tmpcarries it. The run below therefore uses the exact shape that main's no-diff promotion writes.Behavior with the old flag (branch). The report loads with no error. This branch never reads the old key and treats it as an unknown front-matter field. The close fails closed: apply reports
kept_openwithduplicate/superseded PR close has no rootCauseCluster.canonicalRef; refusing duplicate/superseded auto-close, and makes no close, no close-applied comment and no coverage-proof call. The PR stays open until a new review of it (scheduled or@clawsweeper re-review) writes a report with the typedrootCauseCluster.canonicalRef. A new review report (case b) closes the same as on main.Controlled apply run. I ran the shipped CLI
node dist/clawsweeper.js apply-decisions --target-repo openclaw/openclaw --apply-kind all --limit 10 --processed-limit 1 --close-delay-ms 0from two builds:ef343c0d9, a Worktrunk worktree on origin/main, built withpnpm run build.70627b7d1.ghis the repo's recording stub (promotionGhMockfromtest/helpers.ts). In the stub, PR #400 is merged and PR #349 is the stored report. Codex is the repo's coverage-proof stub (withMockCodexProof), which returnscovered. Nothing reached GitHub. I ran each case in--dry-run(the mode the repo's own close tests assert on) and in live mode against the stub.--dry-runresultfalse, no prose PR link, no typed canonical PRef343c0d9closed: "would close as duplicate or superseded; would post close-applied comment"skipped_changed_since_review)issue edit 349 --add-label "rating: 🌊 off-meta tidepool";POST issues/349/comments(close-applied comment)70627b7d1kept_open: "duplicate/superseded PR close has no rootCauseCluster.canonicalRef; refusing duplicate/superseded auto-close"kept_open, same reasonissue edit 349 --add-label "rating: 🌊 off-meta tidepool"only (rating label sync; no close and no comment)canonicalRef= PR #400ef343c0d9closed(same text)70627b7d1closed(same text)Labels on the stored record after the live run, both builds and both cases:
["rating: 🌊 off-meta tidepool","status: 📣 needs proof"]. Harness limit: the stub cannot produce the closeout freshness receipt that real GitHub returns, so a live close stops atskipped_changed_since_reviewon both builds. The--dry-runcolumn shows the close decision itself. On main, case (a) closes with no coverage proof at all. That is the gap the fail-closed rule removes.Throwaway driver (not committed):
node close-path-proof.ts <buildRoot> <branch>/test/helpers.ts <old-flag|typed-canonical> [dry-run]Needs maintainer call
/^(posted|updated) close-applied comment$/regex. It reads ClawSweeper's own status string, not model output.issueAdvisoryLabels(good first issue) and repairhasSecuritySignalTextstill match security labels by substring.Codex review dispositions
root_cause_clusterandfixed_pr_url/fixed_pr_number.apply-pr-promotionfixture still used onlywork_cluster_refs: fixed. It now uses a typed canonicalRef.Merge Danger
duplicate_or_supersededandimplemented_on_mainPRs, and the security-label close guards. Both behavior changes are maintainer-approved. Every change fails toward keeping items open.