Skip to content

Commit c06a897

Browse files
authored
feat(live-proof): live-test PRs and attach recorded video proof to reviews (#1181)
* feat(review): classify deterministic live-proof plans in review decisions Reviews now always fill a liveProofPlan: a typed, machine-replayable demonstration plan (browser or terminal surface, entry point, up to ten structured steps) emitted only for user-visible changes, with a declined_suspicious status for diffs that touch credentials or look like they could exfiltrate or display sensitive data in a public recording. Report and comment rendering gain a Live Proof section that renders publicly only once a validated recording block exists, and repository profiles accept a strictly validated optional live_test block. * feat(live-proof): record and attach live PR proof videos from a secretless lane Add the live-proof execution lane: a permissions-empty ubuntu job checks out the public PR head, replays the review's typed plan deterministically (Playwright recordVideo for browser surfaces, tmux + xvfb + ffmpeg x11grab for terminal surfaces), and emits an mp4, poster, and metadata-only manifest as a workflow artifact with no secrets and no inference in the job. A trusted attach job re-validates the bundle as untrusted data, refuses stale heads, uploads to R2 itself, constructs public URLs only from its own upload, and edits the recording into the marker-backed review comment. The sweep publication job dispatches recommended live proofs for repositories that enable live_test. Live-testing the lane against #1180 caught and fixed a config-validation temporal dead zone, generated-driver module resolution that depended on bundle placement, headed browser launches on display-less runners, clicks on continuously animated targets, and launcher-only server teardown that orphaned the dev server. * feat(live-proof): enable ClawSweeper bay demo live tests in production Port the seeded Bay demo into scripts/live-proof/bay-demo (random runtime-only secret, isolated wrangler state, no external API calls), enable live_test for openclaw/clawsweeper, and define the GitHub App client id the attach job's write-token mint requires.
1 parent 682ef3a commit c06a897

42 files changed

Lines changed: 3446 additions & 30 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
name: ClawSweeper Live Proof
2+
3+
run-name: Live proof ${{ github.event.client_payload.repo || inputs.repo }}#${{ github.event.client_payload.item || inputs.item }}
4+
5+
on:
6+
repository_dispatch:
7+
types: [clawsweeper_live_proof]
8+
workflow_dispatch:
9+
inputs:
10+
repo:
11+
description: "Target repository"
12+
required: true
13+
type: string
14+
item:
15+
description: "Pull request number"
16+
required: true
17+
type: string
18+
19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
21+
CLAWSWEEPER_APP_CLIENT_ID: Iv23liOECG0slfuhz093
22+
23+
jobs:
24+
execute:
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 30
27+
permissions: {}
28+
outputs:
29+
produced: ${{ steps.run.outputs.produced }}
30+
repo: ${{ steps.target.outputs.repo }}
31+
item: ${{ steps.target.outputs.item }}
32+
repo_owner: ${{ steps.target.outputs.repo_owner }}
33+
repo_name: ${{ steps.target.outputs.repo_name }}
34+
repo_slug: ${{ steps.target.outputs.repo_slug }}
35+
steps:
36+
- uses: actions/checkout@v7
37+
with:
38+
ref: main
39+
persist-credentials: false
40+
41+
- name: Resolve target and decision artifact
42+
id: target
43+
env:
44+
EVENT_REPO: ${{ github.event.client_payload.repo || inputs.repo }}
45+
EVENT_ITEM: ${{ github.event.client_payload.item || inputs.item }}
46+
LIVE_PROOF_PLAN_JSON: ${{ toJSON(github.event.client_payload.live_proof_plan) }}
47+
run: |
48+
set -euo pipefail
49+
repo="$(printf '%s' "$EVENT_REPO" | tr '[:upper:]' '[:lower:]')"
50+
item="$EVENT_ITEM"
51+
if ! [[ "$repo" =~ ^[a-z0-9_.-]+/[a-z0-9_.-]+$ ]] || ! [[ "$item" =~ ^[1-9][0-9]*$ ]]; then
52+
echo "Invalid live-proof target: $repo#$item" >&2
53+
exit 1
54+
fi
55+
repo_owner="$(cut -d/ -f1 <<<"$repo")"
56+
repo_name="$(cut -d/ -f2 <<<"$repo")"
57+
repo_slug="$(tr / - <<<"$repo")"
58+
if [ -n "$LIVE_PROOF_PLAN_JSON" ] && [ "$LIVE_PROOF_PLAN_JSON" != "null" ]; then
59+
printf '%s\n' "$LIVE_PROOF_PLAN_JSON" | jq -e . > /tmp/live-proof-plan.json
60+
else
61+
printf '%s\n' '{"status":"not_applicable","surface":"none","reason":"Manual dispatch did not include a publication plan.","entry":"","steps":[]}' > /tmp/live-proof-plan.json
62+
echo "::notice::No publication plan was supplied; the execution gate will complete as a safe skip."
63+
fi
64+
node --input-type=module <<'NODE'
65+
import { readFileSync, writeFileSync } from "node:fs";
66+
const plan = JSON.parse(readFileSync("/tmp/live-proof-plan.json", "utf8"));
67+
const steps = Array.isArray(plan.steps)
68+
? plan.steps.map((step) => "- " + JSON.stringify(step)).join("\n")
69+
: "";
70+
const report = [
71+
"## Live Proof",
72+
"",
73+
"Status: " + String(plan.status || ""),
74+
"",
75+
"Surface: " + String(plan.surface || ""),
76+
"",
77+
"Reason: " + String(plan.reason || ""),
78+
"",
79+
"Entry: " + String(plan.entry || ""),
80+
"",
81+
"Steps:",
82+
"",
83+
steps,
84+
"",
85+
].join("\n");
86+
writeFileSync("live-proof-report.md", report, "utf8");
87+
NODE
88+
{
89+
echo "repo=$repo"
90+
echo "item=$item"
91+
echo "repo_owner=$repo_owner"
92+
echo "repo_name=$repo_name"
93+
echo "repo_slug=$repo_slug"
94+
} >> "$GITHUB_OUTPUT"
95+
96+
- uses: ./.github/actions/setup-pnpm
97+
with:
98+
build-script: build
99+
100+
- name: Install deterministic recording tools
101+
run: |
102+
sudo apt-get update
103+
sudo apt-get install --yes ffmpeg tmux xvfb xterm
104+
105+
- name: Check out the public PR head
106+
env:
107+
TARGET_REPO: ${{ steps.target.outputs.repo }}
108+
ITEM_NUMBER: ${{ steps.target.outputs.item }}
109+
run: |
110+
set -euo pipefail
111+
curl --fail --silent --show-error --max-time 30 \
112+
"https://api.github.com/repos/$TARGET_REPO/pulls/$ITEM_NUMBER" > /tmp/live-proof-pr.json
113+
head_sha="$(jq -r '.head.sha // empty' /tmp/live-proof-pr.json)"
114+
clone_url="$(jq -r '.head.repo.clone_url // empty' /tmp/live-proof-pr.json)"
115+
if ! [[ "$head_sha" =~ ^[0-9a-f]{40}$ ]] || [ -z "$clone_url" ]; then
116+
echo "Unable to resolve the public PR head." >&2
117+
exit 1
118+
fi
119+
git clone --filter=blob:none --no-checkout "$clone_url" target-pr
120+
git -C target-pr fetch --depth=1 origin "$head_sha"
121+
git -C target-pr checkout --detach "$head_sha"
122+
123+
- name: Execute secretless live proof
124+
id: run
125+
working-directory: target-pr
126+
env:
127+
CLAWSWEEPER_LIVE_PROOF_ENABLED: ${{ vars.CLAWSWEEPER_LIVE_PROOF_ENABLED }}
128+
run: |
129+
set -euo pipefail
130+
setsid timeout --kill-after=30s 1500s node ../dist/clawsweeper.js live-proof \
131+
--repo "${{ steps.target.outputs.repo }}" \
132+
--item "${{ steps.target.outputs.item }}" \
133+
--record ../live-proof-report.md \
134+
--output ../live-proof-bundle
135+
if [ -f ../live-proof-bundle/live-proof-manifest.json ]; then
136+
echo "produced=true" >> "$GITHUB_OUTPUT"
137+
else
138+
echo "produced=false" >> "$GITHUB_OUTPUT"
139+
fi
140+
141+
- uses: actions/upload-artifact@v7
142+
if: ${{ steps.run.outputs.produced == 'true' }}
143+
with:
144+
name: live-proof-${{ steps.target.outputs.repo_slug }}-${{ steps.target.outputs.item }}
145+
path: live-proof-bundle
146+
if-no-files-found: error
147+
retention-days: 7
148+
149+
attach:
150+
needs: execute
151+
if: ${{ needs.execute.outputs.produced == 'true' }}
152+
runs-on: ubuntu-latest
153+
timeout-minutes: 15
154+
permissions:
155+
contents: read
156+
steps:
157+
- uses: actions/checkout@v7
158+
with:
159+
ref: main
160+
persist-credentials: false
161+
162+
- name: Create target write token
163+
id: target-write-token
164+
uses: ./.github/actions/create-target-write-token
165+
with:
166+
client-id: ${{ env.CLAWSWEEPER_APP_CLIENT_ID }}
167+
private-key: ${{ secrets.CLAWSWEEPER_APP_PRIVATE_KEY }}
168+
owner: ${{ needs.execute.outputs.repo_owner }}
169+
repository: ${{ needs.execute.outputs.repo_name }}
170+
171+
- uses: ./.github/actions/setup-state
172+
with:
173+
coordinator-url: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
174+
records-url: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
175+
records-secret: ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
176+
records-repo-slugs: ${{ needs.execute.outputs.repo_slug }}
177+
records-item-number: ${{ needs.execute.outputs.item }}
178+
hydrate-git-state: "false"
179+
hydrate-state-blobs: "false"
180+
181+
- uses: ./.github/actions/setup-pnpm
182+
with:
183+
build-script: build:all
184+
185+
- name: Install media validators
186+
run: |
187+
sudo apt-get update
188+
sudo apt-get install --yes ffmpeg
189+
190+
- uses: actions/download-artifact@v8
191+
with:
192+
name: live-proof-${{ needs.execute.outputs.repo_slug }}-${{ needs.execute.outputs.item }}
193+
path: live-proof-bundle
194+
195+
- name: Validate, upload, and attach live proof
196+
env:
197+
AWS_ACCESS_KEY_ID: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_AWS_ACCESS_KEY_ID }}
198+
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_AWS_SECRET_ACCESS_KEY }}
199+
CLAWSWEEPER_LIVE_PROOF_S3_ENDPOINT: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_S3_ENDPOINT }}
200+
CLAWSWEEPER_LIVE_PROOF_BUCKET: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_BUCKET }}
201+
CLAWSWEEPER_LIVE_PROOF_BASE_URL: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_BASE_URL }}
202+
CLAWSWEEPER_WEBHOOK_SECRET: ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
203+
GH_TOKEN: ${{ steps.target-write-token.outputs.token }}
204+
QUEUE_URL: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
205+
run: |
206+
set -euo pipefail
207+
record="records/${{ needs.execute.outputs.repo_slug }}/items/${{ needs.execute.outputs.item }}.md"
208+
node dist/clawsweeper.js live-proof-attach \
209+
--bundle live-proof-bundle \
210+
--record "$record"
211+
pnpm run repair:publish-main -- \
212+
--message "chore: attach live proof" \
213+
--path "$record" \
214+
--rebase-strategy normal

‎.github/workflows/sweep.yml‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4745,6 +4745,58 @@ jobs:
47454745
--artifact-dir artifacts \
47464746
--report-dir "records/$target_slug/items"
47474747
4748+
- name: Dispatch recommended live proofs
4749+
if: ${{ always() && !cancelled() && steps.commit-review-records.outputs.records_published == 'true' }}
4750+
env:
4751+
GH_TOKEN: ${{ github.token }}
4752+
TARGET_REPO: ${{ needs.plan.outputs.target_repo }}
4753+
run: |
4754+
set -euo pipefail
4755+
item_numbers="$(pnpm run --silent workflow -- artifact-item-numbers --artifact-dir artifacts)"
4756+
TARGET_REPO="$TARGET_REPO" ITEM_NUMBERS="$item_numbers" node --input-type=module <<'NODE' > /tmp/live-proof-candidates.jsonl
4757+
import { readFileSync } from "node:fs";
4758+
import { reportLiveProofPlan } from "./dist/clawsweeper.js";
4759+
import { repositoryProfileFor } from "./dist/repository-profiles.js";
4760+
4761+
const repo = process.env.TARGET_REPO || "";
4762+
const profile = repositoryProfileFor(repo);
4763+
if (!profile.liveTest?.enabled) process.exit(0);
4764+
for (const item of (process.env.ITEM_NUMBERS || "").split(",").filter(Boolean)) {
4765+
const path = "records/" + profile.slug + "/items/" + item + ".md";
4766+
let markdown;
4767+
try {
4768+
markdown = readFileSync(path, "utf8");
4769+
} catch {
4770+
continue;
4771+
}
4772+
const plan = reportLiveProofPlan(markdown);
4773+
if (plan.status === "recommended") {
4774+
process.stdout.write(JSON.stringify({ item: Number(item), plan }) + "\n");
4775+
}
4776+
}
4777+
NODE
4778+
if [ ! -s /tmp/live-proof-candidates.jsonl ]; then
4779+
echo "No published review requested an enabled live proof."
4780+
exit 0
4781+
fi
4782+
while IFS= read -r candidate; do
4783+
item="$(jq -r '.item' <<<"$candidate")"
4784+
plan="$(jq -c '.plan' <<<"$candidate")"
4785+
jq -n \
4786+
--arg repo "$TARGET_REPO" \
4787+
--arg item "$item" \
4788+
--argjson plan "$plan" \
4789+
'{
4790+
event_type: "clawsweeper_live_proof",
4791+
client_payload: {
4792+
repo: $repo,
4793+
item: $item,
4794+
live_proof_plan: $plan
4795+
}
4796+
}' | gh api --method POST "repos/$GITHUB_REPOSITORY/dispatches" --input -
4797+
echo "Dispatched live proof for $TARGET_REPO#$item."
4798+
done < /tmp/live-proof-candidates.jsonl
4799+
47484800
- name: Dispatch vision-fit implementation candidates
47494801
if: ${{ always() && !cancelled() && steps.commit-review-records.outputs.records_published == 'true' && vars.CLAWSWEEPER_AUTO_IMPLEMENT_ISSUES == '1' && needs.plan.outputs.target_repo == 'openclaw/openclaw' && vars.CLAWSWEEPER_AUTO_IMPLEMENT_VISION_FIT == '1' }}
47504802
env:

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ checkpoint, and status-only commits are intentionally omitted.
5353

5454
### Added
5555

56+
- Enabled browser live proof for ClawSweeper with a self-contained local OpenClaw Bay launcher and seeded lifecycle/workflow demo data.
57+
- Added an opt-in live-proof lane that records typed browser or terminal plans in a secretless PR-head job, validates and uploads media from a separate trusted job, and attaches only trusted R2 URLs to the durable review comment.
5658
- Status dashboard facelift: an at-a-glance subsystem health strip in the hero (review handoff, work execution, incidents, apply lane, coverage) and a new Fleet Review Coverage section backed by a public `/api/review-coverage` endpoint that summarizes trailing-7-day review coverage per fleet (coverage %, stale/failed/pending counts) from canonical Durable Object item records.
5759
- Cut cluster repair intake over to durable state publication: intake appends an authenticated intent (exact job bytes, digest, store identity, selector report) and hydrates with a read-only non-persisted state credential; result publication mints its target-read token for the validated worker target repositories, projects exact changed state paths, and publisher-rerun failures no longer block subsequent self-heal. Thanks @RomneyDa! (#873)
5860
- Added authenticated Worker blob endpoints (`/internal/state/blobs/*`) that serve the `ledger/v1` and `assets` state trees from R2 with create-only immutable ledger writes, a cursor-resumable `migrate-state-blobs` workflow with digest verification, and an opt-in `CLAWSWEEPER_LEDGER_SOURCE=worker` dual-read in `hydrate-state` (default stays git).

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ At a high level ClawSweeper:
3636
- reviews open issues and pull requests on a schedule and on exact GitHub events
3737
- writes one durable markdown report per item in generated state
3838
- syncs one marker-backed public review comment per issue or PR, edited in place
39+
- can record and attach deterministic browser or terminal live proof for
40+
user-visible changes in explicitly opted-in repositories
3941
- closes only unchanged, high-confidence, policy-allowed proposals
4042
- routes maintainer commands such as `@clawsweeper review`,
4143
`@clawsweeper fix`, `@clawsweeper autofix`, and `@clawsweeper automerge`

‎config/documentation-site.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"name": "Review and policy",
1010
"pages": [
1111
"commit-sweeper.md",
12+
"live-proof.md",
1213
"review-cache.md",
1314
"pr-review-comments.md",
1415
"pr-proof-triage-dashboard.md",

‎config/target-repositories.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929
"changed_gate": {
3030
"command": "pnpm check:changed",
3131
"required_script": "check:changed"
32+
},
33+
"live_test": {
34+
"enabled": true,
35+
"surface_default": "browser",
36+
"setup": ["pnpm install --frozen-lockfile"],
37+
"start": "./scripts/live-proof/bay-demo/start.sh",
38+
"url": "http://127.0.0.1:8787",
39+
"ready_timeout_seconds": 240,
40+
"max_recording_seconds": 90
3241
}
3342
},
3443
{

‎docs/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ everything else requires human comparison with current main.
105105
- [PR review comments](pr-review-comments.md) — active; review-thread handling
106106
- [Related issue discovery](related-issue-discovery.md) — active; duplicate and
107107
adjacent-report context
108+
- [Live proof](live-proof.md) — active; secretless browser/terminal execution,
109+
trusted media attachment, and local simulation
108110

109111
`docs/proof/**` contains inspectable artifacts for specific changes. Those
110112
files support their recorded claim but do not override current runbooks.

0 commit comments

Comments
 (0)