Skip to content

refactor: split apply guards and review planning into focused modules - #1020

Merged
steipete merged 3 commits into
mainfrom
codex/clawsweeper-smaller-decision-workflows
Aug 3, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/clawsweeper-smaller-decision-workflows

Conversation

@steipete

@steipete steipete commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Split the remaining oversized apply-guard and review-planning coordinators into small, cohesive modules while retaining their existing public factories, exact function implementations, and dependency contracts.
  • Keep aggressive evidence-backed issue and PR closure, maintainer/security safeguards, publication coordination, and offline/local review behavior unchanged.
  • Preserve create-only OpenClaw fix PRs using gpt-5.6-sol with xhigh reasoning; do not enable OpenClaw automerge.
  • Stop terminal acknowledgement, CI, and CodeQL checkouts from lazily fetching missing blobs outside GitHub's retryable fetch, which stranded historical terminal publications and failed otherwise healthy PR checks when GitHub returned HTTP 502/503.
  • Verify synthetic repair-loop-label-sweep command identities against their exact item, command intent, and PR head so automated autofix completions receive their durable terminal receipt instead of being retried forever.

Size reduction

Coordinator Before After
Apply guards 1,184 lines 55 lines
Review planning 1,177 lines 71 lines

The apply guard implementation now has separate activity, policy, proof, and capacity modules. Review planning now has separate inventory, hot-intake, dashboard, and selection modules. All extracted implementation files remain under 500 lines.

Verification

  • All 122 focused apply-policy, close-reason, hot-intake, live-state, and offline/local-review regressions passed.
  • Production TypeScript builds, source lint, formatting, active-surface checks, and static guards passed.
  • A fresh independent review compares all 38 extracted apply-guard functions and all 44 extracted review-planning functions against their original implementations.
  • Workflow regressions explicitly prove terminal-finalization, CI, and CodeQL checkouts never use a fragile partial/promisor clone.
  • The full repository production gate is rerun against the final rebased head before landing.

Live terminal-publication failure and executable fix proof

The actual stuck finalization run for openclaw/openclaw#117443 failed during actions/checkout, before any acknowledgement could execute:

https://github.com/openclaw/clawsweeper/actions/runs/30800106151
Run actions/checkout@v7
error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
fatal: expected 'packfile'
fatal: could not fetch 042854bd34c03432e3baa66a27f7c5adcd83aed6 from promisor remote

The production workflow now performs a regular fetch-depth: 1 checkout without a blob:none promisor clone. Its executable workflow test parses the actual YAML and asserts that the terminal-finalization checkout retains depth one while omitting the partial-clone filter:

✔ exact event publication derives lifecycle receipt and final command acknowledgement from the projection
ℹ tests 113
ℹ pass 113
ℹ fail 0

Real offline review still passes on the exact proposed branch:

✔ --local-range defaults to the current checkout and isolates gh config in artifacts
✔ local-review scrubs both GitHub and GitHub Enterprise token aliases
✔ local-review disables web search and forbids network lookups in its prompt
ℹ tests 3
ℹ pass 3
ℹ fail 0

The previously stuck openclaw/openclaw#117443 uses the real synthetic marker repair-loop-label-sweep:autofix:117443. Running the actual compiled terminal-status CLI against the exact live bot comment now emits a durable, provenance-bound completion receipt:

{"revision":"ff05bfde8a6165da07f31f98cb1cbffa3c1c68dc","checkout":{"depth":1,"promisor":false,"succeeded":true},"terminalFinalization":{"target":"openclaw/openclaw#117443","commandCommentId":5151931725,"completionCommentId":5151931725,"receipt":"verified"}}

This proof clones the exact proposed head at depth one with no promisor remote, builds the actual repair bundle in that fresh checkout, runs the real terminal-status CLI against the exact live #117443 bot comment, and confirms the resulting GitHub Actions outputs contain terminal_status_verified=true with both durable receipt IDs.

The focused production workflow, comment-router, terminal-receipt, and checkout suite passes:

ℹ tests 316
ℹ pass 316
ℹ fail 0

Safety invariants

CLAWSWEEPER_ALLOW_FIX_PR=1
CLAWSWEEPER_ALLOW_AUTOMERGE=0
CLAWSWEEPER_ALLOW_MERGE=0
CLAWSWEEPER_AUTO_CLOSE_REASONS=all
CLAWSWEEPER_FIX_PR_MODEL=gpt-5.6-sol
CLAWSWEEPER_FIX_PR_REASONING_EFFORT=xhigh

@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 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 rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

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

ClawSweeper review

What this changes

The branch extracts ClawSweeper apply-guard and review-planning logic into focused modules, replaces partial checkouts with full depth-one checkouts for selected workflows, and validates synthetic terminal receipts against their item, command kind, and head marker.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR remains necessary: it cleanly separates two oversized automation coordinators, removes checkout modes that can trigger lazy promisor fetches during terminal work, and binds synthetic autofix receipts to the exact command context. No discrete correctness defect was found in the current head; retain it for final current-head check completion and maintainer review.

Priority: P2
Reviewed head: ff05bfde8a6165da07f31f98cb1cbffa3c1c68dc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A well-scoped but broad internal refactor with targeted regression coverage and convincing live receipt proof; current workflow completion is the remaining merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides after-fix terminal output from the compiled status CLI against the exact live synthetic command comment, producing a verified durable receipt; workflow assertions supplement the checkout configuration change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides after-fix terminal output from the compiled status CLI against the exact live synthetic command comment, producing a verified durable receipt; workflow assertions supplement the checkout configuration change.
Evidence reviewed 6 items Focused module boundaries: The proposed wrapper composes activity, policy, proof, and capacity modules while returning the same apply-guard surface; review planning similarly composes inventory, hot-intake, dashboard, and selection surfaces.
Receipt validation is narrowly bound: The terminal receipt fallback accepts the synthetic repair-loop marker only when its command kind, item number, status kind, head marker, and sole marker context match; focused tests cover mismatched item, command kind, SHA, and duplicate-marker cases.
Checkout repair matches the reported failure mode: The terminal finalization checkout removes filter: blob:none while retaining fetch-depth: 1; CI and CodeQL likewise stop using sparse partial checkouts, with workflow-parsing assertions added for each changed behavior.
Findings None None.
Security None None.

How this fits together

ClawSweeper selects GitHub issues and pull requests for review, then applies guarded maintenance actions and records durable terminal acknowledgements. This PR changes the internal planning and safety-gate decomposition plus the GitHub Actions checkout and receipt-validation paths that publish completion state.

flowchart LR
A[Open GitHub items] --> B[Review planner]
B --> C[Codex review jobs]
C --> D[Apply safety guards]
D --> E[Terminal acknowledgement]
F[GitHub Actions checkout] --> E
E --> G[Durable lifecycle receipt]
Loading

Before merge

  • Resolve merge risk (P1) - The branch changes CI, CodeQL, and terminal-finalization checkout semantics; full checkouts trade some checkout cost for avoiding lazy promisor-fetch failures.
  • Resolve merge risk (P1) - The context snapshot still shows pnpm check, production automerge flow, and CodeQL actions analysis in progress, so landing should wait for their results on the current head.
  • Complete next step (P2) - No mechanical repair is identified; the remaining action is normal current-head workflow completion and maintainer landing review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Refactor surface 19 files affected; +2,650 / -2,356 lines The change crosses review scheduling, apply safeguards, workflows, and durable terminal receipts.
Net code movement production +222 lines, tests +72 lines Most of the diff relocates existing coordinator behavior while adding focused coverage for receipt and checkout regressions.

Merge-risk options

Maintainer options:

  1. Complete current-head workflow validation (recommended)
    Wait for the active pnpm check, production-automation, and CodeQL checks to complete on the current head; repair any workflow regression before merge.
  2. Accept full-checkout cost
    Retain full depth-one checkouts because the explicit tradeoff is higher checkout volume in exchange for eliminating the partial-clone lazy-fetch failure mode.

Technical review

Best possible solution:

Keep the focused module decomposition and full checkout behavior, then land only after the current-head workflow checks confirm the checkout change remains safe across CI, CodeQL, and terminal finalization.

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

Yes for the receipt path: the PR body shows the compiled CLI operating on the exact live synthetic marker and producing a verified receipt. The historical checkout failure is source-addressable through removal of the partial-clone filter, although this read-only review did not execute a GitHub-hosted finalization run.

Is this the best way to solve the issue?

Yes. The extraction preserves the public coordinator factories while isolating cohesive concerns, and removing blob:none/sparse partial checkouts directly avoids the reported lazy-fetch failure class without changing terminal-finalization policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2d1a40bfa643.

Labels

Label justifications:

  • P2: This is a bounded reliability and maintainability change to core ClawSweeper automation without a confirmed active user-facing outage.
  • merge-risk: 🚨 automation: The branch changes GitHub Actions checkout behavior and the terminal receipt path used by automation.
  • 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 (terminal): The PR body provides after-fix terminal output from the compiled status CLI against the exact live synthetic command comment, producing a verified durable receipt; workflow assertions supplement the checkout configuration change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix terminal output from the compiled status CLI against the exact live synthetic command comment, producing a verified durable receipt; workflow assertions supplement the checkout configuration change.

Evidence

What I checked:

  • Focused module boundaries: The proposed wrapper composes activity, policy, proof, and capacity modules while returning the same apply-guard surface; review planning similarly composes inventory, hot-intake, dashboard, and selection surfaces. (src/clawsweeper-apply-guards.ts:7, ff05bfde8a61)
  • Receipt validation is narrowly bound: The terminal receipt fallback accepts the synthetic repair-loop marker only when its command kind, item number, status kind, head marker, and sole marker context match; focused tests cover mismatched item, command kind, SHA, and duplicate-marker cases. (src/repair/update-command-status.ts:558, ff05bfde8a61)
  • Checkout repair matches the reported failure mode: The terminal finalization checkout removes filter: blob:none while retaining fetch-depth: 1; CI and CodeQL likewise stop using sparse partial checkouts, with workflow-parsing assertions added for each changed behavior. (.github/workflows/sweep.yml:3146, ff05bfde8a61)
  • Current real-behavior proof: The PR body includes output from the compiled terminal-status CLI against the exact live synthetic marker for openclaw/openclaw#117443, returning a verified durable completion receipt after the change. (src/repair/update-command-status.ts:483, ff05bfde8a61)
  • Feature-history provenance: Current main history shows the affected apply guards, planning, and terminal-acknowledgement paths were recently introduced and maintained through commits including 8fd1140e, 922ebc67, and a769f25c; the proposed branch follows that same area history. (src/repair/update-command-status.ts:483, a769f25c3500)
  • Checkout stayed clean: Read-only inspection left the target checkout clean; the local git diff --check for the full proposed range reported no whitespace errors.

Likely related people:

  • steipete: Peter Steinberger authored the recent merged apply, planning, and terminal-acknowledgement work on current main, including the immediate predecessor receipt fix. (role: recent area contributor; confidence: high; commits: 8fd1140e7aa9, 922ebc673e12, a769f25c3500; files: src/clawsweeper-apply-guards.ts, src/clawsweeper-review-planning.ts, src/repair/update-command-status.ts)
  • Martin Cleary: Martin Cleary introduced the exact review lifecycle projection adjacent to the terminal-finalization path this PR modifies. (role: lifecycle-projection contributor; confidence: medium; commits: b07ab751813c; files: .github/workflows/sweep.yml)

Rank-up moves

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

  • Wait for the active required checks to complete against ff05bfde8a6165da07f31f98cb1cbffa3c1c68dc before landing.

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 (3 earlier review cycles)
  • reviewed 2026-08-03T09:08:44.058Z sha d31b1b6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T09:20:30.989Z sha e6c782f :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T09:24:20.424Z sha e6c782f :: needs real behavior proof before merge. :: none

@steipete
steipete requested a review from a team as a code owner August 3, 2026 09:13
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

1 similar comment
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 3, 2026
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 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. 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 3, 2026
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@steipete
steipete merged commit 7b66515 into main Aug 3, 2026
24 checks passed
@steipete
steipete deleted the codex/clawsweeper-smaller-decision-workflows branch August 3, 2026 09:36
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
…openclaw#1020)

* refactor: split apply guards and review planning into focused modules

* fix: avoid lazy checkout failures during terminal finalization

* fix: finalize synthetic autofix receipts and avoid fragile partial checkouts

---------

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. 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