clawsweeper icon indicating copy to clipboard operation
clawsweeper copied to clipboard

Proposal: reproduce and attest real behavior proof instead of only reading it

Open yetval opened this issue 4 months ago • 4 comments

This is something I would like to work/collaborate on please dont open a PR for this!

TL;DR

  • ClawSweeper judges whether a PR's "real behavior proof" is sufficient by having a model read the pasted evidence. The resulting proof: sufficient label is then trusted by its duplicate/superseded-close safety checks. It never re-runs the proof (grep -rn "attest" src/ = 0).
  • This adds a bounded lane that reproduces proof for the reproducible subset: run the declared reproduction on base vs head in a network-denied, no-credential sandbox, require a behavior delta, and write a head-pinned attestation the close check can prefer over the model's label, behind a default-off flag.
  • Deterministic and fail-closed, staged so the mutation-free reproduce-and-attest lands first and the sandbox plus the label-trusting change get explicit maintainer review.

Summary

ClawSweeper's "real behavior proof" is a single model judgment. A Codex review, granted live network to fetch attacker-controlled PR body, links, screenshots, and video (clawsweeper.ts:7326), emits a RealBehaviorProof object (clawsweeper.ts:426). Deterministic code then turns status === "sufficient" into the proof: sufficient label (clawsweeper.ts:11130). That label, plus the model's report status, is what the proof-nudge lanes and the duplicate/superseded-close safety checks trust: proofPassedInLabels inside the covering-close safety check (apply-result.ts:1104) and its canonical-close sibling unsafeCanonicalPullRequestReason (clawsweeper.ts:13612). ClawSweeper never re-runs the declared reproduction (grep -rn "attest" src/ = 0).

Scope this precisely: the automerge gate does not read a proof regex; it gates on checks plus exact-head trusted ClawSweeper review readiness (automerge-shepherd.ts:42-82). So the trust a reproduction lane displaces is the proof label and the close-safety checks, not the merge decision itself.

This proposes a bounded Proof Reproduction and Attestation lane: for the narrow subset where a reproduction is actually declared and offline-deterministic, ClawSweeper checks out base and head in a network-denied, de-privileged, no-credential sandbox, runs the reproduction, captures exit codes and output hashes, requires a behavior delta (old on base, new on head), and writes a head-SHA-pinned attestation next to the model verdict. A valid attestation can then be preferred over the model-derived label at apply-result.ts:1104, behind a default-off flag.

It is staged so the mutation-free parts land first and the label-trusting change stays maintainer-gated.

How proof is trusted today, and where it breaks:

flowchart TD
  A["Contributor writes proof claim in PR body"] --> B["Codex review reads PR body, links, media<br/>(live network granted, clawsweeper.ts:7326)"]
  B --> C["Model emits RealBehaviorProof<br/>status and evidenceKind only, no command, no SHA, no hash<br/>(clawsweeper.ts:426)"]
  C --> D["Deterministic: status sufficient becomes label proof: sufficient<br/>(clawsweeper.ts:11130)"]
  D --> E{"Close-safety checks trust the label/report<br/>proofPassedInLabels (apply-result.ts:1104)<br/>unsafeCanonicalPullRequestReason (clawsweeper.ts:13612)"}
  E -->|"label or report matches"| F["Admit duplicate / superseded / canonical CLOSE"]
  B -. "BREAK: attacker-controlled media can steer the judgment; reproduction is never re-run (attest = 0)" .-> C
  E -. "BREAK: close-safety trusts a model-derived label, no reproduction, no head SHA, no hash" .-> F

Update (2026-07-05): Re-verified against main after #424 ("keep Mantis focused on QA proof"). The core chain is unchanged: proof is still a model read (RealBehaviorProof), the proof: sufficient label is still derived from status, and the close-safety anchor apply-result.ts:1104 is byte-identical. #424 narrows Mantis to proof-only (reproduce or inspect Telegram/Discord/web-UI-chat surfaces and return redacted evidence, never mutate GitHub state) and drops the slack_desktop_smoke/visual_task schema arms in favor of web_ui_chat_proof, the same reproduce-and-inspect philosophy this proposal extends into deterministic, close-safety-grade reproduction. Symbol names below are authoritative; clawsweeper.ts line numbers are pinned to the filing SHA and have since drifted by roughly +1 to +90 (e.g. the label-sync helper nextRealBehaviorProofSufficientLabels is now near :11216, the canonical-close helper unsafeCanonicalPullRequestReason near :13706).

Full proposal (background, current state, approach, scopes, and the other diagrams)

Current state (verified on main)

  • clawsweeper.ts:224,426 - RealBehaviorProof records what kind of thing the contributor showed (status/summary/evidenceKind), never what ClawSweeper observed. No captured output, no head SHA, no hash, no command field.
  • clawsweeper.ts:11130 - the proof: sufficient label is written deterministically from the model status.
  • apply-result.ts:1104 and clawsweeper.ts:13612 - two close safety checks trust that label/report via /^proof:\s*(sufficient|override)\b/i to decide whether a covering or canonical PR can close another. Automerge itself gates on checks and exact-head review readiness, not this label (automerge-shepherd.ts:42-82).
  • grep -rn "attest" src/ returns 0. The repair lane already checks out head and runs repo gate commands (target-validation.ts:230), so the novelty here is the base-vs-head delta plus a durable attestation record, not first-ever head execution.
  • codex-env.ts:67-88 - containment is credential stripping only; there is no egress firewall, and the review lane runs with live network on purpose so it can fetch proof media.

Motivation

Reproduction closes the one unverified link in a system built on evidence over volume:

  • A pasted proof can be fabricated, stale (captured from an old commit, not the current head), or mock-only that looked live. A re-run cannot be fooled the way a reader can.
  • For the reproducible subset it removes the model, and its prompt-injection surface, from the close safety decision. The model stays the sole owner of proof for all visual and non-reproducible evidence.
  • It converts a semantic trust problem (did a model get fooled by hostile words) into an isolation trust problem (can we run untrusted code without leaking creds or reaching the network), a closed and auditable discipline.

Proposed approach

Reproduction is deterministic, not model-driven: run the declared repro on base then head, require old behavior on base and new behavior on head, and decide on exit codes and output hashes only. Captured stdout is attacker-controlled and never flows back into a decision or a model. Flaky or non-differentiating repros go neutral, never green.

One honest gap up front: there is no machine-runnable, contributor-declared repro command today. RealBehaviorProof has no command field, and validation_commands is a repo-level gate, not a per-contributor proof. So this proposes a new optional structured reproCommand field (allow-list normalized through the existing runAllowedValidationCommands path), and scopes the first stage to cases where either that field is present or the repo's own changed-surface gate is itself the proof (behavior-preserving refactors). Everything else stays human-owned until the field exists.

flowchart TD
  A["PR blocked on proof"] --> B{"evidenceKind reproducible?<br/>terminal / logs / live_output (clawsweeper.ts:231)"}
  B -->|"no (screenshot, telegram, web_ui_chat)"| H["Leave human/mantis proof queue (clawsweeper.ts:252)"]
  B -->|"yes"| C{"repro resolvable?<br/>reproCommand OR changed_gate-as-proof"}
  C -->|"no"| N["verdict: neutral"]
  C -->|"yes"| S{"netns created?<br/>sudo unshare --net on Blacksmith"}
  S -->|"no"| N
  S -->|"yes"| D["De-privileged subprocess, no creds<br/>codexEnv strip + isolateGitHubConfigDir"]
  D --> E["Run base, base-again, head<br/>capture exit + sha256 hash"]
  E --> F{"base stable?<br/>base_1 equals base_2"}
  F -->|"no (flaky)"| N
  F -->|"yes"| G{"head differs from base?"}
  G -->|"no"| N
  G -->|"yes"| K["verdict: attested<br/>write records/[slug]/proof/[n].json + head-pinned comment"]
  N --> L["No proof: attested label; stays as-is"]
  K --> M{"gate flag on AND head matches?<br/>(apply-result.ts:1104, default-off)"}
  M -->|"yes"| P["Prefer attestation over label in close-safety"]
  M -->|"no / stale head"| Q["Fall back to existing label path"]

Example attestation record shape:

{
  "schema_version": 1,
  "head_sha": "abc123...",
  "base_sha": "def456...",
  "repro": { "command": "pnpm vitest run path/to/regression", "source": "repro_command_field" },
  "before": { "ref": "base", "exit": 1, "output_hash": "sha256:..." },
  "base_stability": { "second_exit": 1, "stable": true },
  "after": { "ref": "head", "exit": 0, "output_hash": "sha256:..." },
  "differentiates": true,
  "verdict": "attested"
}

Example comment shape, posted beside (not replacing) the model verdict:

Proof reproduction (head abc123):
- base def456: FAIL (exit 1)
- head abc123: PASS (exit 0)
- behavior delta confirmed across the diff
Reproduction output withheld (attacker-controlled input; only exit codes and hashes are trusted).
Model proof verdict: sufficient. This attestation was produced by re-running the declared reproduction.

Scopes (staged)

  1. Read-only reproduce and attest beside the model verdict. Touches no gate, no dashboard. Mutates nothing.
  2. Dashboard surface: show reproduced vs not-reproduced on /pr-proof-triage, with fixtures.
  3. Gate integration: prefer a valid head-pinned attestation over the model-derived label in the close safety check (apply-result.ts:1104), behind a default-off flag. Security-boundary change, maintainer-gated.
flowchart TD
  S1["Scope 1: reproCommand field + reproduce + attest beside verdict<br/>read-only, no gate change<br/>reproduce-proof.ts, proof-attestation.ts, schema/repair"] --> S2["Scope 2: dashboard surface<br/>proof: attested label + view<br/>dashboard/worker.ts + fixture"]
  S2 --> S3["Scope 3: gate integration<br/>validAttestationForHead preferred over label<br/>apply-result.ts:1104, default-off flag, maintainer-gated"]
  S1 -. "no mutation risk; lands first" .-> S1
  S3 -. "close-safety + containment + schema change; maintainer sign-off" .-> S3

Cost

Cheap where it counts: reproduction is deterministic runner time, not model tokens, and for the reproducible subset it can remove the high-reasoning proof-judgment call. It runs only on the small set of PRs with a resolvable offline repro, reuses runs the repair lane already performs, rides existing workers.max/lane caps, and offsets human proof-triage and bad closes.

Non-goals

  • No new close path; reproduction feeds the existing safety checks, it does not create a parallel one.
  • No auto-green on visual-only proof; screenshots, recordings, and telegram/discord/web-UI-chat proof stay human-owned and are cleanly segregated so the human queue shrinks.
  • No model in the reproduction decision; the model still advises, deterministic code decides.
  • No trust of a stale or head-mismatched attestation.
  • No reliance on a runner firewall that does not exist; egress denial is part of scope, fail-closed if it cannot be established.
  • No change to the review lane's intentional network access (it needs it to fetch proof media).
  • No change to the automerge gate, which does not read a proof regex.

Open questions (called out rather than hidden)

  • Egress denial runs on Blacksmith self-hosted runners; unprivileged unshare --net needs sudo or user namespaces and may be constrained by the Ubuntu 24.04 AppArmor userns default. Needs a one-line runner probe; the lane fails closed to neutral if a namespace cannot be created.
  • Adoption is the real gating risk: contributors (or the review model) must supply a reproCommand, or the lane only covers changed-surface-is-the-proof cases.
  • A network-denied sandbox narrows the auto-attestable set to reproducible and offline-deterministic proof, which is smaller than all terminal/logs/live_output; non-deterministic repros (timestamps, temp paths, flaky tests) correctly go neutral.

Acceptance criteria

  • A resolvable offline repro where base fails and head passes produces a schema-valid, head-pinned attestation and a marker comment beside the model verdict.
  • Non-differentiating, flaky-base, timed-out, netns-unavailable, or unresolvable-command cases produce neutral, never a pass.
  • Raw reproduction output never appears in a decision, a model prompt, or a label; only exit codes and hashes do.
  • The repro subprocess has no network egress and no GitHub/OpenAI/proof-inspection credentials.
  • With the flag on, a valid head-matched attestation admits the covering close without a proof: label; a stale or absent one falls back to the existing label check with no weakening.
  • Visual-kind proof paths are unchanged; the dashboard change ships with fixtures.
  • The sandbox and the label-trusting change carry explicit maintainer review.
Everything that will be done (full implementation dossier)

Verified receipts

Claim Location Verified fact
Proof is one model judgment clawsweeper.ts:224-230, :426-431 interface RealBehaviorProof { status; summary; evidenceKind; needsContributorAction }. No captured output, no SHA, no hash, no command field.
Judgment parsed as shape only clawsweeper.ts:2911-2927 parseRealBehaviorProof = rejectUnexpectedKeys + requireEnum + requireString/requireBoolean; content is whatever the model said.
Model status becomes the label clawsweeper.ts:11125-11132 nextRealBehaviorProofSufficientLabels: pushes PROOF_SUFFICIENT_LABEL iff proof.status === "sufficient".
Close-safety checks trust the label/report apply-result.ts:1104; clawsweeper.ts:13605-13613 proofPassedInLabels (covering-close safety validatePrCloseCoverageCoveringSafety) and the canonical-close unsafeCanonicalPullRequestReason (:13615) both trust /^proof:\s*(sufficient|override)\b/i and/or reportRealBehaviorProof(...).status.
Automerge does NOT gate on proof regex automerge-shepherd.ts:42-82 Gates on merged/state/head-change, hasTrustedHumanReviewForHead, hasTrustedRepairRequestForHead, checkBlockReason, hasTrustedPassForHead, mergeable state. No proof-label read.
No reproduction anywhere grep -rn "attest" src/ = 0 src/pr-close-coverage-proof.ts and the config builder prCloseCoverageProofRuntime (apply-result.ts:1443-1479, reasoningEffort:"high", timeoutMs:900000) are distinct model decisions, not re-runs.
Review prompt fetches attacker media over live network clawsweeper.ts:7326-7329 "You may use the available network and read-only GitHub token to inspect PR body links, comments, screenshots, videos, logs... Download proof artifacts... before inspecting them." Network is intentional (visual-proof inspection).
Containment today = credential stripping codex-env.ts:67-88 codexEnv() deletes GH_TOKEN, GITHUB_TOKEN, CLAWSWEEPER_PROOF_INSPECTION_TOKEN, CLAWSWEEPER_APP_*, crabfleet tokens, optionally OpenAI keys. No egress control.
Validation env does NOT strip the proof token target-validation.ts:507-519 targetValidationEnv() strips GH_TOKEN/GITHUB_TOKEN/OPENAI_API_KEY/CODEX_* but not CLAWSWEEPER_PROOF_INSPECTION_TOKEN, CLAWSWEEPER_APP_*, or crabfleet tokens. Naive reuse would leak the proof token into an untrusted repro subprocess.
Repair already runs contributor validation in a checkout fix-prompt-builder.ts:245-255; target-validation.ts:230-262 runAllowedValidationCommands runs via runCommand -> spawnSync (command-runner.ts:24); no network restriction, full runner network.
validation_commands is a repo-level gate, not a per-contributor repro deterministic-automerge-result.ts:63; commit-finding-intake.ts:520 deterministicAutomergeValidationCommands(repo) / validationCommands(repo) return e.g. ["pnpm check:changed"]. Repo-canonical, not the contributor's proof.
Exact-head staleness check exists comment-router-core.ts:1053-1066 reviewedHeadShaBlockReason({expectedHeadSha, currentHeadSha, markerName}), reusable verbatim for attestation freshness.
Head-SHA-keyed durable markers exist comment-router-core.ts:2283; apply-result.ts:1556 HTML-comment markers keyed by head SHA, found/updated in place.
Execution runs on Blacksmith self-hosted repair-comment-router.yml; repair-cluster-worker.yml Worker default blacksmith-4vcpu-ubuntu-2404, execution default blacksmith-16vcpu-ubuntu-2404. Review lane uses ubuntu-latest.
No model-free Codex sandbox exec in-repo grep -rn "codex debug|landlock|seatbelt|sandbox-exec" src/ = 0 No evidence ClawSweeper wraps a deterministic command in the Codex sandbox today.
Mantis proof-only scenarios to segregate clawsweeper.ts:252-260 MantisRecommendationScenario; post-#424 the emittable schema enum is telegram/discord/web_ui_chat_proof (dropped slack_desktop_smoke/visual_task). Mantis is now proof-only: reproduce or inspect and return redacted evidence, never mutate.
Reproducible vs visual evidence kinds clawsweeper.ts:231-239 Reproducible: terminal, logs, live_output. Visual: screenshot, recording.
Dashboard proof surface is label-driven dashboard/worker.ts:2693,5020,5044,5712 Views/columns derive from labels via GraphQL search; proofStateFromLabels maps labels to a proof_state cell.
Records path convention event-record-store.ts:24; commit-sweeper.ts:74,69,63 records/<repo-slug>/<kind>/<id>; helpers repoSlug and assertSha (40-hex), currently file-private and duplicated in spirit elsewhere.

Security model and residual risk

Reproduction runs the declared command on head. That command is arbitrary untrusted code on a Blacksmith self-hosted runner. Two invariants:

Invariant 1 - no egress. None exists today. runAllowedValidationCommands uses spawnSync under targetValidationEnv(), which leaves full runner network and does not strip the proof/app/crabfleet tokens (target-validation.ts:507-519). A naive reuse would let attacker code exfiltrate CLAWSWEEPER_PROOF_INSPECTION_TOKEN (a live GitHub identity) and reach Blacksmith-internal services.

Invariant 2 - captured stdout is attacker-controlled and never re-enters a decision. Only exit codes + output hashes + a recomputed differentiates flag may gate. Raw output is stored truncated/redacted for human view only, never fed to a model or a label.

Containment primitive (recommended): run the declared repro as a deterministic subprocess (no model), and for egress denial wrap it in a network namespace via sudo unshare --net on Blacksmith.

  • Blacksmith runners grant passwordless sudo; sudo unshare --net -- <run repro as de-privileged user> gives the subprocess a loopback-only stack. Plain unprivileged unshare --net needs CAP_SYS_ADMIN, and Ubuntu 24.04 defaults kernel.apparmor_restrict_unprivileged_userns=1, so the sudo path (or unshare --user --map-root-user --net) is required, not optional.
  • Inside the namespace, drop back to a de-privileged user before executing untrusted code.
  • Layer credential stripping: apply codexEnv()-style deletion (codex-env.ts:67-88, which does strip the proof/app/crabfleet tokens) over targetValidationEnv(), plus scrubGitHubCredentialEnv() (commit-sweeper.ts:426) and isolateGitHubConfigDir() (commit-sweeper.ts:436). The proof token is used only to check out refs before the sandbox closes and is never present in the repro subprocess env.
  • Fail-closed: if a network namespace cannot be created (missing sudo, kernel restriction, non-Linux), the lane returns NEUTRAL, never attested. It never falls back to an unconfined run.

Residual risk (stated plainly):

  • unshare --net isolates the repro subprocess, not sibling CI steps. A repro that re-execs itself out of the namespace, or a runner image where the netns cannot be created, is a gap - handled by fail-closed NEUTRAL, but it shrinks coverage.
  • Local CPU/disk abuse remains even with egress denied. Bound by the existing validation timeout (target-validation.ts:507-525), lane caps, and a disk-scoped temp checkout.
  • Attacker-controlled stdout must never gate - only exit code + hash + recomputed delta.
  • Hash-equality can be gamed by a repro that prints a timestamp (trivially differs base vs head). Mitigation: run base twice; require base_1 == base_2 (stable) and head != base. Any non-determinism -> NEUTRAL.

Command source decision (load-bearing)

There is no structured, machine-runnable contributor reproduction command today. RealBehaviorProof has no command field, and validation_commands is a repo-level canonical gate (deterministic-automerge-result.ts:63, commit-finding-intake.ts:520), not a per-contributor proof repro. The lane cannot claim a source that does not exist. So this is an explicit design decision:

  1. Add an optional structured field realBehaviorProof.reproCommand (string, nullable), populated by the review model and/or the contributor, allow-list-normalized through runAllowedValidationCommands (target-validation.ts:230) before execution. Extends the strict parser (clawsweeper.ts:2911) with one requireNullableString field and a schema-version bump.
  2. Stage 1 engages only when a reproduction actually exists: the repo's canonical changed_gate is the proof (behavior-preserving refactors, where "run the changed-surface gate on base vs head" is a meaningful delta), or a reproCommand is present on the report.

Everything else stays human-owned until the field is populated. Adoption of reproCommand, not execution, is the real gating risk.

Design

Reproduction engine (src/repair/reproduce-proof.ts, new):

  • Inputs: repo, PR number, base_sha, head_sha, resolved repro command (from reproCommand or the repo changed_gate).
  • Checkout: temp worktree mirroring the local-range-<ts>-<pid> pattern (clawsweeper.ts:6885), clean-tree enforced via dirtyWorktree() (commit-sweeper.ts:420).
  • Execution (in the netns sandbox, no model): checkout base -> run (before), run again (base stability), checkout head -> run (after). Capture needs a non-throwing spawn returning {status, stdout, stderr} - note runCommand throws on non-zero and returns stdout only (command-runner.ts:14-48), so the engine adds a thin spawnSync-based wrapper (the exit code is the signal).
  • Outputs per run: exit, output_hash (sha256 over stdout+stderr), output_bytes, duration_ms.
  • Verdict (fail-closed): attested iff base_1 == base_2 (stable) and head differs from base (exit or hash). Otherwise neutral: flaky base, no delta, timeout, netns-unavailable, or unresolvable command.

Attestation schema + writer (src/repair/proof-attestation.ts, new): schema at schema/repair/clawsweeper-proof-attestation.schema.json. Record path records/<repo-slug>/proof/<number>.json via repoSlug()/assertSha() - lift these to one canonical home rather than re-duplicate.

{
  "schema_version": 1,
  "repo": "openclaw/openclaw",
  "number": 12345,
  "head_sha": "<40-hex>",
  "base_sha": "<40-hex>",
  "repro": { "command": "pnpm check:changed", "source": "repro_command|changed_gate", "cwd": "." },
  "before": { "ref": "base", "exit": 1, "output_hash": "sha256:...", "output_bytes": 812, "duration_ms": 4200 },
  "base_stability": { "second_exit": 1, "second_output_hash": "sha256:...", "stable": true },
  "after":  { "ref": "head", "exit": 0, "output_hash": "sha256:...", "output_bytes": 640, "duration_ms": 4310 },
  "differentiates": true,
  "verdict": "attested",
  "reason": "base stable (exit 1 twice); head exit 0 differs",
  "runner_id": "blacksmith-16vcpu-...",
  "engine": "reproduce-attest",
  "engine_version": 1,
  "attested_at": "2026-07-05T00:00:00Z"
}

parseProofAttestation reuses the strict style (requireRecord + rejectUnexpectedKeys + requireEnum + requireString/requireInteger/requireBoolean, cf. clawsweeper.ts:2505-2549,2911). differentiates/verdict are recomputed by the reader from before/after/base_stability, never trusted from disk (VISION 7, fail-closed).

Comment (beside the model verdict): marker <!-- clawsweeper-proof-attestation:#<number>:<head_sha> -->, following the head-SHA-keyed convention (comment-router-core.ts:2283). Body: repro command, base/head exit codes, differentiates, and an explicit note that reproduction output is withheld. Never renders raw output. Freshness enforced at read time via reviewedHeadShaBlockReason(...) (comment-router-core.ts:1053).

Dashboard surface: dashboard/worker.ts is label-driven. Add a proof: attested label written by the lane, then: add it to PR_PROOF_LABEL_NAMES; extend proofStateFromLabels (:2693) to return "Attested (reproduced)" above "Sufficient"; add a PR_PROOF_VIEWS entry and a metric tile. The existing proof column (proofStateCell :5712) renders it unchanged. Fixture in test/dashboard-worker.test.ts (required schema/label proof, VISION line 148).

Gate integration (narrow, staged, fail-closed): at apply-result.ts:1104, inside validatePrCloseCoverageCoveringSafety (which already fetches the covering pull request at :1095; head SHA available as pullRequest.head?.sha):

const proofPassed =
  validAttestationForHead(result.repo, coveringRef, pullRequest.head?.sha) ||
  labels.some((label) => /^proof:\s*(sufficient|override)\b/i.test(label));

validAttestationForHead reads the record, re-validates schema, recomputes differentiates, and calls reviewedHeadShaBlockReason. Returns true only if verdict==="attested" and head matches. Any error/absent/stale/neutral -> false (existing label path). Gated behind CLAWSWEEPER_PROOF_ATTESTATION_GATE=1, default off. The canonical-close sibling (clawsweeper.ts:13611) is a later, separate follow-up. This prefers an attestation over the label; it never weakens the current check when absent.

Tiering

  • Auto-attest lane engages only when evidenceKind is reproducible (terminal, logs, live_output, clawsweeper.ts:231-239) and a repro exists (reproCommand or changed_gate-as-proof) and the repro is offline-deterministic.
  • Stays human-owned: screenshot, recording, and every Mantis proof-only case (clawsweeper.ts:252-260; post-#424 telegram/discord/web_ui_chat_proof). The lane no-ops on these; the mantis/human proof queue is untouched.

Net effect: the human proof queue loses only the reproducible-and-offline-deterministic cases; visual paths do not change.

Staged scopes mapped to files (three scopes)

Scope What lands Files
1. Reproduce + attest beside the verdict (read-only) reproCommand field + reproduction engine + attestation writer + marker comment. No gate change. src/repair/reproduce-proof.ts (new), src/repair/proof-attestation.ts (new), schema/repair/clawsweeper-proof-attestation.schema.json (new), clawsweeper.ts:2911 (add optional field), review path wiring; reuse commit-sweeper.ts:420/426/436, target-validation.ts:230/507, codex-env.ts:67, comment-router-core.ts:1053/2283.
2. Dashboard surface proof: attested label, proofStateFromLabels, view + metric. dashboard/worker.ts:2693,5020,5044 + PR_PROOF_LABEL_NAMES/PR_PROOF_VIEWS; fixture in test/dashboard-worker.test.ts.
3. Gate integration validAttestationForHead preferred over the label, default-off flag. src/repair/apply-result.ts:1104 + src/repair/proof-attestation.ts.

The v1 "standalone network-default fix" is dropped as a fix: the review lane's CI network is intentional for media fetch (clawsweeper.ts:7326-7329), so codexReviewNetworkAccess=false never firing (it is only emitted for workspace-write, execute-fix-artifact.ts:2686, while CI review runs danger-full-access, :227) is by design, not a bug to flip.

Tests and fixtures (comment-free, per repo rule)

  1. Reproduce -> attestation: base fails, head passes -> verdict:"attested", differentiates:true, schema-valid.
  2. Non-differentiating -> neutral: identical exit+hash -> neutral, no label.
  3. Flaky base -> neutral: base_1 != base_2 -> neutral.
  4. Netns-unavailable -> neutral: sandbox creation fails -> neutral, never unconfined run.
  5. Proof token stripped from repro env: assert CLAWSWEEPER_PROOF_INSPECTION_TOKEN/app/crabfleet absent in the repro subprocess env (regression against the targetValidationEnv gap).
  6. Gate prefers valid attestation: flag on + valid head-matched attestation -> validatePrCloseCoverageCoveringSafety returns "" without a proof: label.
  7. Stale/head-mismatched attestation rejected: falls back to the label path via reviewedHeadShaBlockReason.
  8. Visual kind stays human-owned: evidenceKind:"screenshot"/evidenceKind:"recording" -> lane no-ops.
  9. Dashboard fixture render: labels fixture with proof: attested -> proofStateFromLabels "Attested (reproduced)".
  10. Schema strictness: unexpected key / bad enum -> parseProofAttestation throws.

VISION compliance and maintainer sign-off

Aligns: Principle 1 (scopes 1-2 pure observe; gate flip deterministic + default-off); Principle 4 (reproduced, head-pinned, hashed artifact + exact-head reuse); Principle 5 (reproduction removes the model from the close-safety check; repro subprocess gets no GitHub write credentials); Principle 7 (differentiates/verdict recomputed, fail-closed); contribution rules (fixtures for schema/dashboard/label/marker changes; one lane per scope).

Needs explicit maintainer review (VISION line 151): the containment primitive (sudo unshare --net + de-priv user on Blacksmith); the gate flip at apply-result.ts:1104; the new reproCommand field + schema version (public schema change).

Does not cross "What We Will Not Merge": no generic third-party service, no model-driven writes without deterministic recheck, no new provider framework, no PAT fallback, no second state/dashboard engine.

Diagrams for the trust chain, the reproduce-and-attest flow, and the staged scopes are in the proposal body above.

yetval avatar Jul 05 '26 17:07 yetval

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 6, 2026, 2:17 AM ET / 06:17 UTC.

Summary Keep open. Current main still lacks a proof reproduction or head-pinned attestation lane, and the requested default-off gate changes are security-sensitive product work that needs maintainer direction.

Reproducibility: yes. for the current-state gap. Source inspection shows no attestation or reproCommand surface, and current proof labels plus close checks are driven by RealBehaviorProof.status or proof labels rather than a reproduced base-vs-head delta.

Root-cause cluster Relationship: canonical Canonical: https://github.com/openclaw/clawsweeper/issues/421 Summary: This issue is the canonical open design thread for proof reproduction and attestations; related merged PRs define the current model-read and Mantis proof boundaries but do not implement the requested base-vs-head attestation lane.

Members:

  • adjacent_distinct: https://github.com/openclaw/clawsweeper/pull/40 - This merged PR introduced real behavior proof as a review requirement, but not reproduced attestations.
  • adjacent_distinct: https://github.com/openclaw/clawsweeper/pull/48 - This merged PR made ClawSweeper judge proof and sync proof labels, which is the trust model this issue proposes to harden.
  • partial_overlap: https://github.com/openclaw/clawsweeper/pull/424 - This merged PR clarified Mantis proof scope and proof-only boundaries, but it does not add base-vs-head reproduction or attestation records.

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Next step Manual review is required because the issue proposes new default-off proof infrastructure and security/close-safety trust semantics, and the reporter explicitly asked not to open a PR yet.

Maintainer decision needed

  • Question: Should ClawSweeper add a default-off proof reproduction and attestation lane, and should the first accepted scope stop before close-safety starts trusting attestations?
  • Rationale: The request changes how ClawSweeper may execute untrusted PR-provided reproductions and what deterministic close-safety may trust, which VISION.md treats as a security-boundary and merge-gate decision requiring explicit maintainer review.
  • Likely owner: steipete — steipete has the strongest recent apply/runtime ownership signal and was explicitly asked for direction on this issue.
  • Options:
    • Stage Read-Only Attestation First (recommended): Approve a narrow first implementation for a repro command contract, sandboxed base-vs-head execution, neutral or attested records, and tests without changing close gates yet.
    • Defer Gate Trust Changes: Keep model-derived proof labels as the close-safety signal until sandbox isolation, freshness checks, and contributor adoption have production proof.
    • Decline Core Lane For Now: Continue relying on model proof, Mantis, and human proof queues if the sandbox and adoption cost is not worth the narrower reproducible subset.

Security Needs attention: Needs attention because the proposal changes untrusted code execution and proof-trust boundaries, though it is not an active vulnerability report.

Review details

Best possible solution:

Keep this as the canonical design item and, if maintainers accept the direction, land a staged default-off implementation that starts with schema, sandbox probing, and read-only attestation records before any close-safety trust change.

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

Yes for the current-state gap. Source inspection shows no attestation or reproCommand surface, and current proof labels plus close checks are driven by RealBehaviorProof.status or proof labels rather than a reproduced base-vs-head delta.

Is this the best way to solve the issue?

Unclear until maintainers choose the trust boundary. The proposed staged, default-off path is the safest maintainable shape because the later gate integration changes security and close-safety behavior.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The proposal would execute contributor-declared reproduction commands, so network denial, credential stripping, de-privileging, raw-output handling, and stale-head rejection need explicit security review.
  • The later close-safety integration would change what deterministic apply trusts when closing duplicate or superseded items.
  • The useful automated subset depends on a new repro command contract and runner sandbox capability that current main does not yet define.

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

Label changes

Label justifications:

  • P2: This is a concrete proof-safety improvement with source-level support, but it is a new capability and policy decision rather than an active production outage.
  • impact:security: The issue is about untrusted proof execution, credential isolation, sandboxing, and whether close-safety should trust reproduced attestations.
  • impact:other: The issue materially affects ClawSweeper automation correctness for duplicate and superseded close decisions outside the more specific owned impact classes.
Evidence reviewed

Security concerns:

  • [medium] Define sandbox requirements before running repro commands — src/repair/target-validation.ts:231 Any implementation must prove credential stripping, network denial, de-privileging, timeout handling, and safe treatment of attacker-controlled output before running contributor-declared proof commands. Confidence: 0.9
  • [medium] Gate attestation trust explicitly — src/repair/apply-result.ts:1104 Close-safety currently trusts proof labels and report proof, so preferring attestations requires a head-matched, fail-closed contract and maintainer-approved rollout. Confidence: 0.88

What I checked:

  • Repository policy read: AGENTS.md was read fully; its conservative, evidence-backed, automation-safe review guidance applies to this security-sensitive automation proposal. (AGENTS.md:3, 7b5265531956)
  • Issue asks for maintainer decision: The issue body requests no fix PR yet and proposes staged proof reproduction, while the follow-up comment asks steipete and vincentkoc whether this should be implemented or closed.
  • Current proof schema has no attestation data: RealBehaviorProof currently stores status, summary, evidenceKind, and needsContributorAction, with no repro command, base/head SHA, output hash, or attestation field. (src/clawsweeper.ts:428, 7b5265531956)
  • Proof label is derived from model status: nextRealBehaviorProofSufficientLabels adds proof: sufficient whenever RealBehaviorProof.status is sufficient. (src/clawsweeper.ts:11217, 7b5265531956)
  • Apply close-safety trusts proof labels: validatePrCloseCoverageCoveringSafety treats proof: sufficient or proof: override labels as positive proof for an open covering pull request. (src/repair/apply-result.ts:1104, 7b5265531956)
  • Canonical close-safety trusts labels or report proof: unsafeCanonicalPullRequestReason combines report proof with proofPassedInLabels before accepting an open canonical pull request as safe coverage. (src/clawsweeper.ts:13703, 7b5265531956)

Likely related people:

  • steipete: Recent history shows Peter Steinberger owns much of the apply/runtime surface, including bounded apply proofs, stale close-proof handling, local review, and the current Actions/toolchain refresh; the reporter also explicitly asked steipete for direction. (role: likely decision owner; confidence: high; commits: 7b5265531956, 0667396551a4, bbc8c8f8e4de; files: src/clawsweeper.ts, src/repair/apply-result.ts, src/repair/target-validation.ts)
  • brokemac79: Recent commits and blame connect brokemac79 to the current proof schema area, Mantis proof-scope boundary, maintainer decision packets, and close/apply routing work. (role: recent proof and close-safety contributor; confidence: high; commits: 4e0a9f29d812, 373716be22af, 181d8d0fd662; files: src/clawsweeper.ts, src/repair/apply-result.ts, VISION.md)
  • pashpashpash: Merged pull requests https://github.com/openclaw/clawsweeper/pull/40 and https://github.com/openclaw/clawsweeper/pull/48 introduced first-class real behavior proof review and agent-led proof label sync, which are the trust model this issue proposes to harden. (role: introduced proof workflow; confidence: medium; commits: eae122c38f1e, 0fefca282de4; files: src/clawsweeper.ts, src/codex-env.ts, prompts/review-item.md)
  • yetval: The reporter also has recent merged work in review reuse, re-review history, and proof-label freshness paths that intersect with exact-head review state and proof label trust. (role: reporter and recent adjacent contributor; confidence: medium; commits: eca6fbfa0e6d, 4db0631ce933, 279d3bd60f3b; files: src/clawsweeper.ts, test/apply-label-sync.test.ts)
How this review workflow works
  • 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.

clawsweeper[bot] avatar Jul 05 '26 17:07 clawsweeper[bot]

@steipete / @vincentkoc Lmk if this is something that we would like to implement or should be closed as long shot.

yetval avatar Jul 05 '26 20:07 yetval

@clawsweeper re-review

yetval avatar Jul 05 '26 23:07 yetval

🦞🧹 ClawSweeper re-review requested.

I asked ClawSweeper to review this item again. Action: item re-review queued (workflow sweep.yml, event repository_dispatch). Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

clawsweeper[bot] avatar Jul 05 '26 23:07 clawsweeper[bot]