Skip to content

refactor(review): let the decision schema own per-field contracts and label catalogs - #1785

Merged
obviyus merged 5 commits into
mainfrom
prompt-field-contracts
Oct 9, 2026
Merged

obviyus merged 5 commits into
mainfrom
prompt-field-contracts

Conversation

@obviyus

@obviyus obviyus commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What

This PR keeps only cross-field rules in the review prompt and moves per-field guidance and label catalogs to the decision schema. Every change is a behavior-preserving relocation: the same rule moves from the prompt to a schema description, or the PR deletes a prompt sentence that the schema already states. The PR changes no enum, required list, or type. The one code change is the OpenClaw runner seam described below.

Inventory (all relocations)

Prompt text (removed) Now owned by
### Close comment shape closeComment.description (new); the prompt keeps the cross-field rule that a close needs high confidence and evidence
changeSummary/systemContext writing guidance and example changeSummary, systemContext descriptions
changeExample paragraph already in changeExample.description (deleted as duplicate)
bestSolution, reproductionAssessment, solutionAssessment paragraphs their descriptions
agentsPolicyStatus value meanings agentsPolicyStatus.status.description (new)
maintainerDecision paragraph maintainerDecision.required/question (+ "missing proof belongs to PR owner", "no generic question"); required now points at the prompt's implementer-owned list instead of restating it (the #1780 test assertions are re-anchored on the prompt block, none removed)
P0–P3 rubric, "use none", CI-noise sentences already in triagePriority.description; added "whole item, separate from finding priority, apply UX override first"
UX override table already in impactLabels.description; added the missing "cosmetic ⇒ P2/P3 without ux-release-blocker" row
impact:* and merge-risk:* catalogs, prefer-specific, automation-CI sentences already in impactLabels/mergeRiskLabels descriptions; added the "supported by evidence, not more certain than evidence" line
labelJustifications rule, "other names the actual impact" labelJustifications / [].reason descriptions
itemCategory list, reproductionStatus values, reproductionConfidence their descriptions (reproductionConfidence.description new)
rootCauseCluster paragraph rootCauseCluster.description
nextStep contract nextStep.description (landing-approval rule, keyword example, routing prose in workReason)
realBehaviorProof status values, evidenceKind none realBehaviorProof.status.description (new), evidenceKind.description; the prompt keeps the cross-field rule (missing proof ⇒ contributor action, human-only blocker, no repair markers)
finding priorities/title rules already in reviewFindings[] descriptions; added "say why current behavior breaks" to body
reviewMetrics (incl. LOC metric), featureShowcase, prRating pointer their descriptions (featureShowcase gains "serious correctness/security concerns use none"); the OpenClaw note points to the reviewMetrics LOC metric
OpenClaw maturity note first two lines already in maturityLabels.description

Runner seam

Review finding P2 (#1785, prompts/review-item.md:85): with CLAWSWEEPER_RUNNER=openclaw, the OpenClaw backend never saw the schema, so it would lose the relocated guidance. The openclaw agent CLI has no structured-output or schema option (only --message-file). runAgentProcess now appends an ## Output schema section to the OpenClaw message, built from the same --output-schema file that Codex receives, so both backends get the same contract from one source. The diagnostic prompt file records that same input. The Codex path is unchanged. New test: test/agent-runner.test.ts checks that the OpenClaw message file contains the full schema file, including the UX-override text. Telemetry: review_schema_chars already reports the schema size, so the OpenClaw input size is review_prompt_chars + review_schema_chars + about 150 chars of section header; promptChars was not changed. I could not run a local OpenClaw-backed review: the openclaw CLI is not installed on this host.

REVIEW_POLICY_VERSION → v38 (prompt and schema text change).

Deferred (contract changes, separate follow-up PRs from main, not opened yet)

  1. Drop the labelJustifications[].label enum. The parser already validates labels and checks that justified labels equal selected labels, but dropping the enum moves validation from constrained decoding to parse time.
  2. State in closeComment.description that keep_open uses an empty string. This matches observed output but is a new rule.

Why

Audit SlopPrompt findings 3, 4, 6b and 8c: label lists appeared in the prompt and in schema descriptions; ## Field contracts restated what the schema describes, with three overlapping summary paragraphs.

Proof

  • Rebased on current main (after refactor: own ISO timestamp helpers in iso-time #1786, refactor: route sha256 hex digests through content-hash #1790 and other merges) as head 0d405db. Rebuilt; focused tests pass (repository-profiles, pr-label-policy, review-prompt-policy, agent-runner, decision-parser, review-close-policy, review-prompt-context, clawsweeper: 323 pass, 0 fail). The full check below ran before this rebase.
  • pnpm run check on head 832d705 (includes the runner fix), with no live reviews running at the same time: exit 0, 6951 tests pass, 0 fail. On the earlier head a8b75de it also exited 0 (6950 pass).
  • Static prompt size (empty context, chars), current main → this PR: openclaw issue 45,547 → ~36,700; openclaw PR 89,520 → ~77,600; camsnap issue 31,095 → ~22,500; camsnap PR 74,195 → ~62,300. Schema 58,890 → ~62,800 (moved guidance).
  • Grep counts: catalog lines (`impact:data-loss`:, `merge-risk: 🚨 compatibility`:) in assembled prompts 1/1 → 0/0; per-field "Always fill" contracts for 9 fields 1 → 0. New tests assert both.
  • Re-rendering the 15 saved real reports with main dist and with branch dist gave byte-identical output.
  • Live reviews (gpt-6.1-sol, clawsweeper-review sandbox, local-only) on head a8b75de (the prompt and schema text is unchanged since then; the runner fix affects only the OpenClaw backend), run after the check finished, compared with current main (refactor(review): split the review prompt by item kind and render repository rules from profiles #1784):
    • Issue #167557: every compared field is the same (keep_open, P0, impact:ux-release-blocker, maturity:stable, justifications, category, reproduction, work lane, proof not_applicable/not_applicable, visionFit). review_prompt_chars 68,709 → 60,212.
    • PR #167560: every compared field is the same (keep_open, the same P2 finding, C/C/C, mock_only proof, P2 + merge-risk compatibility, work lane, nextStep none, LOC metric). The only difference is the capitalization of one word in the metric value. review_prompt_chars 146,777 → 135,320.

Codex review dispositions

codex review found no actionable findings (run before narrowing; the narrowing only restores the main enum and removes one added sentence).

Merge Danger

  • Door: two-way; text-only prompt and schema-description change with the policy bump.
  • Blast radius: model-visible guidance for every item review. Validation, parsing, enums and rendering are unchanged.

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

Base automatically changed from prompt-split-templates to main October 9, 2026 05:40
@clawsweeper clawsweeper Bot added 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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Moves field guidance and label definitions into the decision schema and includes that schema in OpenClaw review input.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful consolidation with no remaining actionable defect, but runtime coverage is incomplete for the corrected OpenClaw path.
Proof confidence 🦐 gold shrimp (3/6) The supplied repository-state MEMBER classification exempts this PR from the ordinary contributor proof gate. Reported real Codex comparisons cover the relocated guidance; the new OpenClaw delivery seam has only subprocess-input coverage. The decision format is unchanged, so no stored-state migration is required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
User problem: Maintainers receive reviews generated from duplicated field instructions that increase prompt size and can drift.
Reason: The consolidation continues the area's merged prompt-reduction work and preserves established review contracts. Its demonstrated reduction in prompt overhead justifies the narrow runner adjustment.

Merge readiness

✅ Ready for maintainer review

This PR remains useful and distinct from current main. The prior schema-delivery defect and branch-sync blocker are resolved, and no remaining actionable patch defect was found.

Priority: P3
Reviewed head: 0d405db3f7a7443c90a16517850ecca84b42e8fd

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A real OpenClaw-backed review has not demonstrated receipt and use of the relocated field guidance after the runner correction.
Agent review details

How this fits together

ClawSweeper sends GitHub evidence and review instructions to an agent, then validates its JSON decision and publishes a review. The shared runner delivers the decision contract to Codex or OpenClaw.

flowchart TD
 A[GitHub evidence] --> B[Shared review instructions]
 C[Decision schema and field guidance] --> D[Runner selection]
 B --> D
 D --> E[Codex structured input]
 D --> F[OpenClaw message input]
 E --> G[Validated decision and public review]
 F --> G
Loading

Technical review

Best possible solution:

Keep one authoritative field contract and deliver it through the existing shared runner to every supported review backend.

Do we have a high-confidence way to reproduce the issue?

Not applicable to this refactor; the base and head establish duplicated guidance and the corrected schema-delivery path.

Is this the best way to solve the issue?

Yes: schema ownership and delivery through the existing runner remove competing guidance without changing the decision format.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cf34fa9269dc.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Prior finding resolved: The runner appends the complete schema to OpenClaw input and writes the same combined diagnostic prompt. The Codex input path remains unchanged. (src/agent-runner.ts:87, 0d405db3f7a7)
  • Production input boundary: Review execution supplies the schema file to the shared runner; the OpenClaw wrapper writes its received prompt into the actual --message-file input. This is an affirmative dependency signal for the OpenClaw CLI input contract. (src/openclaw-process.ts:57, 0d405db3f7a7)
  • Schema compatibility: An in-memory comparison of base and head schemas after removing description properties found identical structures. Types, enums, required fields, and the persisted decision format are unchanged; no migration is needed. (schema/clawsweeper-decision.schema.json:102, 0d405db3f7a7)
  • Proof scope and source identity: The fully supplied body, captured as sourceRevision de901385c5e7daa77d5df430b9ed3a7410fa21f72da694648e0750ebc8ae0c28, reports real local-only Codex comparisons preserving central classifications and findings, plus focused validation after rebasing. It expressly states that no real OpenClaw-backed review ran after the runner correction. (0d405db3f7a7)
  • Supplemental runner coverage: The added subprocess test captures the --message-file input and checks that it contains the full schema, including UX guidance. Its fake executable establishes delivery coverage, not real OpenClaw runtime behavior. (test/agent-runner.test.ts:292, 0d405db3f7a7)
  • Current main and review continuity: The pinned merge base equals fetched main, resolving the previous sync requirement. Main still retains the duplicated field contracts and sends only the original prompt to OpenClaw, so it does not implement this PR's work. (src/agent-runner.ts:88, cf34fa9269dc)

Likely related people:

  • Ayaan Zaidi: Raw commit 197df62 adds prompts/review-item.md:182 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 197df625648b; files: prompts/review-item.md)
  • Peter Steinberger: Raw commit e1eefe2 adds src/agent-runner.ts:50 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e1eefe217304; files: src/agent-runner.ts)

Review metrics

Metric Value Why it matters
PR review prompt size 146,777 → 135,320 characters in the supplied live comparison The comparison demonstrates reduced prompt overhead while preserving the central review outcome.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is bounded review-instruction consolidation without evidence of an urgent production incident.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Exercise one real OpenClaw-backed review and record the resulting valid decision to strengthen confidence in schema delivery.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-09T05:46:27.546Z sha b8f02dd :: needs changes before merge. :: [P2] Deliver schema guidance to the OpenClaw runner before removing it
  • reviewed 2026-10-09T06:06:30.493Z sha f6d4cb1 :: needs changes before merge. :: [P2] Deliver schema guidance to the OpenClaw runner before removing it
  • reviewed 2026-10-09T06:25:11.636Z sha a8b75de :: needs changes before merge. :: [P2] Deliver schema guidance to OpenClaw before removing prompt rules
  • reviewed 2026-10-09T06:43:56.623Z sha 832d705 :: needs changes before merge. :: none

Reviewed October 9, 2026, 2:53 AM ET / 06:53 UTC (Revision 5).

@obviyus

obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. proof: sufficient Contributor real behavior proof is sufficient. labels Oct 9, 2026
@obviyus
obviyus force-pushed the prompt-field-contracts branch from 832d705 to 0d405db Compare October 9, 2026 06:50
@obviyus

obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 9, 2026
@obviyus
obviyus merged commit 7b0c589 into main Oct 9, 2026
23 of 26 checks passed
@obviyus
obviyus deleted the prompt-field-contracts branch October 9, 2026 07:04
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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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