Repository navigation
feat(prompts): reviewers emit a production-vs-test LOC delta metric - #1017
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 10:16 PM ET / August 3, 2026, 02:16 UTC. ClawSweeper reviewWhat this changesThis PR adds generic reviewer-prompt guidance to report separate production and test LOC deltas when code growth or repository policy makes that metric useful. Merge readiness✅ Ready for maintainer review The focused prompt change is correct and the updated PR body now supplies convincing after-change evidence from a completed local review run. No patch-correctness or security blocker remains; this PR still merits normal maintainer review rather than cleanup closure. Priority: P3 Review scores
Verification
How this fits togetherClawSweeper feeds repository and pull-request context into a review prompt, then validates and renders the resulting structured decision for maintainers. This change affects the optional review-metrics portion of that decision without changing the parser, report schema, or execution lanes. flowchart LR
A[Pull request diff] --> B[Review context]
B --> C[Reviewer prompt]
C --> D[Structured review metrics]
D --> E[Decision parser]
E --> F[Maintainer review report]
Before mergeNone. Agent review detailsSecurityNone. Review metricsNone. Technical reviewBest possible solution: Keep the generic guidance narrow and land it through normal maintainer review so reviewers emit the metric only when code growth or repository policy makes it decision-useful. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: the relevant verification is whether the changed prompt produces the requested structured metric, and the PR body provides a completed post-change local review output that does so. Is this the best way to solve the issue? Yes. Extending the existing generic reviewMetrics guidance is the narrowest maintainable solution because the parser and report renderer already accept the required label, value, and reason fields. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against de31c9959070. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
What Problem This Solves
openclaw/openclaw's root AGENTS.md now directs ClawSweeper PR reviews to emit a production-vs-test LOC delta
reviewMetricsentry (landed in openclaw/openclaw#118330). The generic review prompt had no matching guidance, so workers would emit the metric inconsistently — or only for repos whose AGENTS.md spells it out — and had no canonicalvalue/reasonshape for it.Why This Change Was Made
Adds one paragraph to the
reviewMetricsguidance inprompts/review-item.md: for PRs that meaningfully grow the codebase, or when the target repository's contribution policy asks for it, emit a production-vs-test LOC delta metric with production and test lines counted separately (example shapeproduction +12, tests +85), the justification status noted inreason, and any unjustified-growth concern routed torisksrather than duplicated in the metric. The guidance stays repo-agnostic per the prompt's design: the metric is generic; repo policy (like OpenClaw's Repair Doctrine) supplies the justification vocabulary. No schema change — the existingreviewMetricsitem shape already fits.User Impact
Maintainers reading ClawSweeper reviews get a consistent, comparable LOC-growth digest at the top of PR reports, with production growth separated from test growth. No behavior change for issues or PRs where the metric would not help;
reviewMetrics: []guidance is unchanged.Evidence
Prompt-only diff (+7 lines, one file).
git diff --checkclean. Focused prompt-policy suites pass locally on Node 24:node --test test/review-prompt-policy.test.ts test/review-prompt-context.test.ts— 41 pass, 0 fail. Codex autoreview (gpt-5.6-sol, high) on the exact diff: clean, no accepted/actionable findings, "patch is correct (0.99)". Note:pnpm run test:unithas pre-existing failures on this local macOS environment (stable-json, sweep-status, sweep-workflow, work-plan-artifacts) in files that never readprompts/review-item.md; clawsweeper CI onmainwas green as of 2026-08-02 19:15 UTC, so PR CI is the arbiter there.Real Behavior Proof (post-change review run)
Ran the documented advisory local review lane from this branch (modified prompt live, no GitHub writes):
pnpm run review -- --local-only --target-repo openclaw/openclaw --item-number 118332, reviewing openclaw/openclaw#118332 (fix(chat): preserve reasoning and tool trace after navigation, a representative code PR with mixed production/test growth: +247/−51 across 9 files). Run completed in 8m 31s,review_status: complete,decision: keep_open,confidence: high.The generated report's structured
review_metrics(verbatim fromartifacts/local-review-118332/118332.mdfrontmatter; all content is from the public PR, nothing to redact):[ {"label":"Production versus test LOC","value":"production +11 net; tests +185 net; generated inventory 0 net","reason":"The production growth is justified by a shared owner-boundary repair, but its new payload contracts require the missing safety coverage."}, {"label":"Default session-tool consumers","value":"2 affected","reason":"Both sessions_history and sessions_list rely on the same whole-message-only tool filter."} ]This demonstrates both halves of the new guidance in a real run: production and test lines counted separately in
value, and thereasonstating the justification status of the production growth. The reviewer also still emitted an unrelated second metric and used the metric only where useful, showing thereviewMetrics: []default is undisturbed.