Skip to content

refactor: split review rendering and automation into cohesive modules - #1019

Merged
steipete merged 2 commits into
mainfrom
codex/clawsweeper-cohesive-support-modules
Aug 3, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/clawsweeper-cohesive-support-modules

Conversation

@steipete

@steipete steipete commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Split the oversized ClawSweeper review/report pipeline into small, purpose-specific modules without changing its public entrypoint, command contracts, aggressive close policy, or generated OpenClaw fix-PR behavior.
  • Preserve the offline/local review feature, including GitHub credential scrubbing, isolated gh configuration, disabled web search, and the no-network prompt.
  • Keep automatic OpenClaw merging disabled and retain gpt-5.6-sol with xhigh reasoning for generated fix PRs.

Size reduction

Coordinator Before After
Review report rendering 2,506 lines 67 lines
Report orchestration 2,920 lines 418 lines
Review-comment publication 1,835 lines 119 lines
Label synchronization 1,496 lines 104 lines
Shared runtime wiring 2,571 lines 1,539 lines
Public CLI entrypoint 19 lines 19 lines

Rendering is now divided into report context, documents, public comment presentation, comment helpers, and report actions. Review publication is separated into stable identities, automation markers, durable state, publication, and leases. Label selection, mutation, and operations have distinct modules. Offline-safe review preparation and GitHub mutation execution are now explicit, independently reviewable modules.

Real offline review proof

Executing the actual compiled local review CLI against a fresh temporary Git checkout and a stub Codex process confirms that local-range review still creates its review artifact while isolating gh configuration. The complete local review suite additionally verifies that GitHub and GitHub Enterprise token aliases are removed, web search is disabled, and the model prompt forbids network access:

✔ --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 repository's complete production gate passed on the refactored tree:

pnpm run check
ℹ tests 3068
ℹ pass 3059
ℹ fail 0

The remaining nine tests were skipped by their platform-specific guards. An independent Codex precommit review additionally verified every extracted function, dependency contract, and module cycle and ran more than 700 directly relevant review/apply/cache/label regressions without identifying any finding.

CI reliability and process robustness

The rebased check exposed two pre-existing execution-time flakes: a Codex subprocess that exits successfully after closing stdin early could incorrectly become a failed review through EPIPE, and a queue-health test compared an exact elapsed second while inserting 10,001 rows.

  • Treat an early broken stdin pipe as benign only when the Codex child exits successfully; preserve all actual spawn, timeout, and unsuccessful-child failures.
  • Add a real subprocess regression with a large prompt and a child that intentionally closes stdin before returning successful output.
  • Assert the live queue-health age against the observed elapsed value instead of a fragile exact second.
  • Rebuilt all production targets, passed all 28 Codex process/review tests, both targeted queue-health regressions, static checks, and a fresh independent precommit review.

Safety invariants

CLAWSWEEPER_ALLOW_FIX_PR=1
CLAWSWEEPER_ALLOW_AUTOMERGE=0
CLAWSWEEPER_ALLOW_MERGE=0
CLAWSWEEPER_AUTO_CLOSE_REASONS=all
CLAWSWEEPER_AUTO_IMPLEMENT_ISSUES=1
CLAWSWEEPER_AUTO_IMPLEMENT_REPRO_BUGS=1
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 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. 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:00 AM ET / 09:00 UTC.

ClawSweeper review

What this changes

This PR splits ClawSweeper’s review/report rendering, review-comment publication, label synchronization, and GitHub execution into cohesive modules, and fixes successful Codex subprocesses that close stdin early plus a timing-sensitive queue-health assertion.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This active PR remains necessary: current main does not contain its cohesive extraction or the two follow-up reliability fixes. Static review found no discrete patch defect, and the supplied current-head terminal proof is meaningful; keep it open for maintainer review after the in-progress current-head checks finish.

Priority: P2
Reviewed head: 23603231f1def421cef9c0cc71bdc0e5545b9a3e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) This is a broad but coherent extraction with targeted after-fix runtime proof and no discrete correctness finding from static review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides after-fix terminal evidence for the compiled offline review path and a real subprocess regression where stdin closes early but the child succeeds.
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 evidence for the compiled offline review path and a real subprocess regression where stdin closes early but the child succeeds.
Evidence reviewed 6 items Current-main and PR-head availability: The checked-out worktree is clean at the supplied current-main SHA, and both PR commits are locally available for direct read-only comparison.
Cohesive orchestration assembly: The PR-head orchestration façade composes the extracted foundation, promotion facts, coverage proof, close-promotion, label-presentation, and rendering helpers through explicit dependency injection before exposing the existing public orchestration API.
Codex subprocess failure boundary: The follow-up change ignores EPIPE only when the child process exited successfully; timeout, spawn, and other stdin failures remain reported as errors.
Findings None None.
Security None None.

How this fits together

ClawSweeper turns GitHub item context into review reports and durable comments, then uses guarded automation to synchronize labels and apply GitHub operations. This PR reorganizes the coordinating code that connects those review, publication, labeling, and execution stages without changing the public CLI entrypoint.

flowchart LR
  Context[GitHub item context] --> Review[Review orchestration]
  Review --> Reports[Report rendering]
  Reports --> Comments[Durable review comments]
  Comments --> Labels[Label synchronization]
  Labels --> GitHub[Guarded GitHub operations]
  Runtime[Shared runtime wiring] --> Review
  Runtime --> GitHub
Loading

Before merge

  • Resolve merge risk (P1) - Merging rewires review publication, label synchronization, and guarded GitHub mutation composition across 39 files; the supplied current-head check state still shows pnpm check and Actions analysis in progress.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Refactor surface 39 files affected; production +10,542, tests +37 Most of the change moves production orchestration, so preserving runtime contracts is the key maintainer review concern.

Merge-risk options

Maintainer options:

  1. Finish current-head automation validation (recommended)
    Wait for the current-head production gate, then review the supplied local runtime proof alongside the refactored publication, label, and GitHub-execution seams.
  2. Pause if the integration gate fails
    Split or pause the extraction only if current-head validation reveals a dependency-wiring regression that cannot be repaired as a narrow follow-up.

Technical review

Best possible solution:

Retain the focused façade-and-dependency design, with the current head’s repository gate complete before a maintainer lands the automation refactor.

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

Not applicable: the central work restructures existing automation rather than reporting a user-reproducible defect. The two follow-up reliability changes do have concrete after-fix subprocess and queue-health validation described in the PR body.

Is this the best way to solve the issue?

Yes: explicit façade modules and dependency injection preserve the existing public entrypoints while making automation responsibilities more reviewable; the narrow EPIPE handling retains non-success failure reporting.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a broad internal automation refactor with no demonstrated urgent user-facing regression.
  • merge-risk: 🚨 automation: The diff changes review publication, label synchronization, runtime wiring, and guarded GitHub execution paths.
  • 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 provides after-fix terminal evidence for the compiled offline review path and a real subprocess regression where stdin closes early but the child succeeds.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix terminal evidence for the compiled offline review path and a real subprocess regression where stdin closes early but the child succeeds.

Evidence

What I checked:

  • Current-main and PR-head availability: The checked-out worktree is clean at the supplied current-main SHA, and both PR commits are locally available for direct read-only comparison. (a769f25c3500)
  • Cohesive orchestration assembly: The PR-head orchestration façade composes the extracted foundation, promotion facts, coverage proof, close-promotion, label-presentation, and rendering helpers through explicit dependency injection before exposing the existing public orchestration API. (src/clawsweeper-report-orchestration.ts:1, 23603231f1de)
  • Codex subprocess failure boundary: The follow-up change ignores EPIPE only when the child process exited successfully; timeout, spawn, and other stdin failures remain reported as errors. (src/codex-process-worker.ts:63, 23603231f1de)
  • Regression coverage for new runtime path: The PR adds a direct process test with a large prompt and a child that destroys stdin before exiting successfully, asserting status 0, no error, and captured output. (test/codex-process.test.ts:237, 23603231f1de)
  • Diff integrity: The full PR range has no whitespace errors. (23603231f1de)
  • Feature provenance: The locally available history shows the current report-orchestration and rendering coordinator files were introduced by the earlier focused-subsystems refactor, establishing continuity with the same feature area. (src/clawsweeper-report-orchestration.ts:1, dccfa528f038)

Likely related people:

  • Peter Steinberger: Available local history attributes the central coordinator files to Peter Steinberger, who also authored both commits in this PR. (role: feature introducer and recent area contributor; confidence: high; commits: dccfa528f038, 1c9cb5dc6dd2, 7675e771085d; files: src/clawsweeper-report-orchestration.ts, src/clawsweeper-report-rendering.ts, src/clawsweeper-label-sync.ts)

Rank-up moves

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

  • Wait for the current-head pnpm check and Actions analysis results before merging.

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-03T08:47:30.037Z sha 7675e77 :: needs maintainer review before merge. :: none

@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:

@steipete
steipete merged commit 2d1a40b into main Aug 3, 2026
10 of 11 checks passed
@steipete
steipete deleted the codex/clawsweeper-cohesive-support-modules branch August 3, 2026 09:01
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
…openclaw#1019)

* refactor: split review rendering and automation into cohesive modules

* fix: tolerate clean Codex stdin closure and stabilize queue age proof

---------

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