Skip to content

refactor: split review orchestration and unblock safe repair validation - #1000

Merged
steipete merged 2 commits into
mainfrom
codex/clawsweeper-deeper-modules
Aug 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/clawsweeper-deeper-modules

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Split review planning, review execution, GitHub status/context hydration, close decisions,
    report metadata, related-item context, and review-comment/lease workflows out of the main
    ClawSweeper entrypoint. src/clawsweeper.ts drops from 19,923 to 14,216 lines in this
    change (down from roughly 32,347 lines before the ongoing decomposition), while all 184
    existing public exports remain available.
  • Unblock real OpenClaw issue-fix workers that were repeatedly failing on model-generated
    pnpm format <files> validation hints: discard only those narrow mutating hints when a
    trusted changed-file gate or replacement validation is already present; retain fail-closed
    rejection without trusted coverage and for shell injection or explicit write flags.
  • Fix the Linux containment supervisor incorrectly counting already-reaped short-lived package
    manager helpers as background processes. Still reject genuinely surviving detached children.
  • Preserve standalone offline pnpm run local-review / --local-range, credential scrubbing,
    read-only model execution, explicit service-only merge authorization, and create-only
    generated OpenClaw/autofix/replacement PRs.

Real behavior evidence

  • Current reviewed head: c5279a11f2ef039046bdab0506ffcab28743821f.

  • Actual embedded Linux containment runtime output (the production Python supervisor is
    imported directly; the three scenarios exercise its real child-reaping function):

    {"containment":[{"scenario":"transient_helper_before_primary_exit","background_processes":0},{"scenario":"helper_outlived_primary_between_polls","background_processes":1},{"scenario":"still_running_background_helper","background_processes":1}],"selectedCommands":["pnpm check:changed"],"rejectedUnsafeCommands":4}

    This proves short-lived pre-exit helpers are accepted, descendants that outlive their primary
    remain fail-closed, the real formatter hint resolves to pnpm check:changed, and newline,
    carriage-return, tab, and write-flag command injection are rejected.

  • Actual pnpm run local-review current-head package-command output (normal review plus
    --local-range, using an isolated checkout and fake Codex executable):

    {"actualPackageCommand":"pnpm run local-review","standaloneReviewSucceeded":true,"localRangeReviewSucceeded":true,"committedFilesReviewed":2,"commitsReviewed":1,"gitHubCalls":0,"leakedGitHubCredentials":0,"webSearchDisabled":true,"sandbox":"read-only","isolatedGitHubConfig":true,"generatedAutofixMergeAllowed":false,"legacyAutofixMergeAllowed":false,"legacyIssueMergeAllowed":false,"unknownRepairJobMergeAllowed":false,"explicitServiceAutomergeAllowed":true,"postFlightAutofixMergeAllowed":false,"replacementPrAutoMergeAllowed":false,"fallbackReplacementAutoMergeAllowed":false}
  • Production issue worker https://github.com/openclaw/clawsweeper/actions/runs/30695663337
    repeatedly failed with unsafe validation command: pnpm format extensions/active-memory/....
    The new regression reproduces that exact model hint and proves the trusted
    pnpm check:changed gate executes instead.

  • Production OpenClaw PR repair https://github.com/openclaw/clawsweeper/actions/runs/30695391258
    produced an execution artifact reporting validation command left 1 background process(es) after exit. The new containment regressions distinguish a successfully reaped child,
    an already-reaped child, and a genuinely surviving child.

  • The actual pnpm run local-review package command succeeds on both a normal local review and
    --local-range against a disposable repository with zero GitHub calls, zero leaked
    credentials
    , web search disabled, and a read-only sandbox.

  • Live gate proof confirms generated autofix, legacy issue/autofix, unknown repair, and
    replacement PRs cannot merge; only explicitly authorized ClawSweeper-service automerge can.

  • All 184 historical dist/clawsweeper.js exports remain present after extraction.

Validation

  • pnpm run build:all
  • pnpm run lint:src
  • pnpm run lint:repair
  • pnpm run lint:scripts
  • pnpm run check:active-surface
  • pnpm run check:limits
  • node --test test/clawsweeper.test.ts test/clawsweeper-action-ledger.test.ts
  • node --test test/repair/process-tree-containment.test.ts test/repair/target-validation.test.ts
  • node --test test/repair/cluster-workflow-security.test.ts test/repair/comment-router-core.test.ts test/repair/issue-implementation-intake.test.ts
  • Actual standalone offline local-review/create-only behavior proof.
  • Fresh independent Codex /review on the uncommitted change and again on the committed branch.

Generated OpenClaw issue-fix workers continue to use gpt-5.6-sol with xhigh reasoning and
remain strictly PR-create-only (CLAWSWEEPER_ALLOW_MERGE=0).

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. 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, 7:30 AM ET / 11:30 UTC.

ClawSweeper review

What this changes

This PR extracts ClawSweeper’s review planning, execution, status/context, close-decision, metadata, related-item, and review-comment workflows into focused modules, while accepting safe trusted validation gates and correcting Linux child-process containment accounting.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary: current main lacks both the trusted validation-hint handling and the corrected containment accounting. The updated body includes current-head runtime output for the affected paths, and the focused diff adds regression coverage; no discrete correctness defect surfaced. Wait for the two current workflow checks before landing.

Likely related people: Peter Steinberger (high confidence) for recent repair-validation and review-orchestration work; Martin Cleary (high confidence) for the original containment supervisor.

Priority: P2
Reviewed head: c5279a11f2ef039046bdab0506ffcab28743821f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong current-head runtime evidence and focused regressions support a mergeable patch, subject to the two still-running required workflows.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body supplies current-head terminal JSON from the real containment and offline local-review paths, including observed safe and fail-closed outcomes; redact any private paths or credentials if further logs are posted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body supplies current-head terminal JSON from the real containment and offline local-review paths, including observed safe and fail-closed outcomes; redact any private paths or credentials if further logs are posted.
Evidence reviewed 5 items Current main still lacks both targeted safety fixes: The current main implementations still always add adopted helper PIDs before attempting to reap them and retain model-provided formatter commands; the PR changes both paths to distinguish reaped helpers and drop only narrow formatter hints when a trusted replacement gate exists.
Focused regression coverage: The PR adds target-validation cases for trusted changed-gate replacement, no-gate fail-closed behavior, and injection/write-flag rejection, plus containment scenarios for reaped and surviving adopted children.
Current-head real behavior proof: The PR body identifies head c5279a1 and supplies terminal JSON from the embedded supervisor, target command selection, unsafe-command rejection, and isolated offline local-review execution with zero GitHub calls and credential leakage.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s review lane gathers GitHub context, asks Codex for a proposal, and records or presents a decision; its repair lane validates generated fixes inside a contained process before it can create a replacement PR. This change reorganizes the review orchestration while preserving its external entrypoint and adjusts the repair validation path that feeds automated issue-fix workers.

flowchart LR
  A[GitHub items and PR state] --> B[Review planning]
  B --> C[Review runtime]
  C --> D[Decision and report workflows]
  D --> E[Review comments and labels]
  F[Generated repair artifact] --> G[Trusted validation selection]
  G --> H[Linux process containment]
  H --> I[Create-only repair PR]
Loading

Before merge

  • Resolve merge risk (P1) - This is a 17-file, 20,711-line refactor of review and apply-adjacent orchestration; the body’s focused proof reduces risk for the changed validation and containment paths, but merge should wait for the in-progress pnpm check and production automerge-flow checks to finish on the current head.
  • Complete next step (P2) - Wait for the two current-head workflow checks; no mechanical defect needs a repair worker.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Review extraction 7 modules added; 17 files changed The entrypoint decomposition is broad enough that current-head workflow completion matters in addition to focused runtime proof.
Entrypoint reduction 5,707 net lines removed from src/clawsweeper.ts The extraction materially changes orchestration boundaries while retaining the public facade.
Safety regressions 2 production paths; 3 containment scenarios The PR directly addresses validation command selection and child-process accounting with focused cases.

Merge-risk options

Maintainer options:

  1. Wait for current-head workflow completion (recommended)
    Keep the existing compatibility, containment, and workflow safeguards, then merge only after pnpm check and the production automerge-flow job finish successfully for this head.
  2. Pause if checks expose orchestration drift
    If either remaining check shows that an extracted workflow no longer preserves the prior entrypoint contract, pause this refactor and repair the affected module with a narrow regression.

Technical review

Best possible solution:

Land the focused safety fixes and module extraction only after the current-head required checks complete successfully, preserving the existing external entrypoint and PR-create-only repair boundary.

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

Yes. The PR body provides current-head terminal output for the actual containment and local-review paths, and the added tests encode the formatter-hint and adopted-child cases against the real implementation.

Is this the best way to solve the issue?

Yes. Extracting focused workflows while preserving the public entrypoint is a maintainable way to reduce orchestration complexity; the validation filter remains narrow and keeps unsafe or uncovered commands fail-closed.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1c9cb5dc6dd2.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies current-head terminal JSON from the real containment and offline local-review paths, including observed safe and fail-closed outcomes; redact any private paths or credentials if further logs are posted.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body supplies current-head terminal JSON from the real containment and offline local-review paths, including observed safe and fail-closed outcomes; redact any private paths or credentials if further logs are posted.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: The change improves bounded repair and review automation but is not a demonstrated active outage.
  • merge-risk: 🚨 compatibility: Moving a large review orchestration surface can regress the existing CLI and review-comment contracts if integration wiring drifts.
  • merge-risk: 🚨 availability: The Linux containment change governs whether validation correctly terminates or rejects background processes.
  • merge-risk: 🚨 automation: The extracted review, lease, comment, and close-decision workflows run inside ClawSweeper automation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body supplies current-head terminal JSON from the real containment and offline local-review paths, including observed safe and fail-closed outcomes; redact any private paths or credentials if further logs are posted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies current-head terminal JSON from the real containment and offline local-review paths, including observed safe and fail-closed outcomes; redact any private paths or credentials if further logs are posted.

Evidence

What I checked:

  • Current main still lacks both targeted safety fixes: The current main implementations still always add adopted helper PIDs before attempting to reap them and retain model-provided formatter commands; the PR changes both paths to distinguish reaped helpers and drop only narrow formatter hints when a trusted replacement gate exists. (src/repair/process-tree-containment.ts:713, c5279a11f2ef)
  • Focused regression coverage: The PR adds target-validation cases for trusted changed-gate replacement, no-gate fail-closed behavior, and injection/write-flag rejection, plus containment scenarios for reaped and surviving adopted children. (test/repair/target-validation.test.ts:63, c5279a11f2ef)
  • Current-head real behavior proof: The PR body identifies head c5279a1 and supplies terminal JSON from the embedded supervisor, target command selection, unsafe-command rejection, and isolated offline local-review execution with zero GitHub calls and credential leakage. (c5279a11f2ef)
  • Recent ownership history: The target-validation path was recently maintained by Peter Steinberger in commits 8ee7775 and 30d0321; the original containment logic appears in 308051f by Martin Cleary. (src/repair/target-validation.ts:1663, 8ee77751965b)
  • No whitespace corruption found: The full PR comparison has no whitespace errors. (c5279a11f2ef)

Likely related people:

  • Peter Steinberger: Recent main commits repeatedly maintain generated-repair validation, and the current PR’s two commits continue that path. (role: recent area contributor; confidence: high; commits: 8ee77751965b, 30d0321d9c9c, c5279a11f2ef; files: src/repair/target-validation.ts, src/clawsweeper.ts)
  • Martin Cleary: Git blame attributes the current main containment supervisor and its adopted-child handling to the earlier containment implementation. (role: original containment contributor; confidence: high; commits: 308051ff7844; files: src/repair/process-tree-containment.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for pnpm check and the production automerge-flow check to complete successfully on c5279a1.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-01T11:14:14.774Z sha d9bec4f :: needs real behavior proof before merge. :: none

@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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@steipete
steipete merged commit 922ebc6 into main Aug 1, 2026
24 checks passed
@steipete
steipete deleted the codex/clawsweeper-deeper-modules branch August 1, 2026 11:34
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
…on (openclaw#1000)

* refactor: split review orchestration and unblock safe repair validation

* fix: preserve fail-closed validation process and command guards

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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