Skip to content

fix(live-proof): preserve successful terminal verification - #1232

Merged
steipete merged 3 commits into
mainfrom
fix/live-verification-output-wait
Aug 25, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/live-verification-output-wait

Conversation

@steipete

@steipete steipete commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix terminal live verification so a successful command is not reclassified as failed only because a requested marker was not visible in the captured pane.

  • Run every terminal entry and run action as a tmux-supervised Bash process from an exact private command file.
  • Treat tmux pane_dead_status and pane_dead_signal as the command completion authority, including transient status publication and fail-closed probe errors.
  • Preserve the durable schema-v1 passing invariant while rendering a successful, absent marker as NOT OBSERVED and excluding it from recorded-proof eligibility.
  • Keep nonzero exits, direct signals, exit 124 timeouts, still-running missing markers, malformed supervision state, and failed sequential commands as failures.
  • Redact and promptly remove private command-file paths; aggregate clean output across ordered commands.

Root cause

The 30-second expect_output loop owned only tmux pane visibility. It had no authoritative relationship to the command's completion status, so its timeout could override a command that had already completed successfully.

That happened in ClawSweeper run 32405834950: node scripts/run-vitest.mjs src/agents/code-mode.mcp.test.ts completed with 1 file and 10/10 tests passing, and the wrapper reported success after 28.37 seconds. The durable review comment nevertheless recorded a partial failure because Code Mode MCP namespace was not visible before the display wait expired: openclaw/openclaw#126262 review.

The fix moves completion ownership outside the measured shell. tmux now supervises the exact command process and reports its exit or signal independently of what appeared in the pane.

Behavior proof

Claim: A terminal command that exits 0 remains a passing verification when its requested marker was not captured, while genuine failures and timeouts still fail.

Exercised surface: src/live-proof/drivers.ts through the real local tmux process boundary on current head cb2128f8a1764041f80424dca09ddfc942161699.

Environment: macOS, Node v24.19.0, tmux 3.7c, recording disabled.

Scenarios and observable results:

  • Successful test-shaped command printed Tests 10 passed (10) and wrapper passed after 28.37 seconds; absent marker produced completed with command exited successfully; expected output was not observed in the captured pane.
  • timeout 1s ... failed and was identified as exit status 124.
  • kill -TERM $$ failed and was identified as signal-derived exit status 143.
  • Two ordered run actions completed with clean aggregated output first\nsecond.
  • Focused regression suite: 73/73 passed.

Trace: The current-head JSON trace was captured session-locally and its complete scenario results are summarized above.

Limits: Local macOS proof, recording disabled, and synthetic commands matching the observed timing/result shape rather than rerunning the OpenClaw repository test itself.

Validation

  • pnpm run check:static
  • pnpm run build:all
  • pnpm run lint
  • node --test test/live-proof.test.ts — 73 passed
  • node --test test/live-proof-review-environment.test.ts — passed five consecutive reruns after the CI timing fix
  • Current-head real tmux behavior proof described above
  • Committed branch autoreview against origin/main — no accepted/actionable findings

A full pnpm run check was also attempted. Static checks, all builds, lint, the changed coverage gate, and 3,668 tests passed before 48 unrelated repair-fixture failures. Those fixtures construct temporary repositories where validation now reports fatal: Not a valid object name origin/main; 9 tests were skipped. The failures are outside the live-proof files changed here.

Bay impact

OpenClaw Bay is unaffected. The durable live-verification schema remains version 1, and Bay remains an observer-only consumer.

@clawsweeper

clawsweeper Bot commented Aug 24, 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. 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. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 4:45 AM ET / 08:45 UTC.

ClawSweeper review

What this changes

The PR changes terminal live-proof execution so tmux process completion, rather than captured output visibility alone, determines whether a command passed.

Regression provenance

Possible regression — probable (reproduction; failure trace; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this PR open for normal merge review: current main still relies on pane output visibility, while this branch makes tmux completion status authoritative and preserves successful commands with an explicitly non-observed marker. The focused failure-path coverage and current-head tmux proof support the approach; no blocking patch defect was found.

Priority: P2
Reviewed head: cb2128f8a1764041f80424dca09ddfc942161699

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused real-process proof and extensive regression coverage support a good, mergeable repair with a runner-compatibility check still worthwhile.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides current-head real tmux boundary evidence for the successful absent-marker case and the relevant failure controls.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides current-head real tmux boundary evidence for the successful absent-marker case and the relevant failure controls.
Evidence reviewed 6 items Current-main baseline: Current main runs terminal commands through interactive tmux input and waits only for changed pane content; it has no pane-exit-status authority, so the reported false failure remains relevant.
Completion authority implementation: The PR-head driver polls tmux pane dead/status/signal state, treats nonzero exits as failures, and retains a successful absent marker as a completed non-observation.
Focused regression coverage: Coverage exercises the reported successful-but-unobserved marker path, timeout, signal, malformed status, sequential commands, output aggregation, and recording ineligibility.
Findings None None.
Security None None.

Live Verification

Command: pnpm run build && node --test test/live-proof.test.ts

Result: PASS (completed)

pnpm run build && node --test test/live-proof.test.tsrunner@runnervm76f27:/tmp/clawsweeper-live-proof-1232-gXz6tG/target$ pnpm run build && node --test test/liv
e-proof.test.ts
pnpm run build && node --test test/live-proof.test.ts
$ tsc -p tsconfig.json
▶ live-proof gates skip in order with a successful result
  ✔ environment flag (2.176712ms)
  ✔ repository opt-in (0.268223ms)
  ✔ plan status (0.418765ms)
  ✔ suspicious plan is never executed (0.390122ms)
  ✔ browser plan on terminal-only profile (0.350517ms)
  ✔ item kind (0.400881ms)
  ✔ PR open state (0.252022ms)
✔ live-proof gates skip in order with a successful result (6.386296ms)
✔ live-proof environments remove known and heuristic credential classes (1.143845ms)
✔ live-proof review child prints the sanitized-environment assertion (0.864982ms)
✔ live-proof install setup disables lifecycle scripts unless the profile opts in (0.676779ms)
✔ live-proof installs a missing Bun toolchain with the official installer (0.454382ms)
✔ live-proof reports an unsupported package manager clearly (0.156894ms)
✔ Playwright generation keeps quotes, backticks, and newlines inside JSON data (27.379568ms)
✔ Playwright scrolls targets into view best effort, settles, and holds a six-second minimum (0.245861ms)
✔ Playwright probes every expected text immediately after the initial navigation (0.26098ms)
✔ terminal driver composes direct Xvfb, xterm, and bounded ffmpeg sessions (0.474971ms)
✔ terminal run waits for pane content beyond the echoed command (2.50642ms)
✔ terminal keeps silent commands eligible for the full expectation window (0.820068ms)
✔ terminal expect_output polls until new command output appears (0.567945ms)
✔ terminal expect_output preserves leading and trailing marker whitespace (0.379021ms)
✔ terminal expect_output records text already present in the plan-start snapshot (0.53817ms)
✔ terminal command success is not overturned by an unobserved output marker (2.157355ms)
✔ terminal command timeout remains a failed output expectation (0.504997ms)
✔ terminal nonzero and signal exits fail even when the expected marker is present (0.680636ms)
✔ terminal pane signals fail even when expected output is present (0.73635ms)
✔ terminal waits for tmux to publish a dead pane status (0.338705ms)
✔ terminal status probe errors fail closed (0.635111ms)
✔ terminal command failure after an observed marker is caught after the recording hold (0.46904ms)
✔ terminal commands with no assertion or only a wait cannot hide a nonzero exit (0.653285ms)
✔ terminal post-output grace catches a prompt failure before cleanup (0.421971ms)
✔ terminal detects an active shell that exits before publishing prompt status (0.311785ms)
✔ terminal accepts a successful silent command (0.27198ms)
✔ terminal artifact errors redact private command paths (0.41093ms)
✔ terminal marker-present long-running commands remain successful without an exit status (0.364193ms)
✔ terminal output aggregates clean evidence across the entry command and run steps (0.547747ms)
✔ a previous terminal command failure blocks a following run step (0.386184ms)
✔ terminal commands preserve shell syntax in supervised command files (2.77284ms)
✔ terminal published output excludes private command paths (0.355707ms)
✔ terminal expect_output times out without matching the echoed command (0.625362ms)
✔ terminal recording holds the end state and enforces its minimum before finalizing (0.468267ms)
✔ terminal driver reports display readiness timeout with all pane diagnostics (0.776336ms)
✔ terminal driver accepts a recorder file that appears and grows late (0.428083ms)
✔ terminal driver reports a dead recorder with its pane diagnostics (0.332453ms)
✔ terminal driver waits for the recorder session to exit after sending q (0.502522ms)
✔ live-proof reports a failed drive without producing media (2.775825ms)
✔ live-proof keeps verification when every satisfied expectation was present at start (1.437606ms)
✔ live-proof emits a bundle whe
… output truncated …

Assertions:

  • PASS expect_output: pass

How this fits together

Terminal live proof runs a planned command in tmux, captures bounded terminal output, and publishes a verification result into the review workflow. This change separates command completion from display-marker capture before the result can be used for proof or recording eligibility.

flowchart LR
  A[Live proof plan] --> B[Terminal command runner]
  B --> C[tmux supervised process]
  C --> D[Exit or signal status]
  C --> E[Captured pane output]
  D --> F[Verification decision]
  E --> F
  F --> G[Review comment and recording eligibility]
Loading

Before merge

  • Resolve merge risk (P1) - The automated review runner now depends on tmux pane status formatting; an unexpected runner-specific format fails closed and can withhold valid proof until the probe is diagnosed.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test delta production +369/-56, tests +654/-19, docs/changelog +13/-4 The substantial regression suite covers the changed terminal-process authority and its fail-closed paths.

Merge-risk options

Maintainer options:

  1. Confirm the hosted tmux completion contract (recommended)
    Run the focused terminal proof path on the hosted runner and retain a redacted trace for successful exit, nonzero exit, signal, timeout, and missing-marker cases before merge.

Technical review

Best possible solution:

Retain process completion as the passing authority, keep absent output markers visibly non-observed and recording-ineligible, and confirm the supported hosted tmux path before landing.

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

Yes. The PR body records the prior successful command and missing-marker failure, then supplies current-head real-tmux after-fix scenarios for success, timeout, signal, and sequential-command behavior.

Is this the best way to solve the issue?

Yes. Making process completion authoritative while preserving an absent marker as a visible, non-recordable observation is narrower and safer than treating pane visibility as command success.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded correctness repair for automated proof capture rather than a user-facing runtime outage.
  • merge-risk: 🚨 automation: The branch changes terminal execution and pass/fail classification in the automated review-proof workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides current-head real tmux boundary evidence for the successful absent-marker case and the relevant failure controls.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides current-head real tmux boundary evidence for the successful absent-marker case and the relevant failure controls.

Evidence

What I checked:

  • Current-main baseline: Current main runs terminal commands through interactive tmux input and waits only for changed pane content; it has no pane-exit-status authority, so the reported false failure remains relevant. (src/live-proof/drivers.ts:611, ce250708c1ea)
  • Completion authority implementation: The PR-head driver polls tmux pane dead/status/signal state, treats nonzero exits as failures, and retains a successful absent marker as a completed non-observation. (src/live-proof/drivers.ts:729, cb2128f8a176)
  • Focused regression coverage: Coverage exercises the reported successful-but-unobserved marker path, timeout, signal, malformed status, sequential commands, output aggregation, and recording ineligibility. (test/live-proof.test.ts:614, cb2128f8a176)
  • Published contract: The updated documentation describes successful absent markers, private command-file handling, separate command processes, and failure conditions consistently with the implementation. (docs/live-proof.md:131, cb2128f8a176)
  • Current-head provenance: The latest PR commit is the follow-up that drains output after successful exit; its commit metadata identifies the reviewed head and timestamp. (src/live-proof/drivers.ts:807, cb2128f8a176)
  • Diff hygiene and scope: The branch is clean and changes 369 production lines net of removals, 654 test additions, and 13 documentation/changelog additions; whitespace checks pass. (src/live-proof/drivers.ts:354, cb2128f8a176)

Likely related people:

  • Peter Steinberger: The available live-proof commit trail for this review consists of the three PR commits authored by Peter Steinberger; deeper pre-PR path ancestry is unavailable in this detached checkout. (role: recent live-proof contributor; confidence: low; commits: 71d556eaec70, 6396ea556e19, cb2128f8a176; files: src/live-proof/drivers.ts, test/live-proof.test.ts, docs/live-proof.md)

Rank-up moves

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

  • Capture a redacted hosted-runner tmux status trace if its behavior differs from the macOS proof.

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-24T08:13:57.978Z sha 6396ea5 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit a958131 into main Aug 25, 2026
10 of 11 checks passed
@steipete
steipete deleted the fix/live-verification-output-wait branch August 25, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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