Repository navigation
Conversation
OpenClaw-Publication: 3c8ed9c2-cdf2-4a3e-9cfc-cb237d488ace
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR keeps old transcript payloads in the read worker and sends bounded summary inputs to the Gateway. Example: Compact a session containing 33,000 events of 15,000 characters each.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR addresses a real memory problem, but the new worker lifecycle serializes compactions across sessions. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherSession compaction reads persisted transcript history, prepares model input, generates a summary, and commits it through the existing session owner. flowchart LR
A[Compaction request] --> B[Transcript read worker]
B --> C[Prepared facts and retained context]
B --> D[Bounded summary input]
D --> E[Gateway model request]
C --> F[Session compaction owner]
E --> F
F --> G[Persisted summary]
Technical reviewBest possible solution: Keep the bounded-input design while releasing the worker between planning and rendering, following the existing concurrency repair. Do we have a high-confidence way to reproduce the issue? Current-main source retains complete active-window hydration, and the linked report supplies an affected-release reproduction; this read-only review ran no target code. Is this the best way to solve the issue? Worker-owned facts and shared serialization address the allocation boundary, but the worker task must end before waiting for model responses. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 53f1d04461d0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1979, Tests +819, Other +181. Total +2979 across 80 files. Added test files: 3. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 14, 2026, 9:14 AM ET / 14:14 UTC (Revision 2). |
OpenClaw-Publication: b899f5e4-7fb9-46f0-9b19-635e33a8b99c
OpenClaw-Publication: 33dc62a0-c779-4768-97d2-4b3fa2323cdf
OpenClaw-Publication: f8c0512a-6354-4487-b291-d85f50f68262
OpenClaw-Publication: 90ea6a98-3750-4df1-8f07-6333b0ba229c
Preserve prepared summary budgets, deterministic floors, refusal recovery, and held-read release ordering while resolving current main conflicts. Keep the bounded worker source and repair fallback Result handling. Validation: 209 focused tests across 11 files, core typecheck, scoped lint and format pass. Full build reaches the inherited identity-file.worker module-budget failure (240 > 220); real Gateway and exact-head performance proof remain blocked. Co-authored-by: RomneyDa <[email protected]>
Keep the slow-GC diagnostic behind its own lazy operation boundary so small workers do not eagerly evaluate the logging graph. Preserve collection thresholds and warning fields. The existing production build gate reproduces 240 identity-worker modules on the base and passes at 203 after the repair (budget 220 unchanged). Full and sourcePerformance builds, 11 focused worker tests, infra typecheck, lint, and format checks pass. Independent native review found no actionable P0/P1/P2 findings; local autoreview was unavailable because Codex was not installed. Co-authored-by: RomneyDa <[email protected]>
The seed turn already completed before manual compaction, so do not label its request as pending. Reject degraded fallback to keep the probe honest about normal-summary coverage. Validated with 12,460 events of 15KB, cold restart, audited non-degraded compaction, and two verified follow-up replies in an isolated local container. Co-authored-by: RomneyDa <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Current revision — November 14, 2026
Published head:
e81f9c5176ae71ea9c86ff0f94916e8f394031d3. Integrated mainc787d0fac8265bfb54f9d1dd05a3eb55298c487b, preserving bounded worker compaction, deterministic floors, refusal recovery, credential redaction, and the canonical summary-budget owner. Fixed a throwing fallback resolver that could bypass read-release and attempt settlement, using an explicit Result contract across its callers with worker-backed regression coverage. Includes the separable build prerequisite from #198881.Current-revision validation
Evidence limits
Benchmarks below are historical prior-head results, not renewed performance acceptance for this head. No fresh five-pair benchmark or real-model summary-quality claim. This synthetic replay does not close #191847 or validate copied production data, macOS, Codex, custom plugins, or the #196987 upgrade. Both release lines need tailored bounded-source backports, not a blind cherry-pick of the integration merge. Current-head CI remains required.
Closes #195361
What Problem This Solves
Fixes large Gateway heap spikes while built-in compaction summarizes a long active conversation, without repeatedly parsing the full transcript.
User Impact
Old transcript payloads remain in the existing read worker. The Gateway receives retained context and budget-sized summary inputs, owns model calls, and commits after the read snapshot closes. Custom/native compaction providers retain their raw-history contracts. No configuration, schema, or dependency change.
Why This Change Was Made
The first revision reduced host memory but parsed 4.03 GB against a 1.01 GB baseline. That tradeoff was rejected. This revision records compact token, file-operation, safeguard, and serialization facts during the initial payload read. Later passes consume those facts and hydrate only selected output. Array and worker callers share the same decision owners; duplicate token estimation and synthetic message builders are removed. Snapshot-scoped facts disappear with the read, rather than becoming another persistent cache.
Evidence
Five serial interleaved baseline/candidate pairs (A2–B6), excluding the three design-selection diagnostics. All ten exited 0, compacted successfully, and verified an 8,192-byte follow-up. Source/build fingerprints were stable throughout. Each cell is median / nearest-rank p95 / min–max; with five samples p95 is the maximum.
Parsing is 1.00434× baseline, not 4×. The small surplus is selected-row rereads and follow-up hydration, not another full-history pass. Compaction p95 improved 51.13%; follow-up p95 improved 13.82%. No samples were discarded or repeated for nicer results.
Tradeoff: worker-local peak heap is 132.0–137.8 MB versus baseline 95.6–109.3 MB (>20% higher internally), while total process RSS is about halved. The existing 512 MiB worker heap limit is unchanged. This does not claim every internal metric improves. Prepared facts scale with entry count; raw retained context remains governed by semantic replay constraints.
Acceptance rule set before measurement: isolated cold-restarted built Gateway; 33,000 synthetic 15,000-character history events; manual RPC compaction; slow mock summary; verified next reply; five serial interleaved pairs. Require at least 50% lower main heap, no higher process RSS, preserved behavior, no 20% latency/CPU regression, and eliminate the full-history parsing amplification. Synthetic summaries were quality-degraded equally in both variants: runtime continuity proof, not a real-model summary-quality claim.
Samples and reproduction
No builds/tests overlapped these samples; remote code review ran concurrently. Host load was lower in some candidate samples, so timings are qualified by the recorded load; parsing counts were identical within each variant. Both Gateway lifecycles exited 0, and owned mock processes were terminated during cleanup.
Baseline:
bd63497962a1b90f2653ce1bdc350f31caaf4608. The five-pair candidate predates the final incremental identifier-allocation fix and packaging/type-only review repairs; a rebuilt final-source smoke run is reported separately below. The measurements are not represented as exact-final-head CI.Review and validation
Full local autoreview against the pinned baseline completed at P0–P2. It found repeated projection in the previous index snapshot (already removed by the rewrite) and retaining/joining ten recent outputs for identifier extraction. The latter is repaired with incremental extraction and the unchanged 12-identifier cap; a red-before/green-after regression verifies ordered deduplication and stopping before another output is fetched. Independent review found no P0–P2 issue in that repair. A second limited independent review compared the final module/lint repairs against the saved single-read snapshot: no functions or algorithm behavior lost; no actionable P0–P2 findings.
Hosted ClawSweeper reviewed the earlier published head and identified a missing wrapper runtime dependency and a static import cycle. The wrapper source-closure regression reproduced the exact missing dependency before its inventory repair; both wrapper closure checks pass afterward. The full static import-cycle checker reproduced one strongly connected component and now reports zero. Type-only contracts were separated from their runtime implementations, and all consumers migrated. The rebuilt final-source Gateway confirmation passed after those repairs.
Complexity and size
Before the subsequent main-conflict integration, this was a simpler execution path, not a line-count win: production is +3,119/−1,353 (net +1,766), tests/harness +702/−53, proof/tooling +181/−10 across 68 files. Many additional touched files are type-only import migrations needed to break the verified architecture cycle. Compared with the initial published revision (net +1,638 production), production still grows by 128 lines.
The removed complexity is repeated full-history payload passes, duplicate token estimation, and two synthetic-message builders. Existing preparation/file-operation module boundaries remain to keep implementation units manageable. One read-snapshot owner retains compact facts; the host still owns model calls and persistence. No parallel persistent cache, manager, schema, or configuration option was introduced. A two-file serializer/string-sharing alternative was also measured: it left substantially more host heap/RSS and compaction CPU/latency than the selected design and did not eliminate full host hydration.
Focused validation after the repairs: 169 tests across 12 files passed (117 core/serializer, 50 safeguard/worker, 2 wrapper inventory tests); scoped test-inclusive TypeScript checking passed. Formatting and diff whitespace checks passed. The final unused type import was removed and its narrow lint rerun passed; all other changed-file lint findings were already resolved.
pnpm buildexited 0.Final-source B7 confirmation: successful compaction and 8,192-byte follow-up, unchanged source/build fingerprints, cleanup complete. Heap 326.64 MiB, RSS 2,195.45 MiB, CPU 12,607.89 ms, compaction 4,430.09 ms, parsed bytes 1,012,176,975 (identical to the five-pair candidate). Follow-up was 1,710 ms, 26.8% above the earlier baseline median; this unpaired smoke does not establish an across-the-board final-head latency improvement. Host load 11.11/9.64/8.74. A subsequent A7 baseline passed without repeating B7: follow-up 1,429 ms, making final B7 281 ms slower (+19.66%) in this reverse-order pair. This is just below the predefined 20% threshold, not evidence of no regression; no causal attribution to host load is established. A7 heap 2,346.8 MiB, RSS 4,242.6 MiB, CPU 18,489 ms, compaction 9,216 ms, parsed bytes 1,007,800,410, host load 10.01/10.76/9.62. Both runs passed compaction, next-reply verification, input consistency, and cleanup. The five-pair distribution remains reported separately, without mixing in these final confirmations.
The successful build reported nonfatal UI size-budget violations: CSS gzip 319.1 vs 317.5 KiB, CSS raw 1,644.3 vs 1,636.5 KiB, chat boot gzip 1,268.5 vs 1,268.1 KiB, new boot gzip 785.4 vs 784.5 KiB. No UI files changed; budget success is not claimed and these have not been attributed to the baseline. The previous published revision had failing CI; Actions log access returned HTTP 403, so failures beyond the reproduced wrapper/import-cycle defects remain unattributed. The updated head requires its own CI.
Main-conflict integration
Integrated main
80ba593b8b14bb3f5ddd6634a92805e04707b25cafter GitHub confirmed conflicts against published head45cdc873087b98b3e22e897ceb430523f702e1e8. Preserved main's canonical configurable summary-budget owner, carryingmaxSummaryCharsthrough worker retention planning, safeguard facts, final fitting, and persistence. Raised standalone limits receive foreground budgets before worker planning, and late-supplied budgets constrain already-prepared summaries. Agent-specific settings retain precedence. Small extractions use existing settings, accounting, session utilities, and request-budget owners.Affected validation: 86 tests across seven files passed, plus 13-file lint, core and changed-test typechecks, runtime/static cycle checks, formatting, and whitespace checks. Fresh independent review of the integration against both parents found no actionable P0–P2 findings. Earlier 169-test/build and five-pair performance evidence remain prior-integration evidence, not exact-new-head CI. Post-integration
pnpm buildpassed. Exactly one B8 real-Gateway confirmation with mock model servers passed: compaction 4,112.80 ms, 843-character quality-degraded synthetic summary, verified 8,192-byte follow-up in 1,292 ms, host heap 316.43 MiB, process RSS 1,849.30 MiB, CPU 8,608.55 ms. Parsed bytes were 1,011,128,679 for compaction plus 1,049,265 for hydration (1,012,177,944 total). Source/build fingerprints were unchanged during the run; all four child processes exited and ports had no listeners. Nonfatal compiler/bundler warnings remain. This confirms post-conflict behavior/integration, not renewed five-pair performance acceptance or real-model summary quality.CI repair follow-up
Published runtime repair at
c8192c374747: isolated the held compaction read from the projection worker lane to remove a callback deadlock; repaired context reads and aligned inherited test expectations while preserving admission and persistence fences. Local validation passed 91 focused tests across 11 files, build, production/test types, scoped lint, and fresh independent review. No configuration, schema, or migration changes.Current-head CI run 42765199979 identified excess test-line allocation: 755 credits versus 751 allowed after the repair removed four test lines. The follow-up lowers bounded-compaction credit from 648 to 644; the prepared-summary credit remains 107. No tests or production code change, and the shared scalar is unchanged. The exact CI merge tree reproduced the 755/751 failure before this correction. Updated-head remote CI remains required; this does not claim renewed performance acceptance.