Skip to content

fix(review): avoid failures from multiline live-proof commands - #1268

Merged
steipete merged 1 commit into
mainfrom
steipete/zealous-cartwright-e757a2
Aug 28, 2026
Merged

fix(review): avoid failures from multiline live-proof commands#1268
steipete merged 1 commit into
mainfrom
steipete/zealous-cartwright-e757a2

Conversation

@steipete

@steipete steipete commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where an otherwise successful ClawSweeper review failed parsing when Codex generated a multiline heredoc in a live-proof command. The incident was observed during a local review of #1261 at head 14214b6f84a7be78785b24d0360080be3c368630: inference exited successfully and returned JSON with no code findings, but the decision parser rejected liveProofPlan.entry as multiline. This is a separate follow-up, not a change to that PR or its repository-specific release-note policy.

Why This Change Was Made

The shared decision schema and review template now express the existing parser contract: no literal CR, LF, U+2028, or U+2029 in entry or terminal run.command, including leading/trailing separators; run commands must be nonblank. Complex commands should use an existing script or a properly quoted single line. Ordinary anchored character classes are used because actual structured-output inference rejects regex lookaround.

This is a cross-repository output-format contract, so the ownership belongs in the common schema/template rather than repository profiles or an additional maintainer prompt. The parser and terminal driver are unchanged relative to the current base. One-shot entry-plus-assertion plans, setup-plus-one-run plans, intentional repeated commands, cold-checkout prerequisites, authoritative terminal results, containment, and release/merge guards are preserved. Generated JSON is never rewritten to make it pass.

User Impact

Reviewers receive format guidance that prevents the observed heredoc mismatch without relaxing the safety checks that reject invalid generated plans. There is no new execution permission, fallback, retry, dependency, or schema-version change.

OpenClaw Bay Impact

None. This only aligns generation guidance with the existing decision parser; no observer route, lifecycle, publication, or dashboard data contract changes.

Documentation Impact

Updated the active docs/live-proof.md runbook's command-format guidance and the changelog. Reviewed AGENTS.md, CONTRIBUTING.md, the documentation index, and the local-review documentation. Existing execution and release/merge policy remains accurate.

Review Finding Disposition

The current review raises one P2 finding, "Provide the required local-container behavior proof," and repeats that request as its merge-risk and Rank-up item. There is no separate implementation finding.

Disposition: not applicable to the recorded proof host. The cited policy requires actual controlled behavior proof generally, then scopes the specified provider to a host:

On this Windows host, proof for those surfaces uses Docker-backed Crabbox local-container and records the current head, provider, image, lease, artifact, and limits.

The actual generation and CLI proof in this PR was performed on macOS, not a Windows host. A direct environment assertion is {"platform":"darwin","arch":"arm64","node":"v24.20.0"}. The general real-behavior requirement is satisfied by the two actual Codex/CLI runs documented below, not merely by unit tests or CI. Their tested source was verified byte-identical to the committed head. The Windows-specific provider clause does not establish an all-platform Docker requirement; a future Windows-host run should follow that clause as written.

The identical Rank-up request is therefore not applied to this macOS proof. This is a host-applicability disposition, not a proof waiver: no policy text, execution boundary, parser rule, merge guard, or proof: override label was changed. Re-review should evaluate the cited host condition and the existing actual runtime receipts. The code and all proof inputs are unchanged; this body update records the disposition and the now-complete CI result.

Evidence

  • Focused parser, prompt, live-proof, and review-environment validation: 198 passed, 1 Linux-only skip, no failures.
  • Build, formatting, focused lint, documentation checks, and isolated pre-commit Codex review passed; no actionable P0/P1/P2 findings.
  • The full local pnpm run check completed with 3,844 passed, 10 skipped, 2 failed (plus 12/12 changed-coverage tests). Both failures are unchanged wall-clock assertions in test/apply-runtime-budget.test.ts: the GitHub retry and malformed-JSON retry deadline cases exceeded their 3-second allowance during the broad run. Both immediately passed in isolation (271 ms and 207 ms). No timing budget or unrelated implementation was changed, and the broad run is not being represented as green. The exact committed head now has green hosted CI, including the complete pnpm check, Windows launcher smoke, and sparse repair build smoke; CodeQL also passed. CI reinforces, but does not replace, the actual generation and CLI proof.

Focused command:

node --test test/decision-parser.test.ts test/review-prompt-context.test.ts test/review-prompt-policy.test.ts test/live-proof.test.ts test/live-proof-review-environment.test.ts

Real Behavior Proof

Claim and revision. Actual structured generation and the real local review CLI accept single-line live-proof commands while the parser continues rejecting separators. Refreshed after rebasing onto d103c0cf5c98b0f3d4242bb4202c032856c36a49; the tested source is the exact committed tree at 702d7836f8dbca682c08d9e2cdc104a8d1df9278 (the pre-commit tree and committed tree are verified byte-identical). Environment: macOS, Node 24.20.0, pnpm 11.10.0; configured authenticated Codex. Existing Bash 5.3.15 was exposed through a task-local PATH for workflow fixtures; no global configuration was changed.

Generation control. A real production runAgentProcess call used the complete shipped decision schema, the verbatim stock live-proof guidance, and a dependency-free Node fixture. The fixture requires a setup entry, exactly one non-overwriting proof run, and a stable output assertion; embedded JavaScript must handle an escaped newline. There was no historical PR context or extra single-line workaround. Inference exited 0; the unmodified JSON passed the production parser and both shipped field patterns. Both commands also passed Bash syntax checking. The model executed no tools, and the proposed plan was not run.

Raw generated plan excerpt:

{
  "status": "recommended",
  "surface": "terminal",
  "terminalCompletion": "exit_zero",
  "entry": "node -e 'const fs = require(\"node:fs\"); fs.writeFileSync(\"input.json\", JSON.stringify({message: \"first\\nsecond\"}), {flag: \"wx\"});'",
  "steps": [
    {
      "action": "run",
      "command": "node -e 'const fs = require(\"node:fs\"); const {message} = JSON.parse(fs.readFileSync(\"input.json\", \"utf8\")); if (typeof message !== \"string\" || message.split(\"\\n\").length !== 2) throw new Error(\"Expected two decoded message lines\"); fs.mkdirSync(\"proof-output\"); fs.writeFileSync(\"proof-output/result.txt\", message, {flag: \"wx\"}); console.log(\"PROOF_OUTPUT_CREATED\");'"
    },
    {
      "action": "expect_output",
      "text": "PROOF_OUTPUT_CREATED"
    }
  ]
}

Real CLI path. A fresh review --local-only --allow-closed run used a new managed checkout of the original PR 1261 head 14214b6f84a7be78785b24d0360080be3c368630. It supplied no additional prompt, additional policy, or body override. Equivalent CLI invocation, using a fresh artifact directory and the configured Codex:

node dist/clawsweeper.js review --local-only --allow-closed --target-repo openclaw/clawsweeper --item-number 1261 --artifact-dir "$(mktemp -d /tmp/clawsweeper-live-proof.XXXXXX)" --readonly-openclaw --codex-sandbox read-only --codex-reasoning-effort high --codex-timeout-ms 1200000

Observed receipt:

CLI exit: 0
review_status: complete
pull_head_sha: 14214b6f84a7be78785b24d0360080be3c368630
review_additional_prompt_chars: 0
review_sandbox: read-only
local_checkout_access: verified
local_checkout_access_source: runner_preflight_v1
reviewFindings: 0
liveProofPlan: recommended / terminal / exit_zero
entry: one physical line
steps: four expect_output assertions, no replayed run
runner source/build hashes: unchanged
target checkout: clean
raw generated JSON: parsed without rewriting

The CLI hydrated GitHub context through the configured cache: its metadata reported the historical PR open although an independent PR view showed it merged. The exact target head was verified. The historical PR body quotes its prior additional-prompt workaround; that text was not injected as a maintainer instruction. This is why the separate generation control deliberately contains no historical PR context. This CLI run establishes generation/parsing/report creation at the requested historical head, not current PR lifecycle freshness.

Artifact fingerprints. Full raw outputs and command/provenance receipts are retained locally; these hashes bind the inspected outputs without publishing agent transcripts:

Artifact SHA-256
Full shipped decision schema d1e015846fd51478782250e0fb80cdb94ad21e13a5f395922f2dea095fd6e24b
Owning review template 0088624a08951b16d74b42ee8a46febf927062efa738c89d964bfeb2773af324
Generated-control raw JSON 3d60d5b07b456b317c8b600c25ce3fb99f05aa0fed75fefe8ae000f2cfb7283c
Actual CLI raw JSON 2284556c7bded9af826510b51ab42b8d5d4c6aac489d0103c122c41b4a6af192
Actual CLI assembled prompt 2d977205a9ec4035cc77d4bc5058417e3a2e599cc3934e6c4ef51c6d3f7ad86b
Pre-commit task diff 5a229ec4e1a914297759954e11394225b123280f511696d2a5c03c84dda34c0e

Scope and Limits

The terminal commands generated during this proof were not executed. The exercised behavior is actual structured generation, strict parsing, and real local CLI report creation, not terminal execution, a production deployment, or a statistical reliability guarantee. No live apply/close, repair, release, or unrelated publication was used for proof.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 8:03 PM ET / August 28, 2026, 00:03 UTC.

ClawSweeper review

What this changes

The PR adds single-line schema constraints and review guidance for live-proof commands, plus focused parser and prompt coverage.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: this is a coherent, current fix for a real parser/prompt mismatch, and the updated body supplies after-fix structured-generation and CLI receipts that resolve the prior proof blocker. No introduced correctness or security defect was found.

Priority: P2
Reviewed head: 702d7836f8dbca682c08d9e2cdc104a8d1df9278

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered contract alignment with credible after-fix runtime evidence and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The PR body provides after-fix production structured-generation and local CLI receipts showing successful parsing of one-line commands; copied runtime output is sufficient evidence for this non-visual automation change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body provides after-fix production structured-generation and local CLI receipts showing successful parsing of one-line commands; copied runtime output is sufficient evidence for this non-visual automation change.
Evidence reviewed 5 items Existing parser boundary: Current main already rejects CR, LF, U+2028, and U+2029 before trimming live-proof fields, so the PR aligns generation constraints with an established fail-closed parser contract.
Introduced schema and coverage: The PR constrains both entry and terminal run commands, and its focused test checks literal separators, nonblank commands, browser paths, and parser behavior.
Runtime consumption: The review runtime passes the checked-in schema to Codex through --output-schema and subsequently parses the generated decision, so this schema is the active structured-output boundary rather than documentation alone.
Findings None None.
Security None None.

Live Verification

Command: pnpm run build && node --test test/decision-parser.test.ts test/review-prompt-context.test.ts

Result: PASS (completed)

$ tsc -p tsconfig.json
✔ decision parser enforces required schema-shaped evidence (15.151194ms)
✔ decision parser validates typed live-proof plans and report roundtrips (2.765169ms)
✔ report live-proof parsing fails closed when the plan is missing or invalid (0.42824ms)
✔ report live-proof parsing preserves safe legacy plans and rejects ambiguous terminal plans (0.704607ms)
✔ shipped live-proof command patterns reject separators with JavaScript RegExp (7.344758ms)
✔ live-proof entry schema preserves browser paths and nonrecommended empty entries (1.4064ms)
✔ decision parser preserves every terminal command including exact entry repeats (1.619824ms)
✔ decision parser accepts only a complete regression-provenance candidate shape (0.498414ms)
✔ decision parser accepts non-blaming regression assessments only with normalized evidence (0.755602ms)
✔ decision parser keeps maintainer intent model-authored and owner-consistent (0.757705ms)
✔ decision parser validates typed root-cause clusters (2.82047ms)
✔ root-cause report parsing defaults legacy and malformed reports safely (1.4339ms)
✔ decision parser neutralizes headings in every model-authored report prose field (1.711708ms)
✔ decision report prose neutralization is idempotent (0.6797ms)
✔ decision report prose normalizes Unicode line separators before neutralizing headings (0.53701ms)
✔ decision parser rejects multiline structural report fields (1.820649ms)
✔ review prompt assets match tracked files (4.867002ms)
✔ assembled review prompt supplies the live-proof single-line command guidance (1.851824ms)
✔ release-note prompt policy follows the target openclaw/openclaw (6.895316ms)
✔ release-note prompt policy follows the target openclaw/clawsweeper (5.625388ms)
✔ release-note prompt policy follows the target openclaw/clawhub (6.148998ms)
✔ release-note prompt policy follows the target openclaw/example-tool (8.900286ms)
✔ release-note prompt policy follows the target steipete/example-tool (4.677273ms)
✔ release-note prompt policy follows the target  OpenClaw/OpenClaw  (8.307604ms)
✔ release-note prompt policy follows the target  OpenClaw/ClawSweeper  (5.36906ms)
✔ review prompt projects effective explicit and fallback live-proof profiles separately from PR claims (5.58025ms)
✔ review prompt reflects disabled, missing, and opted-in live-proof setup without changing profiles (1.602628ms)
✔ sweep apply jobs wire the default-off product direction policy gate (1.341544ms)
✔ main CLI args ignore package-manager double dash separators (0.19721ms)
✔ review prompt telemetry records durable cost proxies (0.199022ms)
✔ review prompt includes compact previous review state without raw durable review body (0.434179ms)
✔ review prompt excludes full semantic-cache patches (0.463532ms)
✔ review prompt excludes persistence-only PR hydration snapshots (0.528467ms)
✔ review prompt includes merge state and guards clean behind-branch drift (0.540796ms)
✔ review context ledger records ordered section budgets (0.775801ms)
ℹ tests 35
ℹ suites 0
ℹ pass 35
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 376.155065






Assertions:

  • PASS expect_output: shipped live-proof command patterns reject separators with JavaScript RegExp

How this fits together

ClawSweeper asks a model for structured review decisions that may include terminal live-proof plans. The shared prompt and JSON schema guide that output, while the decision parser validates it before the proof runner executes anything.

flowchart LR
  Prompt[Review prompt] --> Decision[Structured decision]
  Schema[Decision schema] --> Decision
  Decision --> Parser[Strict decision parser]
  Parser --> Plan[Live-proof plan]
  Plan --> Runner[Proof runner]
  Runner --> Report[Review report]
Loading

Before merge

  • Complete next step (P2) - No repair routing is needed because the submitted branch is coherent and has no actionable reviewer finding.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 6 files affected The change is limited to one shared output contract, its documentation, and focused tests.
Production versus test delta production assets +27/-4, tests +141/-0 The larger test delta exercises schema patterns and parser behavior around the narrow contract change.

Technical review

Best possible solution:

Keep the schema, prompt, documentation, and parser boundary aligned so invalid multiline plans are prevented during generation and still rejected at parsing.

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

Yes, with high confidence: current-main parser source rejects the reported separators, and the PR body records the prior real Codex heredoc output that reached that failure path. This review did not run a new model inference.

Is this the best way to solve the issue?

Yes. Constraining the active structured-output schema and prompt while retaining the parser as the final validation boundary is the narrowest maintainable fix.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d103c0cf5c98.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix production structured-generation and local CLI receipts showing successful parsing of one-line commands; copied runtime output is sufficient evidence for this non-visual automation change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body provides after-fix production structured-generation and local CLI receipts showing successful parsing of one-line commands; copied runtime output is sufficient evidence for this non-visual automation change.
  • 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: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded review-automation reliability fix with limited user-facing blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body provides after-fix production structured-generation and local CLI receipts showing successful parsing of one-line commands; copied runtime output is sufficient evidence for this non-visual automation change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix production structured-generation and local CLI receipts showing successful parsing of one-line commands; copied runtime output is sufficient evidence for this non-visual automation change.

Evidence

What I checked:

  • Existing parser boundary: Current main already rejects CR, LF, U+2028, and U+2029 before trimming live-proof fields, so the PR aligns generation constraints with an established fail-closed parser contract. (src/clawsweeper-decision-parser.ts:131, d103c0cf5c98)
  • Introduced schema and coverage: The PR constrains both entry and terminal run commands, and its focused test checks literal separators, nonblank commands, browser paths, and parser behavior. (schema/clawsweeper-decision.schema.json:838, 702d7836f8db)
  • Runtime consumption: The review runtime passes the checked-in schema to Codex through --output-schema and subsequently parses the generated decision, so this schema is the active structured-output boundary rather than documentation alone. (src/clawsweeper-review-runtime.ts:1109, d103c0cf5c98)
  • After-fix behavior proof: The PR body records an actual structured generation using the shipped schema and an actual local review CLI run, both completing with unmodified JSON parsed successfully; this is real runtime evidence rather than test-only proof. (702d7836f8db)
  • Feature history: Recent history shows shared ownership of live-proof behavior by Peter Steinberger and Vincent Koc, including the current-main terminal-result change and prior live-proof feature work. (src/clawsweeper-decision-parser.ts:129, d103c0cf5c98)

Likely related people:

  • steipete: Peter Steinberger introduced the live-proof feature and has repeatedly maintained its planning and execution behavior. (role: live-proof feature owner; confidence: high; commits: c06a897aadd7, 44eb7ed2e43d, c0af16349bfb; files: prompts/review-item.md, schema/clawsweeper-decision.schema.json, src/clawsweeper-decision-parser.ts)
  • vincentkoc: Vincent Koc authored the current-main change to terminal live-proof result handling and recently maintained the parser path. (role: recent live-proof contributor; confidence: high; commits: d103c0cf5c98, f211e21fb89d; files: src/clawsweeper-decision-parser.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-27T23:43:21.861Z sha 702d783 :: needs real behavior proof before merge. :: [P2] Provide the required local-container behavior proof

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 28, 2026
@steipete
steipete merged commit 6230a9d into main Aug 28, 2026
26 checks passed
@steipete
steipete deleted the steipete/zealous-cartwright-e757a2 branch August 28, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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