Skip to content

feat(prompts): reviewers emit a production-vs-test LOC delta metric - #1017

Merged
steipete merged 1 commit into
mainfrom
steipete/loc-delta-review-metric
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/loc-delta-review-metric

Conversation

@steipete

@steipete steipete commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw/openclaw's root AGENTS.md now directs ClawSweeper PR reviews to emit a production-vs-test LOC delta reviewMetrics entry (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 canonical value/reason shape for it.

Why This Change Was Made

Adds one paragraph to the reviewMetrics guidance in prompts/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 shape production +12, tests +85), the justification status noted in reason, and any unjustified-growth concern routed to risks rather 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 existing reviewMetrics item 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 --check clean. 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:unit has pre-existing failures on this local macOS environment (stable-json, sweep-status, sweep-workflow, work-plan-artifacts) in files that never read prompts/review-item.md; clawsweeper CI on main was 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 from artifacts/local-review-118332/118332.md frontmatter; 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 the reason stating the justification status of the production growth. The reviewer also still emitted an unrelated second metric and used the metric only where useful, showing the reviewMetrics: [] default is undisturbed.

@steipete
steipete marked this pull request as ready for review August 3, 2026 01:26
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 10:16 PM ET / August 3, 2026, 02:16 UTC.

ClawSweeper review

What this changes

This 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
Reviewed head: bddcfe49bf1540fd65381a1d2f3e5f7958ca4779

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A small, schema-compatible prompt improvement with current live-output proof and no actionable review finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body includes a post-change, completed local review run with the emitted structured LOC metric and its observed result; the quoted report contains no sensitive information requiring redaction.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body includes a post-change, completed local review run with the emitted structured LOC metric and its observed result; the quoted report contains no sensitive information requiring redaction.
Evidence reviewed 5 items Focused prompt diff: The branch changes only seven lines in prompts/review-item.md, directing reviewers to separate production and test lines in a useful LOC metric and to keep unjustified-growth concerns in risks.
Existing schema supports the metric: The decision parser already requires reviewMetrics as structured entries, so the proposal uses the established output surface rather than adding a parallel contract.
Prompt policy remains aligned: The existing policy test defines review metrics as concrete and maintainer-relevant while VISION.md advises against adding pinned-text tests where a review gate is sufficient; this small wording addition does not require a brittle new assertion.
Findings None None.
Security None None.

How this fits together

ClawSweeper 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]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes a post-change, completed local review run with the emitted structured LOC metric and its observed result; the quoted report contains no sensitive information requiring redaction.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes a post-change, completed local review run with the emitted structured LOC metric and its observed result; the quoted report contains no sensitive information requiring redaction.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P3: This is a seven-line prompt-quality enhancement with demonstrated review-output behavior and no runtime or data-path impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes a post-change, completed local review run with the emitted structured LOC metric and its observed result; the quoted report contains no sensitive information requiring redaction.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes a post-change, completed local review run with the emitted structured LOC metric and its observed result; the quoted report contains no sensitive information requiring redaction.

Evidence

What I checked:

  • Focused prompt diff: The branch changes only seven lines in prompts/review-item.md, directing reviewers to separate production and test lines in a useful LOC metric and to keep unjustified-growth concerns in risks. (prompts/review-item.md:306, bddcfe49bf15)
  • Existing schema supports the metric: The decision parser already requires reviewMetrics as structured entries, so the proposal uses the established output surface rather than adding a parallel contract. (src/clawsweeper-decision-parser.ts:806, de31c9959070)
  • Prompt policy remains aligned: The existing policy test defines review metrics as concrete and maintainer-relevant while VISION.md advises against adding pinned-text tests where a review gate is sufficient; this small wording addition does not require a brittle new assertion. (test/review-prompt-policy.test.ts:44, de31c9959070)
  • Current proof is positive: The current PR body records a completed post-change local review against a representative mixed production/test PR and includes the resulting structured metric with separate net line counts and a justification-bearing reason. (prompts/review-item.md:306, bddcfe49bf15)
  • Feature-history ownership: The current main history shows Peter Steinberger as the recent primary contributor to prompts/review-item.md, including the current-base commit that updated this review-policy surface. (prompts/review-item.md:295, de31c9959070)

Likely related people:

  • steipete: Peter Steinberger is the overwhelmingly dominant contributor in the available history for prompts/review-item.md and authored the recent current-main changes around this review-policy surface. (role: recent prompt-policy contributor; confidence: high; commits: de31c9959070, 8a31b9f89386, 3d2a878f6e2a; files: prompts/review-item.md, test/review-prompt-policy.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-03T01:30:25.499Z sha bddcfe4 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Aug 3, 2026
@steipete
steipete merged commit fd51157 into main Aug 3, 2026
32 of 33 checks passed
@steipete
steipete deleted the steipete/loc-delta-review-metric branch August 3, 2026 02:19
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant