Skip to content

fix: restore generated outputs after changed-gate validation - #997

Merged
steipete merged 1 commit into
mainfrom
codex/clawsweeper-changed-gate-runtime
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/clawsweeper-changed-gate-runtime

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Root cause

The live repair of openclaw/openclaw#117144 reached a successful Codex edit, then failed because OpenClaw's trusted pnpm check:changed regenerates ignored dist and packages/plugin-sdk/dist outputs. ClawSweeper compared those legitimate build outputs against its immutable runtime snapshot and aborted before publishing the fixed branch.

Fix

  • Snapshot only canonical, ignored OpenClaw build output roots outside every contained-command writable root.
  • Restore original output trees (or remove newly created output trees) before immutable checkout verification.
  • Keep fresh build-and-smoke output binding strict; reject unrelated node_modules/artifact poisoning, unsafe output roots, swapped parents, and symlink targets.
  • Restore every safely recoverable output even when another output was replaced, and preserve trusted compiler cache on preparation failures.
  • Generated OpenClaw PRs remain create-only: this change neither grants nor requests merge permission.

Real behavior proof

Production failure reproduced from https://github.com/openclaw/clawsweeper/actions/runs/30692961470:

Error: unsafe validation command mutated checkout identity (pnpm check:changed): runtimeInputsSha256; changed runtime roots: dist, packages/plugin-sdk/dist

The actual contained changed-gate runtime now rebuilds both ignored output roots and returns successfully; existing trusted outputs are restored and newly created outputs are removed. Unrelated ignored-input poisoning and output symlink replacement still fail closed; the symlink target and original trusted output both remain intact. Existing fresh build/smoke tamper guards and compiler-cache isolation continue passing.

node --test --test-name-pattern='changed-gate rebuilds|output restoration|output preparation failures|compiler cache|fresh runtime output|runtime root diagnostics identify|changed-gate fallback' test/repair/target-validation.test.ts

tests 11
pass 11
fail 0

Additional proof: pnpm run build:all, repair-file lint, focused offline/create-only/exact-item runtime proof (GitHub calls: 0; generated autofix merge allowed: false; replacement PR auto-merge allowed: false).

Review disposition

The fresh independent precommit review originally identified three issues: canonicalize backup roots, prepare outputs before moving the compiler cache, and preserve/restore original outputs on restoration failures. All three were fixed with new regression coverage. Fresh re-review: No actionable findings. All 11 focused validation tests passed.

@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

/review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. P2 Normal priority bug or improvement with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 5:49 AM ET / 09:49 UTC.

ClawSweeper review

What this changes

The PR makes OpenClaw changed-gate validation temporarily rebuild canonical ignored output directories, restore or remove them afterward, and preserve the existing immutable-checkout safeguards.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main detects the changed-gate mutation but does not restore the trusted ignored OpenClaw output trees that legitimate changed-gate builds regenerate. The patch adds a bounded snapshot-and-restore path while retaining failure-closed checks for unsafe parents, replacement roots, symlinks, and unrelated ignored-input changes; no actionable patch defect was found.

Priority: P2
Reviewed head: 43e2d52dbcd97a7986a838f56ad9b92aa7c37746

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) This is a focused, evidence-backed containment repair with current runtime proof and no concrete correctness or security finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The PR body links the production failure, describes a successful post-fix contained changed-gate run rebuilding both roots, and reports focused runtime regression results; future shared logs should remain redacted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body links the production failure, describes a successful post-fix contained changed-gate run rebuilding both roots, and reports focused runtime regression results; future shared logs should remain redacted.
Evidence reviewed 5 items Current-main gap: Current main already prepares a disposable compiler cache for OpenClaw changed-gate validation, but it has no corresponding disposable handling for regenerated dist output roots; the PR adds that missing output lifecycle before the existing identity check.
Containment boundary: The new helper snapshots only canonical output roots, requires safe non-symlink parents inside the checkout, rejects unsafe existing outputs, verifies parent identity during restoration, and preserves the backup if restoration cannot complete safely.
Focused regression coverage: The added tests cover both absent and pre-existing output trees, unrelated ignored-input poisoning, unsafe output preparation, symlink replacement, and compiler-cache preservation.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s repair lane runs approved validation commands inside a candidate target checkout before it creates a repair PR. The validation layer must permit trusted generated build output while rejecting any mutation to protected checkout inputs or unrelated ignored runtime paths.

flowchart LR
  A[Repair candidate checkout] --> B[Changed-gate validation]
  B --> C[Temporary generated output roots]
  C --> D[Restore trusted output state]
  D --> E[Checkout identity verification]
  E --> F[Create-only repair PR]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Focused surface 2 files affected; 362 additions, 14 deletions The change is confined to repair validation and its narrow regression suite.
Output safety cases 5 focused restoration/cache test cases added The tests exercise successful restoration plus unsafe-root, poisoning, setup-failure, and cache-preservation behavior.

Technical review

Best possible solution:

Merge the narrow restoration path after the current required checks complete, keeping output-root allowlisting and immutable identity verification strict so changed-gate builds cannot mask unrelated checkout mutations.

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

Yes. The added fixture executes the current changed-gate command shape, confirms regenerated dist roots are restored or removed, and demonstrates that unrelated ignored-input and symlink replacement cases still fail closed.

Is this the best way to solve the issue?

Yes. Restoring only verified canonical ignored output roots before the existing immutable-checkout verification is safer than weakening the general mutation detector.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a bounded validation failure that can block generated repair PR publication, without evidence of a user-facing availability or security emergency.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body links the production failure, describes a successful post-fix contained changed-gate run rebuilding both roots, and reports focused runtime regression results; future shared logs should remain redacted.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body links the production failure, describes a successful post-fix contained changed-gate run rebuilding both roots, and reports focused runtime regression results; future shared logs should remain redacted.

Label justifications:

  • P2: This repairs a bounded validation failure that can block generated repair PR publication, without evidence of a user-facing availability or security emergency.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body links the production failure, describes a successful post-fix contained changed-gate run rebuilding both roots, and reports focused runtime regression results; future shared logs should remain redacted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body links the production failure, describes a successful post-fix contained changed-gate run rebuilding both roots, and reports focused runtime regression results; future shared logs should remain redacted.

Evidence

What I checked:

  • Current-main gap: Current main already prepares a disposable compiler cache for OpenClaw changed-gate validation, but it has no corresponding disposable handling for regenerated dist output roots; the PR adds that missing output lifecycle before the existing identity check. (src/repair/target-validation.ts:1342, 43e2d52dbcd9)
  • Containment boundary: The new helper snapshots only canonical output roots, requires safe non-symlink parents inside the checkout, rejects unsafe existing outputs, verifies parent identity during restoration, and preserves the backup if restoration cannot complete safely. (src/repair/target-validation.ts:2837, 43e2d52dbcd9)
  • Focused regression coverage: The added tests cover both absent and pre-existing output trees, unrelated ignored-input poisoning, unsafe output preparation, symlink replacement, and compiler-cache preservation. (test/repair/target-validation.test.ts:4223, 43e2d52dbcd9)
  • Feature-history provenance: The affected validation path was recently developed through the OpenClaw repair-determinism and changed-gate compiler-cache work, both authored by Peter Steinberger; this PR extends that same containment boundary rather than introducing a parallel path. (src/repair/target-validation.ts:1342, 61a02b0f9e3c)
  • Current branch status: The proposed commit is not contained in current main, so the fix is not already implemented on main or in the released v0.3.0 baseline. (src/repair/target-validation.ts:1342, 43e2d52dbcd9)

Likely related people:

  • steipete: Peter Steinberger authored this PR and the adjacent current-main repair-validation and changed-gate compiler-cache commits that define the affected containment behavior. (role: recent area contributor; confidence: high; commits: 30d0321d9c9c, 61a02b0f9e3c, 43e2d52dbcd9; files: src/repair/target-validation.ts, test/repair/target-validation.test.ts)

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.

@steipete
steipete merged commit 8ee7775 into main Aug 1, 2026
20 checks passed
@steipete
steipete deleted the codex/clawsweeper-changed-gate-runtime branch August 1, 2026 09:52
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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