Skip to content

feat: report session list CPU time in diagnostics - #149291

Merged
steipete merged 10 commits into
mainfrom
codex/team-session-list-sync-cpu-v2-20260915
Sep 17, 2026
Merged

steipete merged 10 commits into
mainfrom
codex/team-session-list-sync-cpu-v2-20260915

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related: #145679

What Problem This Solves

Session-list elapsed timings cannot identify which synchronous stages consume CPU when requests also yield or wait.

User Impact

Operators can inspect six optional current-thread CPU timings in existing session-list diagnostics and benchmark summaries. Responses, diagnostic activation, and the one-second warning threshold stay unchanged. Measurement overhead remains uncertain; this change makes no performance improvement claim.

The maintainer decision is to proceed for diagnostic utility with the disclosed overhead uncertainty. The unfavorable measurements remain part of the evidence.

Why This Change Was Made

Measure store loading, preparation, row construction, cache selection, cache publication, and synchronous response work in fractional milliseconds. Preparation and row measurements accumulate synchronous chunks and finish before registry readiness, scheduler waits, or unrelated microtasks run. They exclude worker CPU and diagnostic delivery and do not form a complete request CPU total. Hits and followers retain only their own work.

The integration uses main's shared list/detail projection work budget and preserves captured state context and admission checks, cache invalidation and one-second live reuse, and fixed expiration deadlines. Row CPU surrounds input reading, materialization, and presentation in main's current row pipeline. Metadata-only lists still skip transcript preparation, including its CPU probes. Parameter and timing types remain private to the list owner, avoiding the earlier shared-contract import cycle.

The inactive path reuses existing callbacks without additional measurement callbacks or selection result records. A failed CPU counter read omits all CPU fields for that request while preserving its response or original error.

Evidence

  • Candidate 38d75d103205 incorporates main de4cb3de1cad and preserves the reviewed diagnostics integration from dc402d97dfbd and main's flattened captured model-source contract. That unchanged integration passed 40 Gateway tests, production and owning test types, targeted lint/format checks, and independent review through P2. The preceding 9fb487c84f84 also passed a broader 98-test/nine-file suite; that is earlier proof, not a rerun on every integration. The CI follow-up passed the complete three-file changed gate and fresh independent review through P2. After resolving a subsequent main conflict by adopting its shared cold-fixture discovery (fix(pr): unify worktree source checks and suppress automatic repacks #150399), all 90 budget/worktree tests passed again. The ten diagnostics and budget files are byte-identical to the reviewed candidate; the worktree fixture and wrapper match main.
  • The strengthened producer/follower test forces a yield between two rows and reports exactly 6 ms row CPU. A deliberate mutation spanning the pause fails with 1,006 ms instead of 6 ms; the mutation was removed.
  • The trusted native-wrapper inventory now includes three missing source dependencies. The same dependency repair has now also landed on main as fix(pr): include split plugin wrapper dependencies #150451. Its pre-fix failure reproduced locally; nine selected native-wrapper cases pass with unchanged limits on Blacksmith Testbox. The delegated command exited zero and the lease was stopped; its backing Actions lifecycle may show cancellation. Local wrapper checks hit Git subprocess timeouts on the loaded Mac and are not passing evidence.
  • The fs-safe observer repair passed all 24 bundle tests without changing assertions and subsequently also landed on main as test(skills): restore bounded-read growth hook after fs-safe upgrade #150419, so it is no longer a separate candidate diff. An independently landed Slack type-cycle fix also arrived through fix(discord): rejoin threads on unarchive to restore MESSAGE_CREATE events #111148; this candidate adopts that canonical owner and removes its separate Slack change. Both cycle checks report zero cycles on the resulting tree. The earlier type-only repair passed extension source types and emitted byte-identical JavaScript; its local packaged-SDK lint was blocked by ancestor dependency lookup, and it is no longer in the candidate diff. Independent review through P2 is clean for the unchanged remaining patch.
  • The remaining hosted failures in run 35173887678 were the startup budget and a cold worktree test fixture. The fixture omitted a newly imported source utility; the same one-line correction already landed in fix(zalouser): recover when listener handshakes stall #109506. The cold test reproduced the missing-module error before the repair, and all 37 worktree setup tests now pass with unchanged assertions and limits.
  • The maintainer approved recording the measured 362,706-byte startup baseline and raising the committed-baseline cap from 354 to 355 KiB. The existing 512-byte growth and 64-byte build-variance allowances are unchanged; enforcement is now 363,282 bytes. The existing generator produced the baseline. Both budget suites pass all 53 tests, and the existing evaluator accepts the retained real bundle.
  • The controlled comparison of exact base 7b6094ec7b7d and merge b524940307fc produced all 1,985 UI output files byte-identically, with both measuring 362,706 startup gzip bytes; none of the eight feature paths appears in the 333 source maps. This establishes zero UI growth from the feature in that local comparison. Darwin/Node 24.21.0 differs from CI's Linux/Node 24.20.0; the comparison does not replace hosted CI. The final follow-up changes CI budget policy; its temporary fixture repair was superseded by main. There is no user-facing UI change.
  • CI run 35185156341 passed the hosted UI budget, then exposed two inherited Slack test defects from Keep Slack control notifications from crashing gateways #150608. The shared Socket Mode receiver mock lacked the SDK's listener and acknowledgement interface, causing 87 failures before intended test behavior; a loopback test also passed an unresolved ArrayBuffer/Buffer union to Buffer.from. A local ingress-cleanup case reproduced the mock failure. The test-only repair uses a real EventEmitter with an async acknowledgement spy and narrows ArrayBuffer data; production guards, assertions and timeouts remain unchanged. All 120 selected Slack tests across nine files, including real SDK acknowledgement loopbacks, pass, as does the extension test-type graph. Independent review through P2 and formatting pass. Local packaged lint was blocked by ancestor dependency lookup in the native worktree; final-head hosted lint passed.
  • Final-head CI passed: run 35186168518 completed successfully on 38d75d103205, including the required CI gate, UI budget, packaged lint, test types and selected tests. The native watcher returned GREEN. Current-head measurement overhead remains unquantified; the disclosed diagnostic-utility tradeoff is unchanged.
Earlier validation and overhead measurements

The first two results describe head 271d00a11d37; subsequent results identify their older revisions.

  • The refreshed integration passes 106 tests across seven files, covering real list diagnostics, readiness and yield exclusions, all three row stages, materialization, search, cache expiry, visibility, and shared scheduling with session details. The row test retains its three independent stage charges and exact CPU assertions; no tests or assertions changed for this integration.
  • Fresh isolated review through P2 is scoped-clean. The refreshed source passes production types, the owning Gateway test-type groups, and targeted lint/format checks. Committed source hashes match the frozen and tested candidate.
  • The preceding 90485b4 passed 385 tests across 13 files, the complete changed-file gate, and static/runtime import-cycle checks. That proof is retained for the six unchanged files. This refresh uses focused proof for main's shared scheduling owner; it does not repeat the full local gate for unchanged code.
  • The preceding ea7 head passed CI after one exact-job rerun. Its initial config-RPC timeouts remain unexplained. The unchanged config suite passed on the c4 baseline in both macOS and Linux with Node 24.19.0. The retry used hosted Ubuntu, Node 24.20.0, four CPUs and 16.77 GB RAM, versus the original Node 24.19.0/two CPUs/8.22 GB; these passes do not establish the cause or unrelatedness.
  • A historical 24-case macOS arm64/Node 26.8.2 comparison at 3925f87 passed response parity, diagnostic ownership, and cleanup checks with stable source/build/harness/runtime hashes. It used serial metadata-only lists with 16 or 1,000 rows, collection off/on, and three alternating pairs. Raw equality was asserted by the harness; raw replies were not retained.
  • That benchmark predates the current integration. No new overhead comparison was run, and the current asynchronous implementation is not byte-identical to the measured source. All unfavorable results are retained: collection-off 1,000-row cache-hit main-thread deltas were +9.78%, −7.62%, and +11.08% (median paired increase 0.202 ms/hit); 16-row producer deltas ranged from −69.96% to +153.14%. Collection-on results were also mixed, and a +125.15% whole-process CPU cache-hit outlier remains recorded. These results establish neither negligible overhead nor a performance improvement.

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: L maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 17, 2026, 2:09 AM ET / 06:09 UTC (Revision 18).

ClawSweeper review

What this changes

Adds six session-list CPU measurements to diagnostics and benchmark summaries, documents and tests their attribution, updates the approved UI bundle budget, and repairs Slack test fixtures.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful, maintainer-sponsored contribution that current main does not replace. No blocking correctness defect was found; the recorded acceptance of measurement overhead does not require another decision.

Priority: P2
Reviewed head: 38d75d1032059bda26114ea72cc6f39ba0124b80

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation with meaningful regression coverage and verified head CI; the remaining performance uncertainty is disclosed and accepted.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate does not apply to this maintainer-authored PR, and the diff does not materially change authority. Handler tests support attribution correctness; the older macOS comparison remains historical evidence and does not establish current-head overhead.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate does not apply to this maintainer-authored PR, and the diff does not materially change authority. Handler tests support attribution correctness; the older macOS comparison remains historical evidence and does not establish current-head overhead.
Evidence reviewed 10 items Pinned introduced changes: Inspected the merge-base-to-head changes and complete affected production owners. The checkout is the original PR head; the stale test merge was not used to infer removal of current-main behavior. Final git status remained clean and diff whitespace checks passed.
Diagnostic activation and failure isolation: CPU collection uses the existing activation gate, preserves fractional milliseconds, and removes all CPU fields after a counter failure without replacing the response or original exception. Publication occurs after measurements finish.
Synchronous measurement boundaries: Preparation measurements surround generator steps, row measurements finish before awaiting scheduler pauses, and result construction is included separately. Cache selection finishes before responses or follower waits; publication remains producer-owned.
Findings None None.
Security None None.

How this fits together

Gateway session lists and subscription snapshots turn stored sessions into visible rows. The existing diagnostics owner records selected processing costs for logs and benchmark summaries without changing the returned list.

flowchart TD
  A[Session list or subscription request] --> B[Cache selection]
  B -->|New work| C[Load session store]
  C --> D[Prepare and construct rows]
  D --> E[Publish cached result]
  B -->|Hit or follower| F[Respond to caller]
  E --> F
  C --> G[CPU diagnostics and benchmark summaries]
  D --> G
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Current-head instrumentation overhead remains unquantified, and older comparisons included slowdowns; the maintainer explicitly accepted this uncertainty for diagnostic utility.
Agent review details

Security

None.

PR surface

Source +93, Tests +275, Docs +19, Other +6. Total +393 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 4 207 114 +93
Tests 4 373 98 +275
Docs 1 19 0 +19
Config 0 0 0 0
Generated 0 0 0 0
Other 3 11 5 +6
Total 12 610 217 +393

Review metrics

Metric Value Why it matters
Diagnostic surface 6 optional CPU fields; 0 new configuration options The measurements extend existing collection and benchmark consumers without adding another activation policy.
Production and test growth Production +93 lines; tooling +6; tests and test support +275 Production growth implements synchronous accounting, while tests protect attribution across waits, sharing, and failures.
UI budget policy Baseline +694 bytes; committed cap +1 KiB; allowances unchanged This is the explicitly approved correction for measured existing output, not demonstrated feature-driven bundle growth.

Merge-risk options

Maintainer options:

  1. Retain the accepted overhead tradeoff (recommended)
    Proceed under the recorded maintainer acceptance of diagnostic utility while keeping the unquantified overhead visible.

Technical review

Best possible solution:

Keep CPU accounting within the existing diagnostics owner, preserve its request-local attribution, and retain the accepted overhead caveat without implying a performance improvement.

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

Not applicable as a defect reproduction: current main exposes elapsed session-list timings, and this PR adds CPU attribution. No target code was executed during this read-only review.

Is this the best way to solve the issue?

Yes. Extending the existing diagnostics and benchmark owners is a focused solution, and the implementation preserves activation, response behavior, and cache ownership.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 12a483edfbcb.

Labels

Label justifications:

  • P2: This is a bounded operational diagnostics improvement without evidence of an urgent user-facing failure.
  • merge-risk: 🚨 other: Added hot-path CPU probes have unquantified overhead that successful CI cannot settle, although the tradeoff is explicitly accepted.
  • 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: The ordinary contributor-proof gate does not apply to this maintainer-authored PR, and the diff does not materially change authority. Handler tests support attribution correctness; the older macOS comparison remains historical evidence and does not establish current-head overhead.

Evidence

What I checked:

  • Pinned introduced changes: Inspected the merge-base-to-head changes and complete affected production owners. The checkout is the original PR head; the stale test merge was not used to infer removal of current-main behavior. Final git status remained clean and diff whitespace checks passed. (38d75d103205)
  • Diagnostic activation and failure isolation: CPU collection uses the existing activation gate, preserves fractional milliseconds, and removes all CPU fields after a counter failure without replacing the response or original exception. Publication occurs after measurements finish. (src/gateway/server-methods/sessions-list-diagnostics.ts:63, 38d75d103205)
  • Synchronous measurement boundaries: Preparation measurements surround generator steps, row measurements finish before awaiting scheduler pauses, and result construction is included separately. Cache selection finishes before responses or follower waits; publication remains producer-owned. (src/gateway/session-utils-list.ts:395, 38d75d103205)
  • Meaningful regression coverage: Read the complete diagnostics tests: they exercise registered list/subscription handlers, producer/follower/hit attribution, unrelated CPU during readiness and row yields, visibility repairs, disabled collection, and failed counters. The captured PR body reports that spanning the row pause deliberately changed the expected 6 ms into 1,006 ms. Tests were inspected, not executed during this review. (src/gateway/server-methods/sessions-read-diagnostics.test.ts:348, 38d75d103205)
  • Current-main necessity and release check: The fetched-main diagnostics owner still records elapsed phases without the six CPU fields. No provided merged PR replaces this capability. The latest-release path lookup returned 404, and local release-tree inspection could not obtain a missing object; no shipped implementation is claimed. (src/gateway/server-methods/sessions-list-diagnostics.ts:32, 12a483edfbcb)
  • Accepted tradeoffs and review continuity: The supplied complete PR body, captured under sourceRevision 2b83b9893a8c203652ab6bb19f26f757f04500846ac03feade85e2bc71d03da0, explicitly accepts overhead uncertainty for diagnostic utility and approves the measured UI baseline correction. The preceding completed review examined the same head, listed no findings, and published no rank-up moves. Historical overhead measurements remain qualified as older-source evidence. (38d75d103205)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (17 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-16T13:20:36.700Z sha 271d00a :: blocked before merge. :: none
  • reviewed 2026-09-17T00:32:12.969Z sha 9fb487c :: blocked before merge. :: none
  • reviewed 2026-09-17T01:49:42.814Z sha 7aff7ba :: blocked before merge. :: none
  • reviewed 2026-09-17T02:16:00.250Z sha 93f3980 :: blocked before merge. :: none
  • reviewed 2026-09-17T02:26:01.771Z sha dc402d9 :: blocked before merge. :: none
  • reviewed 2026-09-17T02:45:32.353Z sha dc402d9 :: blocked before merge. :: none
  • reviewed 2026-09-17T05:27:05.580Z sha 7197369 :: blocked before merge. :: none
  • reviewed 2026-09-17T05:41:55.577Z sha 38d75d1 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/team-session-list-sync-cpu-v2-20260915 branch from 3925f87 to 43b5188 Compare September 15, 2026 20:57
@clawsweeper clawsweeper Bot removed 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 Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 21:22
@clawsweeper clawsweeper Bot added 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 Sep 15, 2026
@steipete
steipete force-pushed the codex/team-session-list-sync-cpu-v2-20260915 branch 4 times, most recently from d70c745 to 90485b4 Compare September 16, 2026 08:58
@steipete steipete closed this Sep 16, 2026
@steipete steipete reopened this Sep 16, 2026
@steipete
steipete force-pushed the codex/team-session-list-sync-cpu-v2-20260915 branch from 90485b4 to ea7c33e Compare September 16, 2026 10:17
Retain the hosted PR ancestry while integrating the current shared session-projection work budget. The complete tree matches the reviewed and tested session-list CPU diagnostics candidate.
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Sep 16, 2026
@steipete steipete self-assigned this Sep 17, 2026
Integrate current main, including the memory-test CI repairs. Strengthen the existing producer/follower test with a real yield between two rows while preserving exact CPU attribution and cache assertions.

The strengthened case passes and rejects a deliberate probe spanning the row wait: 1006 ms observed instead of the expected 6 ms. Independent complete-candidate review through P2 is clean.
Keep synchronous CPU intervals around the current flattened model-source contract from main. Preserve the captured reader and fresh sharing entry during row projection and active-model refresh.

The refreshed candidate passes 40 focused tests and independent review through P2. Production typechecking passes; the owning test-type graphs and final lint checks are being completed separately.
Restore three newly imported modules in the shared native PR wrapper inventory. Observe fs-safe Root.read through its current final-fence hook while preserving all aggregate byte, status, and inventory assertions.

Both defects reproduced before repair. All 24 plugin-skill bundle cases pass; nine focused native-wrapper cases pass on Blacksmith Testbox with unchanged limits. Independent review through P2 is clean.
Give the shared receiver mock real EventEmitter listener ownership and an asynchronous acknowledgement sender, preserving the production envelope guard. Narrow WebSocket ArrayBuffer data before converting it so the loopback test typechecks without copying an existing Buffer.

The former ingress-cleanup failure reproduces before this repair; all 120 selected Slack tests and the extension test-type graph pass afterward.
@steipete
steipete merged commit 8f463a2 into main Sep 17, 2026
230 of 231 checks passed
@steipete
steipete deleted the codex/team-session-list-sync-cpu-v2-20260915 branch September 17, 2026 06:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

fuller-stack-dev added a commit to moeedahmed/openclaw-pr-fork that referenced this pull request Sep 17, 2026
Retain main’s Slack RawData typing correction from openclaw#149291. Completion source and public resolver tests are byte-identical to qualified 9c53517.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
* feat(gateway): measure synchronous session-list CPU

* fix(ci): repair native wrapper and skill-read checks

Restore three newly imported modules in the shared native PR wrapper inventory. Observe fs-safe Root.read through its current final-fence hook while preserving all aggregate byte, status, and inventory assertions.

Both defects reproduced before repair. All 24 plugin-skill bundle cases pass; nine focused native-wrapper cases pass on Blacksmith Testbox with unchanged limits. Independent review through P2 is clean.

* fix(ci): refresh measured UI budget and cold worktree fixture

Record the approved 362706-byte startup baseline under a 355 KiB cap, preserving the 512-byte growth and 64-byte variance allowances. Exact base and merge builds emitted byte-identical UI assets; hosted CI measured the same size.

Include the newly imported bundled plugin source utility in cold worktree fixtures, matching the repair already landed in openclaw#109506. Preserve all assertions and timeouts.

* test(slack): align Socket Mode fixtures with SDK acknowledgements

Give the shared receiver mock real EventEmitter listener ownership and an asynchronous acknowledgement sender, preserving the production envelope guard. Narrow WebSocket ArrayBuffer data before converting it so the loopback test typechecks without copying an existing Buffer.

The former ingress-cleanup failure reproduces before this repair; all 120 selected Slack tests and the extension test-type graph pass afterward.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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