Skip to content

refactor(diagnostics): remove retired pressure-bundle writer - #130754

Merged
steipete merged 1 commit into
mainfrom
codex/cleanup20k-diagnostic-pressure-writer-20260827
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cleanup20k-diagnostic-pressure-writer-20260827

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #111382 (retirement of numeric configuration knobs).

Additional instructions

This same-repository branch is available for maintainer edits.

What Problem This Solves

The diagnostics runtime still carried an automatic memory-pressure bundle writer after its configuration was retired and its only production caller was changed to pass writeCriticalBundle: false. Its V8, cgroup, active-resource, and session-file collectors were unreachable in production but kept a second bundle-producing path and obsolete enabling tests alive.

Why This Change Was Made

Remove that private writer and its exclusive collectors at the diagnostics owner. Memory sampling, threshold/growth detection, pressure events, warning text, and repeat suppression remain unchanged. The generic/manual and fatal-error bundle writers remain, as do existing bundle readers, sanitizers, retention, CLI rendering, and support ZIP export.

The public logging-core heartbeat callback retains all optional input fields from the stable SDK. This is a type-only preservation of a shipped callback contract, not a runtime compatibility shim. No public configuration, migration, persistence schema, or protocol changes.

User Impact

No intended behavior change. Operators can still inspect and safely export older memory-pressure bundles. Plugin authors keep the existing heartbeat callback input contract. AI-assisted maintainer-requested cleanup; no UI surface changed.

Evidence

Production: +19/-369, net -350 lines. Tests: +27/-151, net -124 lines. Three obsolete writer cases were removed; the retained import/redaction test now explicitly covers old heap, cgroup, and active-resource evidence.

  • Before editing: six whole-file focused suites passed with 161 tests. Candidate: the same suites passed with 158 tests. Supplemental local runs used Node 24.19.0 and installed Vitest 4.1.10; the repository pins 4.1.11.
  • A read-only baseline/prototype differential, followed by the actual candidate differential, compared return values, events, and log bytes across 1,280 controlled Node/Bun pressure samples. Neither the writer nor its session-path resolver was called. This is deterministic source-level equivalence proof, not a live OOM test.
  • Pinned Linux proof: Blacksmith Testbox tbx_01m10v203mdkg4z3d0x94grzsr, Node 24.19.0 / Vitest 4.1.11; all six focused files and 158 tests passed. The complete source patch, dependency fingerprint, package/build/manifests, and 774 workspace aliases were checked before execution.
  • Independent Codex pre-commit review: no actionable findings, one complete pass over the five-file diff and 18 complete context files.
  • The same pinned Linux candidate passed the complete node scripts/check-changed.mjs --base a678ed6565c209023ceb962d849972fc962497f6 --staged, pnpm plugin-sdk:surface:check, and pnpm build gates. All 147 public SDK subpaths were verified; runtime import cycles and unused-export scans stayed at zero.
  • A strict TypeScript consumer of the fresh built dist/plugin-sdk/logging-core.js declarations checks all nine optional callback fields from the actual [email protected] published declarations, all thirteen fields from current baseline, unchanged return type, optional arguments, and callback assignability in both directions.
  • Four real built CLI processes, with source fallback disabled and isolated state, read an older bundle by explicit path and latest, render text and JSON, and export a support ZIP. Heap, cgroup, active-resource, and session-file evidence survives; host, session-name, payload, and fixture-token fields are redacted. Offline status/health results are recorded, and the imported file is not modified.

The local typed-lint attempt stopped in prerequisite SDK declaration generation on stale unrelated Google, markdown-it, and TUI dependency types; the complete pinned checks above passed. The first CLI probe used the wrong fixture field name (spaceAvailableSizeBytes instead of the existing spaceAvailableBytes contract). After correcting only that untracked fixture, the full probe passed; production source and assertions were not weakened.

@steipete steipete self-assigned this Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete
steipete marked this pull request as ready for review August 27, 2026 06:20
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 2:29 AM ET / 06:29 UTC.

ClawSweeper review

What this changes

The PR removes the retired automatic memory-pressure bundle writer and its private data collectors while retaining diagnostic events, old-bundle reading, sanitization, CLI rendering, and support export.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking correctness finding: the sole production heartbeat caller on current main explicitly disabled this writer, and the PR deletes that dormant path while retaining legacy-bundle parsing and manual/fatal bundle writers. This maintainer-labeled PR should remain open for its normal maintainer and exact-head CI handling.

Priority: P3
Reviewed head: 20f010b731a6eeab4c99b5a6651f2eb606c488f3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, net-negative owner-boundary cleanup with retained legacy-reader coverage and no supported live producer for the removed writer.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: this is a maintainer-authored behavior-neutral cleanup; the PR body nevertheless reports built CLI verification of reading and exporting older bundles.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: this is a maintainer-authored behavior-neutral cleanup; the PR body nevertheless reports built CLI verification of reading and exporting older bundles.
Evidence reviewed 5 items Removed producer path: The revised sampler still emits memory samples, pressure events, and warnings, but has no bundle-writing option or call; critical pressure now records that automatic snapshots are disabled.
Current-main reachability: Current main is unchanged from the PR base across all five touched paths; at the base, the only heartbeat call passed writeCriticalBundle: false, so its session-path resolver and writer branch were unreachable in normal production flow.
Retained operator contract: The bundle parser preserves memory-pressure evidence from older files, while the generic and fatal writers remain; the updated test exercises redaction and retention of heap, cgroup, and active-resource evidence.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw gateway stability --help

Result: PASS (completed)

$ node scripts/run-node.mjs gateway stability --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 109.38 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use o
… output truncated …
ing-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.3s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4250ms (slowest: built plugin control-plane loads 3473ms)
│
◇

OpenClaw 2026.8.1 (20f010b) — All your chats, one OpenClaw.

Usage: openclaw gateway stability [options]

Fetch payload-free Gateway stability diagnostics

Options:
  --bundle [path]        Read a persisted stability bundle instead of calling Gateway; pass "latest" for newest
  --expect-final         Wait for final response (agent) (default: false)
  --export               Write a shareable support diagnostics export (default: false)
  -h, --help             Display help for command
  --json                 Output JSON (default: false)
  --limit ‹limit›        Maximum number of recent events (default: "25")
  --output ‹path›        Diagnostics export output .zip path
  --password ‹password›  Gateway password (if required)
  --port ‹port›          Local Gateway port
  --since-seq ‹seq›      Only include events after this sequence
  --timeout ‹ms›         Timeout in ms (default: "10000")
  --token ‹token›        Gateway token (if required)
  --type ‹type›          Filter by diagnostic event type
  --url ‹url›            Gateway WebSocket URL (defaults to gateway.remote.url when configured)

Assertions:

  • PASS expect_output: Read a persisted stability bundle instead of calling Gateway

How this fits together

The diagnostics heartbeat samples process memory and emits pressure events for Gateway operators. Stability bundles are separately written for manual or fatal-error cases, then read, sanitized, rendered, and exported by CLI support flows.

flowchart LR
  A[Diagnostics heartbeat] --> B[Memory sampler]
  B --> C[Pressure event and warning]
  D[Manual and fatal bundle writers] --> E[Stability bundle storage]
  E --> F[Sanitized bundle reader]
  F --> G[CLI rendering and support export]
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled diagnostics cleanup proceed once exact-head CI completes? Proceed with the cleanup: Retain the deletion after exact-head CI confirms the submitted head.

Why: The source review supports the deletion, but the protected maintainer label requires explicit maintainer handling rather than automated closure.

Before merge

None.

Agent review details

Security

None.

PR surface

Source -350, Tests -124. Total -474 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 19 369 -350
Tests 2 27 151 -124
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 46 520 -474

Review metrics

Metric Value Why it matters
Production versus test LOC production +19/-369 (net -350); tests +27/-151 (net -124) The cleanup is strongly net-negative while preserving targeted coverage for the retained legacy-bundle reader contract.

Technical review

Best possible solution:

Keep one canonical diagnostics design: pressure sampling emits records and operator guidance, while manual and fatal-error paths remain the only bundle producers and old bundles stay readable.

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

Not applicable: this is a cleanup review; source inspection establishes the dormant production call path and preserved reader behavior.

Is this the best way to solve the issue?

Yes: deleting the unreachable producer at the diagnostics owner is cleaner than retaining dead collectors or adding another compatibility path, while the existing reader preserves prior bundle files.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a behavior-neutral diagnostics cleanup rather than an active user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: this is a maintainer-authored behavior-neutral cleanup; the PR body nevertheless reports built CLI verification of reading and exporting older bundles.

Label justifications:

  • P3: This is a behavior-neutral diagnostics cleanup rather than an active user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: this is a maintainer-authored behavior-neutral cleanup; the PR body nevertheless reports built CLI verification of reading and exporting older bundles.

Evidence

What I checked:

  • Removed producer path: The revised sampler still emits memory samples, pressure events, and warnings, but has no bundle-writing option or call; critical pressure now records that automatic snapshots are disabled. (src/logging/diagnostic-memory.ts:330, 20f010b731a6)
  • Current-main reachability: Current main is unchanged from the PR base across all five touched paths; at the base, the only heartbeat call passed writeCriticalBundle: false, so its session-path resolver and writer branch were unreachable in normal production flow. (src/logging/diagnostic.ts:1217, 3708934c637a)
  • Retained operator contract: The bundle parser preserves memory-pressure evidence from older files, while the generic and fatal writers remain; the updated test exercises redaction and retention of heap, cgroup, and active-resource evidence. (src/logging/diagnostic-stability-bundle.ts:535, 20f010b731a6)
  • SDK compatibility boundary: logging-core publicly re-exports the heartbeat; the PR preserves the callback’s retired optional fields locally while the heartbeat itself only supplies emitSample. (src/plugin-sdk/logging-core.ts:11, 20f010b731a6)
  • History and ownership: History ties the retired configuration to the merged config-surface reduction and the original opt-in writer to the diagnostics area; blame attributes the pre-PR option fields to the current diagnostics history. (src/logging/diagnostic-memory.ts:345, 783a5d21cfc1)

Likely related people:

  • steipete: Current history shows sustained diagnostics work, including the original opt-in memory-pressure snapshot path and the merged configuration retirement that made it dormant. (role: feature owner and recent area contributor; confidence: high; commits: 66c64a29ee60, 783a5d21cfc1, 20f010b731a6; files: src/logging/diagnostic-memory.ts, src/logging/diagnostic.ts, src/logging/diagnostic-stability-bundle.ts)
  • vincentkoc: History shows prior maintenance of actionable memory-pressure diagnostics and stability-evidence type boundaries. (role: adjacent diagnostics contributor; confidence: medium; commits: b00e1b2e7bcc, dbb62bba85d7; files: src/logging/diagnostic-memory.ts, src/logging/diagnostic-stability-bundle.ts)

Rank-up moves

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

  • Allow exact-head CI to complete 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.

@steipete

Copy link
Copy Markdown
Contributor Author

Final verification for head 20f010b731a6eeab4c99b5a6651f2eb606c488f3: ordinary CI run 33045543519 completed successfully on its first attempt. The initial draft-only run was skipped and is not counted as proof. Actual hosted production type and lint logs confirm core/UI/plugin type checks, all lint shards, and formatting completed.

Both independent Codex reviews completed with no actionable findings: the pre-commit pass and a distinct published-head pass over the complete five-file diff plus 18 complete source contexts. The published source and proof tree stayed unchanged afterward.

The complete pinned Linux checks, SDK surface/full build, strict consumer of freshly generated public callback declarations, and four real isolated built CLI processes all passed. The SDK consumer preserves every optional field from the published stable callback and current baseline. The CLI checks preserve old heap/cgroup/resource/session evidence, redaction, and imported-file bytes through explicit/latest reads and support ZIP export. No live OOM or Gateway is claimed; the export records the expected offline health result. The hosted SDK API-report job deliberately skips PR events, so the separate built SDK consumer is the actual compatibility proof.

Production is +19/-369, net -350 lines; tests are +27/-151, net -124 lines. Only the unreachable automatic writer and its exclusive collectors were removed. Generic/manual/fatal writers, old bundle readers/sanitizers, pressure events/logging, and the shipped callback contract remain. The original stale local dependency failure and the corrected untracked CLI-fixture typo remain documented in the PR body. The latest ClawSweeper review has no findings; its only Rank-up move was to wait for exact-head CI, now completed. This authorized maintainer workflow supplies its requested maintainer handling; no new product decision or approval-rule bypass is involved.

Nonblocking follow-up from review: the unchanged context.assembled branch in src/logging/diagnostic-stability.ts assigns record.bytes = event.promptChars twice. This is a small redundant assignment, not a behavior bug claimed by this PR; it remains outside the frozen writer-removal patch.

@steipete
steipete merged commit 5f33245 into main Aug 27, 2026
271 checks passed
@steipete
steipete deleted the codex/cleanup20k-diagnostic-pressure-writer-20260827 branch August 27, 2026 07:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
steipete added a commit that referenced this pull request Sep 17, 2026
…#150894)

Clarify the retirement of diagnostics.memoryPressureSnapshot and automatic pre-OOM stability snapshots. Critical-memory warnings now emit the existing measurements once and point to supported diagnostics export, existing stability bundle inspection, and manual Node allocation profiling.

Doctor now names the retired tuning keys it actually removes, including explicit false values and concrete wildcard paths, through the shared migration owner. Preserve the intentional retirement from #111382 and #130754, configuration deletion semantics, backup/write flow, and automatic startup repair ownership.

Related: #150864. Thanks @dom521 for reporting the confusing upgrade messaging.

Validation: five focused suites (350 tests) and check:changed passed in the author lane; exact-head CI run 35222541964 is green. Approved Codex autoreview and ClawSweeper review found no actionable issues. Proof used synthetic inputs; no real Gateway or OOM workload was run.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…openclaw#150894)

Clarify the retirement of diagnostics.memoryPressureSnapshot and automatic pre-OOM stability snapshots. Critical-memory warnings now emit the existing measurements once and point to supported diagnostics export, existing stability bundle inspection, and manual Node allocation profiling.

Doctor now names the retired tuning keys it actually removes, including explicit false values and concrete wildcard paths, through the shared migration owner. Preserve the intentional retirement from openclaw#111382 and openclaw#130754, configuration deletion semantics, backup/write flow, and automatic startup repair ownership.

Related: openclaw#150864. Thanks @dom521 for reporting the confusing upgrade messaging.

Validation: five focused suites (350 tests) and check:changed passed in the author lane; exact-head CI run 35222541964 is green. Approved Codex autoreview and ClawSweeper review found no actionable issues. Proof used synthetic inputs; no real Gateway or OOM workload was run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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