Skip to content

Commit 055ffba

Browse files
authored
feat(live-proof): run the real system by default and publish what happened (#1204)
Live verification only ran when a video was possible, and its result was only ever surfaced as a recording, so refactors and internal changes executed nothing and a run without a video was invisible. Reviews now plan a verification for any PR with something runnable — declined_suspicious remains the strict escape hatch — and the payoff judgment chooses only the presentation. A static_text payoff still runs the real binary and captures its output while skipping video capture entirely, and every run publishes a Live Verification section with the command, a sanitized excerpt of real output, and per-assertion results.
1 parent 44eb7ed commit 055ffba

13 files changed

Lines changed: 1148 additions & 308 deletions

‎.github/workflows/live-proof.yml‎

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99
inputs:
1010
mode:
11-
description: "Attach or retract a live-proof recording"
11+
description: "Publish a live verification or retract its recording"
1212
required: true
1313
default: attach
1414
type: choice
@@ -67,7 +67,7 @@ jobs:
6767
if [ -n "$LIVE_PROOF_PLAN_JSON" ] && [ "$LIVE_PROOF_PLAN_JSON" != "null" ]; then
6868
printf '%s\n' "$LIVE_PROOF_PLAN_JSON" | jq -e . > /tmp/live-proof-plan.json
6969
else
70-
printf '%s\n' '{"status":"not_applicable","surface":"none","reason":"Manual dispatch did not include a publication plan.","entry":"","steps":[]}' > /tmp/live-proof-plan.json
70+
printf '%s\n' '{"status":"not_applicable","surface":"none","reason":"Manual dispatch did not include a publication plan.","payoff":{"kind":"static_text","justification":"No presentation payoff was assessed."},"entry":"","steps":[]}' > /tmp/live-proof-plan.json
7171
echo "::notice::No publication plan was supplied; the execution gate will complete as a safe skip."
7272
fi
7373
node --input-type=module <<'NODE'
@@ -85,6 +85,10 @@ jobs:
8585
"",
8686
"Reason: " + String(plan.reason || ""),
8787
"",
88+
"Payoff: " + String(plan.payoff?.kind || ""),
89+
"",
90+
"Payoff justification: " + String(plan.payoff?.justification || ""),
91+
"",
8892
"Entry: " + String(plan.entry || ""),
8993
"",
9094
"Steps:",
@@ -100,16 +104,21 @@ jobs:
100104
echo "repo_owner=$repo_owner"
101105
echo "repo_name=$repo_name"
102106
echo "repo_slug=$repo_slug"
107+
echo "record_media=$(jq -r '.payoff.kind != \"static_text\"' /tmp/live-proof-plan.json)"
103108
} >> "$GITHUB_OUTPUT"
104109
105110
- uses: ./.github/actions/setup-pnpm
106111
with:
107112
build-script: build
108113

109-
- name: Install deterministic recording tools
114+
- name: Install deterministic execution tools
110115
run: |
111116
sudo apt-get update
112-
sudo apt-get install --yes ffmpeg tmux x11-utils xfonts-base xvfb xterm
117+
sudo apt-get install --yes tmux
118+
119+
- name: Install deterministic recording tools
120+
if: ${{ steps.target.outputs.record_media == 'true' }}
121+
run: sudo apt-get install --yes ffmpeg x11-utils xfonts-base xvfb xterm
113122

114123
- name: Check out the public PR head
115124
env:
@@ -141,7 +150,7 @@ jobs:
141150
--item "${{ steps.target.outputs.item }}" \
142151
--record ../live-proof-report.md \
143152
--output ../live-proof-bundle
144-
if [ -f ../live-proof-bundle/live-proof-manifest.json ]; then
153+
if [ -f ../live-proof-bundle/live-verification.json ]; then
145154
echo "produced=true" >> "$GITHUB_OUTPUT"
146155
else
147156
echo "produced=false" >> "$GITHUB_OUTPUT"
@@ -211,18 +220,20 @@ jobs:
211220
with:
212221
build-script: build:all
213222

214-
- name: Install media validators
215-
if: ${{ github.event_name != 'workflow_dispatch' || inputs.mode == 'attach' }}
216-
run: |
217-
sudo apt-get update
218-
sudo apt-get install --yes ffmpeg
219-
220223
- uses: actions/download-artifact@v8
221224
if: ${{ github.event_name != 'workflow_dispatch' || inputs.mode == 'attach' }}
222225
with:
223226
name: live-proof-${{ steps.target.outputs.repo_slug }}-${{ steps.target.outputs.item }}
224227
path: live-proof-bundle
225228

229+
- name: Install media validators when recording exists
230+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.mode == 'attach' }}
231+
run: |
232+
if [ -f live-proof-bundle/live-proof-manifest.json ]; then
233+
sudo apt-get update
234+
sudo apt-get install --yes ffmpeg
235+
fi
236+
226237
- name: Publish live-proof change
227238
env:
228239
MODE: ${{ inputs.mode || 'attach' }}

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ checkpoint, and status-only commits are intentionally omitted.
1818

1919
### Changed
2020

21-
- Live-proof plans now let the model judge whether a recording has a genuinely visual payoff and skip short static-text demonstrations that belong in review code blocks.
21+
- Live verification now runs real PR behavior by default, publishes bounded command output and assertion results even without video, and treats recordings as optional presentation.
2222
- Browser live proofs treat scroll-into-view as best effort so continuously animated targets stay clickable.
2323
- Live-proof recordings can now be retracted through a trusted manual workflow dispatch without rerunning target code or requiring an artifact, manifest, or matching head SHA.
2424
- Live-proof recordings now wait for post-action command or page expectations, hold the final state on screen, and attach only when an initially absent expectation proves a semantic change.

‎docs/live-proof.md‎

Lines changed: 61 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,27 @@
77
- Update when: the plan schema, execution gates, media limits, storage path, or
88
comment rendering changes
99

10-
Live proof turns a review-time `liveProofPlan` into a short deterministic
11-
recording of user-visible browser or terminal behavior. Classification remains
12-
part of the existing read-only review. It records only a typed plan in the
13-
durable report; it never executes pull request code and never publishes a URL.
10+
Live proof turns a review-time `liveProofPlan` into a deterministic execution of
11+
real browser or terminal behavior, with an optional recording when the run is
12+
worth watching. Classification remains part of the existing read-only review.
13+
It records only a typed plan in the durable report; the later secretless
14+
execution lane runs pull request code and the trusted publication lane reports
15+
the result.
1416

1517
After the report is published, both scheduled publication and exact-event
1618
direct delivery in `sweep.yml` dispatch `live-proof.yml` only when the plan
1719
status is `recommended` and the target's repository profile has
1820
`live_test.enabled: true`. The command then applies ordered gates for
1921
`CLAWSWEEPER_LIVE_PROOF_ENABLED=1`, repository opt-in, a recommended plan, a
2022
runnable configured surface, and a still-open pull request. The model also
21-
classifies the recording payoff: short static text belongs in the review as a
22-
code block, while progressive output, meaningful terminal presentation,
23-
animation, and UI interaction can justify something to watch. A `static_text`
24-
payoff is a logged successful skip before any target code runs, as is every
25-
other failed gate, including a browser recommendation for a terminal-only
26-
repository that has no configured server or URL.
23+
classifies only the presentation payoff: short static text belongs in the
24+
review as a code block, while progressive output, meaningful terminal
25+
presentation, animation, and UI interaction can justify something to watch. A
26+
`static_text` payoff still executes the real plan but bypasses all recording,
27+
transcoding, and poster work. Other failed gates remain successful skips,
28+
including a browser recommendation for a terminal-only repository that has no
29+
configured server or URL. `declined_suspicious` remains a strict no-execution
30+
gate.
2731

2832
## Execute and attach
2933

@@ -34,32 +38,40 @@ publication path described below. `execute` has
3438
PR head, and runs setup/start commands from the trusted repository profile. It
3539
contains no model call. Browser plans are serialized as JSON data into a
3640
generated plain `playwright-core` script; plan values are never inserted as
37-
source code. The script uses installed Chrome, a 1280x800 recorded context, and
38-
falls back to Playwright Chromium only when Chrome cannot launch. Terminal
39-
plans use tmux, an unauthenticated local Xvfb display with its TCP listener
40-
disabled, a fullscreen xterm, and ffmpeg `x11grab`; typed
41-
`run`, `wait`, and `expect_output` steps are replayed through the tmux pane.
42-
43-
Both drivers hold the final state on screen. Terminal commands poll for output
44-
beyond the echoed command line; browser steps settle briefly and target steps
45-
scroll the changed region into the recorded viewport. Each expectation records
41+
source code. Recorded browser runs use installed Chrome with a 1280x800 video
42+
context and fall back to Playwright Chromium only when Chrome cannot launch.
43+
Unrecorded browser runs use the same driver without Playwright video and capture
44+
the final page text. Recorded terminal plans use tmux, an unauthenticated local
45+
Xvfb display with its TCP listener disabled, a fullscreen xterm, and ffmpeg
46+
`x11grab`. Unrecorded terminal plans use only tmux and capture the pane directly.
47+
Both paths replay typed `run`, `wait`, and `expect_output` steps.
48+
49+
Terminal commands poll for output beyond the echoed command line; browser steps
50+
settle briefly. Every drive writes `live-verification.json` with the
51+
entry command or URL, every planned step and outcome, bounded captured output,
52+
the overall pass/fail result, and the verified head. A failed drive therefore
53+
becomes useful public verification evidence instead of disappearing.
54+
55+
Media has additional gates. Recorded drivers hold the final state on screen and
56+
scroll browser targets into the recorded viewport. Each expectation records
4657
whether its text was present at the start and whether the later check succeeded.
4758
A recording is eligible only when at least one expectation was absent initially
4859
and satisfied after the plan acted. A failed drive, a plan that demonstrates no
49-
such semantic change, or a recording shorter than three seconds remains a
50-
logged successful skip and emits no manifest, so those checks backstop the
51-
model's payoff judgment. Eligible completed and partial drives are transcoded
52-
to H.264 MP4 and probed with ffprobe. The command creates `poster.jpg`, enforces
53-
the repository's recording limit and a 50 MB MP4 cap, and writes
54-
`steps-log.json` plus a metadata-only `live-proof-manifest.json`. The manifest
55-
contains no media URL. The bundle is retained as a GitHub Actions artifact for
56-
seven days.
60+
such semantic change, or a recording shorter than three seconds emits no media
61+
manifest. Eligible completed and partial drives are transcoded to H.264 MP4 and
62+
probed with ffprobe. The command creates `poster.jpg`, enforces the repository's
63+
recording limit and a 50 MB MP4 cap, and writes `steps-log.json` plus the
64+
metadata-only `live-proof-manifest.json`. The manifest contains no media URL and
65+
is absent when the bundle carries verification without media. Bundles are
66+
retained as GitHub Actions artifacts for seven days.
5767

5868
The trusted `attach` job checks out only ClawSweeper `main`; it never checks out
5969
or executes target PR code. It treats the downloaded bundle as untrusted,
60-
strictly validates the manifest, rejects extra URL fields, probes the MP4 and
61-
poster again, rechecks size/duration/dimensions, and refuses a stale PR head.
62-
Only then does it upload `live-proof.mp4` and `poster.jpg` with `aws s3 cp` to:
70+
strictly validates the verification result and refuses a stale PR head. When a
71+
media manifest exists, it also rejects extra URL fields, probes the MP4 and
72+
poster again, rechecks size/duration/dimensions, and confirms the media and
73+
verification identities match. Only then does it upload `live-proof.mp4` and
74+
`poster.jpg` with `aws s3 cp` to:
6375

6476
```text
6577
live-proof/<repo-slug>/<item>/<head-sha>/live-proof.mp4
@@ -68,12 +80,16 @@ live-proof/<repo-slug>/<item>/<head-sha>/live-proof.jpg
6880

6981
The attach job constructs both public URLs from its trusted
7082
`CLAWSWEEPER_LIVE_PROOF_BASE_URL`; bundle data cannot supply a host or URL. It
71-
updates the durable report's `Live Proof` section, re-renders the existing
72-
review presentation, upserts the marker-backed comment with a target-scoped
73-
write token, updates the comment-sync front matter, and publishes the changed
74-
canonical record. OpenClaw Bay is unaffected: this lane changes a durable
75-
report and its existing GitHub comment, not Bay's observer-only data contract
76-
or controls.
83+
updates the durable report's `Live Proof` section and always renders a public
84+
`Live Verification` section containing the entry, a fenced excerpt of real
85+
output, and per-assertion pass/fail. The recording is embedded below that result
86+
only when media exists. Before rendering, untrusted output is capped and
87+
neutralized so backtick fences, HTML, and ClawSweeper-like hidden markers cannot
88+
escape the code block or create comment controls. Publication then upserts the
89+
marker-backed comment with a target-scoped write token, updates the comment-sync
90+
front matter, and publishes the changed canonical record. OpenClaw Bay is
91+
unaffected: this lane changes a durable report and its existing GitHub comment,
92+
not Bay's observer-only data contract or controls.
7793

7894
## ClawSweeper Bay demo
7995

@@ -112,12 +128,12 @@ CLAWSWEEPER_LIVE_PROOF_ENABLED=1 node dist/clawsweeper.js live-proof \
112128
current Git HEAD and logs that the live PR kind/open lookup is skipped. The
113129
environment, profile, and plan-status gates still run in their normal order.
114130

115-
To validate an attachment without GitHub, R2, or credentials, point the attach
116-
command at a local media bundle and report and supply non-secret example
117-
origins. Dry-run mode performs strict manifest/media/report validation, uses
118-
the report head for the simulated freshness check, and prints the exact two
119-
`aws s3 cp` commands, replacement report section, and marker-backed comment
120-
body without making a mutation:
131+
To validate publication without GitHub, point the attach command at a local
132+
bundle and report. A verification-only bundle needs no R2 configuration. For a
133+
media bundle, supply non-secret example origins as below. Dry-run mode performs
134+
strict result/manifest/media/report validation, uses the report head for the
135+
simulated freshness check, and prints any `aws s3 cp` commands, the replacement
136+
report section, and the marker-backed comment body without making a mutation:
121137

122138
```bash
123139
CLAWSWEEPER_LIVE_PROOF_S3_ENDPOINT=https://example.r2.cloudflarestorage.com \
@@ -160,6 +176,9 @@ comment.
160176
disposable GitHub-hosted VM is the isolation boundary.
161177
- Drivers replay only schema-validated typed steps, with at most ten actions
162178
and a recording cap of 90 seconds.
179+
- Every executed plan produces a bounded, schema-validated verification result;
180+
public output is separately capped and neutralized for Markdown fences, HTML,
181+
and marker spoofing.
163182
- The artifact manifest is metadata-only. Unknown keys, including any injected
164183
URL field, are rejected by attach.
165184
- R2 credentials, the public base URL, the canonical-record credential, and

‎prompts/review-item.md‎

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -435,37 +435,41 @@ For PRs, always fill `telegramVisibleProof`. Use `status: "needed"` only when th
435435
`telegramVisibleProof.status: "not_needed"` and
436436
`mantisRecommendation.status: "not_recommended"`.
437437

438-
For PRs, always fill `liveProofPlan`. Use `status: "recommended"` only when the
439-
change is user-visible in a UI or produces observable terminal behavior that a
440-
recording of at most 90 seconds can demonstrate, such as a rendered page
441-
change, progressive CLI output, TUI behavior, or an error message a user would
442-
see. Never
443-
recommend live proof for pure refactors, CI/config changes, docs, tests, or
444-
internal plumbing. Use `surface: "browser"` for browser behavior and
438+
For PRs, always fill `liveProofPlan`. Default to `status: "recommended"` whenever
439+
the repository has a runnable browser or terminal surface. The point is to run
440+
the real system from the PR head and verify observable behavior, not merely to
441+
run its tests. This includes refactors, internal plumbing, and CI/config changes:
442+
plan a narrow smoke verification such as “the binary still starts and prints X”
443+
or “the command still resolves Y” even when the implementation change is not
444+
user-visible. Reserve `not_applicable` for a change with genuinely nothing to
445+
run, such as docs-only edits or generated assets in a repository with no
446+
meaningful runnable surface. Use `surface: "browser"` for browser behavior and
445447
`surface: "terminal"` for terminal behavior. The `entry` must be a URL path for
446-
browser proof or a command for terminal proof. Emit at most ten deterministic,
447-
typed `steps`: browser plans may use `goto`, `click`, `fill`, `press`,
448-
`wait_for`, `wait`, and `expect_text`; terminal plans may use `run`, `wait`, and
449-
`expect_output`. Every recommended plan must include at least one state-changing
450-
step (`goto`, `click`, `fill`, or `press` for browser plans; `run` for terminal
451-
plans) and at least one expectation whose text is absent before that action and
452-
appears only afterward. Never assert a static label, hint, heading, or the typed
453-
command itself: the expectation must prove that the action changed observable
454-
state. Targets for `click`, `fill`, and `wait_for` must be valid CSS or Playwright
455-
selectors, including `text=...` selectors when appropriate, never prose
456-
descriptions of state. The plan must be demonstrable from the PR head alone
457-
without external accounts, credentials, or third-party services. Step values
458-
must never contain secrets or tokens of any kind.
459-
460-
Judge whether the recording has something worth watching. Choose
461-
`payoff.kind: "static_text"` and do not recommend a recording when the whole
462-
demonstration is a short burst of plain text that a reader could just as well
463-
read in a quoted code block. Recommend a recording only when the payoff is
464-
genuinely visual: output that streams or progresses over seconds, a TUI or
465-
interactive terminal, colored or formatted output whose presentation matters,
466-
an animation, or a browser interaction that changes what is on screen. This is
467-
a judgment call about what a viewer will actually see move or change, not a
468-
box-checking exercise; explain that visible change in `payoff.justification`.
448+
browser verification or a command for terminal verification. Emit at most ten
449+
deterministic, typed `steps`: browser plans may use `goto`, `click`, `fill`,
450+
`press`, `wait_for`, `wait`, and `expect_text`; terminal plans may use `run`,
451+
`wait`, and `expect_output`. Include at least one concrete expectation of real
452+
output. When proposing media, include at least one state-changing step and an
453+
expectation whose text is absent before that action and appears only afterward;
454+
the absent-then-present rule decides whether media is useful, not whether the
455+
system should run. Never assert the typed command itself. Targets for `click`,
456+
`fill`, and `wait_for` must be valid CSS or Playwright selectors, including
457+
`text=...` selectors when appropriate, never prose descriptions of state. The
458+
plan must be demonstrable from the PR head alone without external accounts,
459+
credentials, or third-party services. Step values must never contain secrets or
460+
tokens of any kind.
461+
462+
Judge whether the run has something worth watching, solely to choose its
463+
presentation. Choose `payoff.kind: "static_text"` when the whole demonstration
464+
is a short burst of plain text that a reader can understand better in a quoted
465+
code block; ClawSweeper must still execute the plan and publish its verification
466+
result, but it should skip video capture. Choose a visual payoff only when a
467+
recording is genuinely worth watching: output that streams or progresses over
468+
seconds, a TUI or interactive terminal, colored or formatted output whose
469+
presentation matters, an animation, or a browser interaction that changes what
470+
is on screen. This is a judgment call about what a viewer would watch, never a
471+
judgment about whether to run; explain the presentation choice in
472+
`payoff.justification`.
469473

470474
Live proof recordings are published publicly. If the diff, or the
471475
demonstration it would require, reads environment variables or credential

‎src/clawsweeper-policy.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const WAITING_ON_AUTHOR_LABEL = "status: ⏳ waiting on author";
9191
export const PROOF_OVERRIDE_LABEL = "proof: override";
9292
export const PROOF_SUFFICIENT_LABEL = "proof: sufficient";
9393
export const PROOF_NUDGE_MARKER_PREFIX = "<!-- clawsweeper-proof-nudge";
94+
export const LIVE_VERIFICATION_MARKER = "<!-- clawsweeper-live-verification -->";
9495
export const LIVE_PROOF_RECORDING_MARKER = "<!-- clawsweeper-live-proof-recording -->";
9596
export const PROOF_SUFFICIENT_LABEL_COLOR = "1A7F37";
9697
export const PROOF_SUFFICIENT_LABEL_DESCRIPTION = "Contributor real behavior proof is sufficient.";

0 commit comments

Comments
 (0)