Repository navigation
refactor(review): split the review prompt by item kind and render repository rules from profiles - #1784
Conversation
…y rules into profiles
… decisions into the profile
|
🦞👀 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 changesSplit review guidance into shared, issue, and PR templates, and select repository-specific guidance and close reasons from repository profiles. Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains useful: current main still loads the combined prompt, and the introduced split preserves the review safeguards without an actionable patch defect. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherClawSweeper assembles repository policy and GitHub item evidence into instructions for its reviewer model. The resulting decision feeds review comments and separately guarded maintenance automation. flowchart TD
A[GitHub item and evidence] --> B[Review prompt assembler]
C[Shared review guidance] --> B
D[Issue or PR template] --> B
E[Repository profile] --> F[Enabled guidance and close reasons]
F --> B
B --> G[Reviewer model]
G --> H[Structured review decision]
Technical reviewBest possible solution: Keep one shared prompt assembler with item-specific templates and profile-owned policy, while preserving the existing apply safeguards and stored report format. Do we have a high-confidence way to reproduce the issue? Not applicable to this refactor; source comparison establishes the unnecessary cross-kind guidance, and reported live reviews exercise the replacement composition. Is this the best way to solve the issue? Yes: the existing assembler and repository profiles remain the owners, with no parallel review path or change to apply authorization. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 552822607e72. 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 Reviewed October 9, 2026, 1:29 AM ET / 05:29 UTC. |
What
Split the item review prompt by item kind, and render repository-specific rules from the repository profile.
prompts/review-item.mdis now the shared core. Issue reviews addprompts/review-item-issue.md, and PR reviews addprompts/review-item-pr.md.instructions/pr-review-rules.mdis folded into the PR template as its## Review Rulessection. The standalone file, thereviewRulesText()loader, and its cache are deleted. Findings discipline rule 3 is deleted because the PR template's re-review paragraph already states the samelateFindingcontract.### Close reasonsis rendered fromprompts/review-close-reasons.md, filtered byprofile.applyCloseRules[item.kind]. A repository with no close reason for the kind gets one "keep the item open" line.oversized_pull_requestis removed from the model-side schema enum. The host synthesizes that decision (clawsweeper-oversized-pr-policy.ts), and the parser still accepts it for stored and host-made decisions.promptNote(shared: changelog is release-owned) and a new typedkindPromptNotes(PR: surface-stat metrics, locale branches,request_behavior_proof,telegramVisibleProof, Doctor examples for implementer-owned decisions; issue:VISION.md, maturity scorecards). They render in a new## Repository Policysection.clawhub-only close sentence and the hardcoded OpenClaw changelog sentence innextStepare deleted: the rendered close reasons and the profile own them. One generic release-note sentence stays in the core.REVIEW_POLICY_VERSION→2026-10-09-policy-v37. The policy hash now covers all four prompt sources.Why
Audit SlopPrompt findings 1, 2, 7 and 8 (Row 6):
request_behavior_proofrules that cannot apply.oversized_pull_requestwas in the enum but described nowhere; profile kind filters silently skipped closes that the prose allowed).pr-review-rules.mdhad no other consumer and restated the re-review contract.Proof
pnpm run check: static checks, build, lint, and 6947 tests pass. Two tests intest/repair/command-proof-consumer.test.tstimed out (120 s/180 s) while three live reviews ran in parallel; that file passes alone (29/29). This is a load flake, not a prompt change.Static prompt size (empty context, chars):
Real hosted-like runs (
review_prompt_chars): issue #167557 102,349 → 68,709; PR #167567 128,228 → 120,585; PR #167560 154,420 → 146,777.Mechanical equivalence (grep counts):
reviewPromptTemplate+reviewRulesText(2) →reviewPromptTemplates(1).review-item.md→ 16 inreview-close-reasons.md, moved verbatim. Rendered per profile and kind: openclaw issue 14, openclaw PR 13, clawhub issue 1, camsnap 0. New test: the rendered openclaw issue ∪ PR reasons plusnoneequal the schemacloseReasonenum.closeReasonenum: 18 → 17 values (oversized_pull_requestremoved).telegram-e2e-userbot1/1 → 0/0,request_behavior_proof1/1 → 0/0,maturity-scores.yaml1/1 → 0/0,VISION.md2/2 → 0/0. OpenClaw PR prompt keeps all of them through the profile.## Review Rulessection in issue prompts: absent before and after; PR prompts: present before and after.Comment rendering: I re-rendered all 15 saved real reports (prompt-rest, prompt-lean, prompt-dump, async-proof/, retire-proof/, /tmp/rules-slice/*) with main dist and branch dist. The output is byte-identical.
Live reviews,
gpt-6.1-sol,clawsweeper-reviewsandbox,--local-only, main vs this branch:Differences:
testingReview.proofPathchanged fromin_process_harnesstounit_only. Rating, finding and readiness did not change. This is run-to-run judgement variance on the PR's added tests, not a prompt change; that rule moved verbatim.realBehaviorProof.evidenceKind: nonebecause the new issue paragraph said so. Commit 9d5f281 restoresnot_applicable, and the rerun matches main on every field.Codex review dispositions
codex review --base main: no actionable findings.Merge Danger
closeReasonenum. Apply-side close validation, the parser, and comment rendering are unchanged.