Repository navigation
fix(apply): prevent exact review publication memory exhaustion - #980
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 11:06 PM ET / August 1, 2026, 03:06 UTC. ClawSweeper reviewWhat this changesThe PR limits exact-event review publication to the requested canonical record and adds regression assertions for direct and deferred state setup. Merge readinessThis PR is a focused, evidence-backed fix for exact-review publication reading the whole canonical corpus. The current head filters records before Markdown reads, keeps the broad apply path unchanged, and wires the exact item number through both direct and deferred publication; keep it open for normal member-authored maintainer landing after the remaining required check completes. Priority: P2 Review scores
Verification
How this fits togetherClawSweeper’s apply lane turns a reviewed record into durable state and GitHub effects. Exact-event publication handles one leased review item, while normal apply modes can still inspect the broader repository corpus when their safety checks need it. flowchart LR
A[Exact review event] --> B[Selected canonical item]
B --> C[Focused state hydration]
C --> D[Apply decision publication]
D --> E[Durable review record]
D --> F[Deferred publication fallback]
F --> C
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the bounded exact-event path after the current-head check completes, then retain a redacted first-production publication result to confirm Worker-scale behavior matches the measured fixture. Do we have a high-confidence way to reproduce the issue? Yes, with high confidence from source and supplied proof: the prior path enumerated and read all canonical reports, while the PR gives a deterministic built-CLI 50,000-record reproduction and an unreadable-neighbor regression case. This review did not execute the fixture because the target checkout is read-only. Is this the best way to solve the issue? Yes. Filtering before Markdown reads and limiting the exact-event-only counterpart/final-state paths fixes the amplification without changing broad apply behavior, and both direct and deferred workflow entry points use the existing focused hydration interface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b07ab751813c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
c168f76 to
093ffee
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
@clawsweeper re-review |
093ffee to
a3d2086
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
a3d2086 to
ee154dd
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
What Problem This Solves
Fixes an issue where exact-review publication could exhaust the Node heap after a review completed because a one-item run hydrated and rescanned the full canonical review corpus. The deferred publisher could repeat the same full hydration when direct publication or lifecycle finalization fell back to the queued path.
Why This Change Was Made
Direct and deferred exact-event publication now hydrate only the requested canonical record and carry the same bounded item set through report discovery and final-state reads. Broad apply modes keep their existing full-corpus behavior.
User Impact
Exact ClawSweeper reviews can publish without memory use scaling with every historical review record, including the queued fallback path. There is no user-facing configuration change.
Evidence
pnpm run build:allnode --test test/sweep-workflow.test.ts test/apply-cursor-trace.test.ts test/repair/exact-review-batch-workflow.test.tsgit diff --checkpassed.16f01b29508632ab3a904087191e39b20968ab68and fixed head093ffeeb6d84deba015a309750dc343f1799bb74.20in 4,056 ms and peaked at 1,109,803,008 bytes RSS (1,058.4 MiB).20in 149 ms and peaked at 113,999,872 bytes RSS (108.7 MiB).Real Behavior Proof
20plus an unrelated unreadable999.mdrecord. The scale fixture provides 50,000 valid 8,873-byte canonical records and requests only item20. Workflow assertions bind both direct and deferred setup-state calls to their exact item-number outputs.node dist/clawsweeper.js apply-decisions --target-repo openclaw/openclaw --items-dir <fixture>/items --closed-dir <fixture>/closed --plans-dir <fixture>/plans --report-path <fixture>/apply-report.json --item-numbers 20 --exact-event-publication --limit 1 --processed-limit 1 --close-delay-ms 0. The same/usr/bin/time -linvocation ran against both measured heads.999; all 115 focused tests passed. On the 50,000-record fixture, the base used 1,058.4 MiB RSS and 4,056 ms while the fixed head used 108.7 MiB RSS and 149 ms.records-item-numberis bound to the exact target for both direct and deferred publication; the behavior test verifies bounded discovery and rereads; the scale run reports selected item, apply elapsed time, and process peak RSS.Redacted production-CLI transcript:
ClawSweeper Review Disposition - August 1, 2026
Removed the release-owned
CHANGELOG.mdentry requested by the exact-head review; release context remains in this PR body.Rebased onto current
mainatb07ab751813c722d45f07ef955a8b5752ebbbb19.The direct and deferred one-item publication paths both pass
records-item-numberthrough the existing focused hydration contract.Step-specific workflow assertions cover both paths; the focused suite passes 115 tests.
The existing corpus-scale proof remains applicable to the bounded apply/read path. The deferred workflow correction closes the remaining sibling setup-state gap found during review.
The prior rank-up move remains post-land operational monitoring: observe the first canonical Worker publication and retain a redacted result if it differs from the fixture outcome.