Skip to content

Commit 03c1f45

Browse files
authored
feat(live-proof): verify live inside the review job (#1205)
Live verification ran in a separate secretless workflow, and the handoff was the fragile part: 8 of 13 finished production runs failed on stale heads, missing decision packets, or unauthenticated 403s while execution itself succeeded. Verification now runs in the review job, immediately after the decision, while the job still knows the exact head it reviewed, and its result travels in the existing review artifact to the existing publication lane. The separate workflow, dispatch action and attach-publish path are deleted; retraction stays available as a maintenance workflow. Untrusted code runs unsandboxed in a credentialed job, gated by the review's own declined_suspicious judgment. Two controls compensate: the child process inherits an environment stripped of every credential by denylist and by *_TOKEN/*_KEY/*_SECRET/*_PASSWORD/AWS_* heuristic, asserted to zero; and installs run without lifecycle scripts unless a repository opts in, since a lockfile bump can execute a postinstall the reviewed diff never shows.
1 parent 055ffba commit 03c1f45

37 files changed

Lines changed: 1679 additions & 1472 deletions

‎.github/actions/dispatch-live-proofs/action.yml‎

Lines changed: 0 additions & 92 deletions
This file was deleted.

‎.github/workflows/exact-review-batch-publish.yml‎

Lines changed: 11 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ jobs:
2929
}}
3030
runs-on: ubuntu-latest
3131
timeout-minutes: 60
32-
outputs:
33-
live_proof_matrix: ${{ steps.live-proof-dispatch-matrix.outputs.matrix }}
3432
env:
3533
EXACT_REVIEW_QUEUE_URL: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
3634
CLAWSWEEPER_AUTO_CLOSE_REASONS: ${{ vars.CLAWSWEEPER_AUTO_CLOSE_REASONS || 'all' }}
@@ -117,10 +115,21 @@ jobs:
117115
hydrate-git-state: "false"
118116
hydrate-state-blobs: "false"
119117

118+
- name: Install exact live-proof media validators
119+
if: ${{ steps.batch.outputs.claimed == 'true' && steps.batch.outputs.item_count != '0' }}
120+
run: |
121+
sudo apt-get update
122+
sudo apt-get install --yes ffmpeg
123+
120124
- name: Prepare each item independently
121125
if: ${{ steps.batch.outputs.claimed == 'true' && steps.batch.outputs.item_count != '0' }}
122126
env:
123127
CLAWSWEEPER_WEBHOOK_SECRET: ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
128+
AWS_ACCESS_KEY_ID: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_AWS_ACCESS_KEY_ID }}
129+
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_AWS_SECRET_ACCESS_KEY }}
130+
CLAWSWEEPER_LIVE_PROOF_S3_ENDPOINT: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_S3_ENDPOINT }}
131+
CLAWSWEEPER_LIVE_PROOF_BUCKET: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_BUCKET }}
132+
CLAWSWEEPER_LIVE_PROOF_BASE_URL: ${{ secrets.CLAWSWEEPER_LIVE_PROOF_BASE_URL }}
124133
GH_TOKEN: ${{ steps.target-token.outputs.token }}
125134
REPO_TOKEN: ${{ github.token }}
126135
run: |
@@ -406,32 +415,6 @@ jobs:
406415
pnpm run --silent repair:exact-review-batch observe || true
407416
pnpm run --silent repair:exact-review-batch complete
408417
409-
- name: Compose live-proof dispatch matrix from durable batch receipt
410-
id: live-proof-dispatch-matrix
411-
if: ${{ steps.batch.outputs.claimed == 'true' && steps.batch.outputs.item_count != '0' }}
412-
run: |
413-
set -euo pipefail
414-
receipt_path="$(dirname "$EXACT_REVIEW_BATCH_MANIFEST")/state-receipt.json"
415-
matrix="$(jq -c '
416-
[
417-
.outcomes[]?
418-
| select(.outcome == "accepted" or .outcome == "deduped")
419-
| .canonicalTargetKey
420-
| capture("^(?<target_repo>[^#]+)#(?<item_number>[1-9][0-9]*)$")
421-
]
422-
| unique_by(.target_repo, .item_number)
423-
| sort_by(.target_repo, (.item_number | tonumber))
424-
| group_by(.target_repo)
425-
| {
426-
include: map({
427-
target_repo: .[0].target_repo,
428-
target_slug: (.[0].target_repo | gsub("[^A-Za-z0-9_.-]+"; "-")),
429-
item_numbers: (map(.item_number) | join(","))
430-
})
431-
}
432-
' "$receipt_path")"
433-
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
434-
435418
- name: Submit batch GitHub egress telemetry
436419
if: ${{ always() && steps.github-egress-observer.outcome == 'success' }}
437420
continue-on-error: true
@@ -445,44 +428,3 @@ jobs:
445428
env:
446429
CLAWSWEEPER_WEBHOOK_SECRET: ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
447430
run: pnpm run --silent repair:exact-review-batch release
448-
449-
dispatch-live-proofs:
450-
name: Dispatch live proofs for ${{ matrix.target_repo }}
451-
needs: publish
452-
if: ${{ needs.publish.outputs.live_proof_matrix != '' && needs.publish.outputs.live_proof_matrix != '{"include":[]}' }}
453-
strategy:
454-
fail-fast: false
455-
matrix: ${{ fromJSON(needs.publish.outputs.live_proof_matrix) }}
456-
runs-on: ubuntu-latest
457-
timeout-minutes: 15
458-
env:
459-
CLAWSWEEPER_APP_CLIENT_ID: Iv23liOECG0slfuhz093
460-
steps:
461-
- uses: actions/checkout@v7
462-
with:
463-
ref: main
464-
filter: blob:none
465-
fetch-depth: 1
466-
persist-credentials: false
467-
468-
- uses: ./.github/actions/setup-pnpm
469-
with:
470-
build-script: build:repair
471-
472-
- uses: ./.github/actions/setup-state
473-
with:
474-
coordinator-url: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
475-
records-url: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
476-
records-secret: ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
477-
records-repo-slugs: ${{ matrix.target_slug }}
478-
hydrate-git-state: "false"
479-
hydrate-state-blobs: "false"
480-
481-
- name: Dispatch recommended live proofs
482-
uses: ./.github/actions/dispatch-live-proofs
483-
with:
484-
target-repo: ${{ matrix.target_repo }}
485-
item-numbers: ${{ matrix.item_numbers }}
486-
records-root: records
487-
client-id: ${{ env.CLAWSWEEPER_APP_CLIENT_ID }}
488-
private-key: ${{ secrets.CLAWSWEEPER_APP_PRIVATE_KEY }}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Maintain live proof
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
repo:
7+
description: "Target repository"
8+
required: true
9+
type: string
10+
item:
11+
description: "Pull request number"
12+
required: true
13+
type: string
14+
15+
permissions:
16+
contents: read
17+
18+
env:
19+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
20+
21+
jobs:
22+
retract:
23+
name: Retract published recording
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 15
26+
steps:
27+
- uses: actions/checkout@v7
28+
with:
29+
ref: main
30+
filter: blob:none
31+
fetch-depth: 0
32+
persist-credentials: false
33+
34+
- name: Resolve target
35+
id: target
36+
env:
37+
TARGET_REPO: ${{ inputs.repo }}
38+
ITEM_NUMBER: ${{ inputs.item }}
39+
run: |
40+
set -euo pipefail
41+
repo="$(printf '%s' "$TARGET_REPO" | tr '[:upper:]' '[:lower:]')"
42+
if ! [[ "$repo" =~ ^[a-z0-9_.-]+/[a-z0-9_.-]+$ ]] || ! [[ "$ITEM_NUMBER" =~ ^[1-9][0-9]*$ ]]; then
43+
echo "Invalid live-proof target: $repo#$ITEM_NUMBER" >&2
44+
exit 1
45+
fi
46+
{
47+
echo "repo_owner=${repo%%/*}"
48+
echo "repo_name=${repo#*/}"
49+
echo "repo_slug=${repo//\//-}"
50+
echo "item=$ITEM_NUMBER"
51+
} >> "$GITHUB_OUTPUT"
52+
53+
- name: Create target write token
54+
id: target-write-token
55+
uses: ./.github/actions/create-target-write-token
56+
with:
57+
client-id: ${{ vars.CLAWSWEEPER_APP_CLIENT_ID }}
58+
private-key: ${{ secrets.CLAWSWEEPER_APP_PRIVATE_KEY }}
59+
owner: ${{ steps.target.outputs.repo_owner }}
60+
repository: ${{ steps.target.outputs.repo_name }}
61+
62+
- uses: ./.github/actions/setup-state
63+
with:
64+
coordinator-url: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
65+
records-url: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
66+
records-secret: ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
67+
records-repo-slugs: ${{ steps.target.outputs.repo_slug }}
68+
records-item-number: ${{ steps.target.outputs.item }}
69+
hydrate-git-state: "false"
70+
hydrate-state-blobs: "false"
71+
72+
- uses: ./.github/actions/setup-pnpm
73+
with:
74+
build-script: build:all
75+
76+
- name: Capture canonical record baseline
77+
id: baseline
78+
env:
79+
REPO_SLUG: ${{ steps.target.outputs.repo_slug }}
80+
ITEM_NUMBER: ${{ steps.target.outputs.item }}
81+
run: |
82+
set -euo pipefail
83+
baseline="$RUNNER_TEMP/live-proof-retraction-baseline"
84+
BASELINE="$baseline" node --input-type=module <<'NODE'
85+
import { captureCanonicalRecordBaseline } from "./dist/repair/canonical-record-baseline.js";
86+
captureCanonicalRecordBaseline({
87+
baselineRoot: process.env.BASELINE,
88+
repositorySlug: process.env.REPO_SLUG,
89+
itemNumber: Number(process.env.ITEM_NUMBER),
90+
sources: [
91+
{
92+
section: "items",
93+
name: `${process.env.ITEM_NUMBER}.md`,
94+
path: `records/${process.env.REPO_SLUG}/items/${process.env.ITEM_NUMBER}.md`,
95+
},
96+
],
97+
});
98+
NODE
99+
echo "path=$baseline" >> "$GITHUB_OUTPUT"
100+
101+
- name: Retract recording from canonical report
102+
env:
103+
REPO_SLUG: ${{ steps.target.outputs.repo_slug }}
104+
ITEM_NUMBER: ${{ steps.target.outputs.item }}
105+
run: |
106+
node dist/clawsweeper.js live-proof-attach \
107+
--detach \
108+
--record "records/$REPO_SLUG/items/$ITEM_NUMBER.md" \
109+
--repo-slug "$REPO_SLUG" \
110+
--item "$ITEM_NUMBER"
111+
112+
- name: Publish retracted report
113+
env:
114+
CLAWSWEEPER_CANONICAL_RECORD_BASELINE_DIR: ${{ steps.baseline.outputs.path }}
115+
CLAWSWEEPER_WEBHOOK_SECRET: ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
116+
QUEUE_URL: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
117+
REPO_SLUG: ${{ steps.target.outputs.repo_slug }}
118+
ITEM_NUMBER: ${{ steps.target.outputs.item }}
119+
run: |
120+
pnpm run repair:publish-main -- \
121+
--message "chore: retract live proof recording" \
122+
--path "records/$REPO_SLUG/items/$ITEM_NUMBER.md" \
123+
--rebase-strategy normal
124+
125+
- name: Sync retracted review comment
126+
env:
127+
GH_TOKEN: ${{ steps.target-write-token.outputs.token }}
128+
REPO_SLUG: ${{ steps.target.outputs.repo_slug }}
129+
ITEM_NUMBER: ${{ steps.target.outputs.item }}
130+
run: |
131+
node dist/clawsweeper.js live-proof-comment \
132+
--detach \
133+
--record "records/$REPO_SLUG/items/$ITEM_NUMBER.md" \
134+
--repo-slug "$REPO_SLUG" \
135+
--item "$ITEM_NUMBER"

0 commit comments

Comments
 (0)