Skip to content

fix(workboard): attribute slow card-list waits - #188782

Merged
steipete merged 2 commits into
mainfrom
steipete/perf-micro-workboard-cards-list-20260919
Oct 30, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/perf-micro-workboard-cards-list-20260919

Conversation

@steipete

@steipete steipete commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Slow Workboard card-list requests currently expose total RPC duration without showing whether they waited before the handler or in the card read itself.

User Impact

Operators using the existing diagnostics and warning settings get a bounded phase breakdown for card-list requests taking at least one second. This is diagnostic only: it does not claim to fix the underlying latency, change request results, or require new configuration.

Why This Change Was Made

Start timing at the gateway router so pre-handler authorization is included. Reuse the existing slow-request recorder and request-scoped timeline observer to separate admission/handler time and fixed nested session preparation phases, including row reads and publication settlement. Nested wall times overlap their parent phases. No request parameters, keys, paths, or error contents are logged, and fast requests remain quiet.

Production growth is 66 lines, justified by the requested missing attribution. There are no new caches, database operations, schemas, queues, or synchronization rules. Test growth is 114 lines for router success/failure attribution and bounded-span/privacy proof.

Evidence

  • The real router and session reader attribute a controlled 1,200 ms read delay to access preparation and session-row reads, separately from 25 ms of handler time. Success and thrown-error identity are preserved; private fixture values are absent from logs.
  • Existing slow-request tests cover disabled/muted logging, fast calls, slow calls, numeric subscribers, trace context, and sink failure. Eight focused tests passed.
  • On unchanged base 81cf32d99769, both router regression cases fail specifically because no warning is emitted; response/error and handler assertions pass before that failure. All 52 affected session preparation/authorization/worker tests pass on the candidate.
  • All 16 shared-response tests pass using the real logger contract; the Workboard case reproduced the incomplete logger fixture failure before this repair. Its gateway typecheck and focused lint pass.
  • Codex autoreview: scoped clean at P0–P2 on the final settled index.

pnpm check:changed --staged found a test phase-type inference error and lint declaration issues. Those are corrected: pnpm tsgo:core, pnpm tsgo:core:test, focused lint, and the final eight diagnostic tests pass. All other gates in that full check passed; their unchanged results are reused. The test-line budget passes with four lines of remaining slack. The underlying production wait is unproven; the next slow-call sample supplies the missing phase evidence. The exploratory 10,000-card worker A/A probe had rebuild medians 14.54/14.53 ms, but did not include a large session database or btrfs contention and is not a production latency claim.

Final-head CI run 41141632450, attempt 1, completed at e751e6b319551cf4999ca43d700367a0dcf4f972. All substantive jobs including security-fast passed except the inherited test-line ratchet; the aggregate CI gate failed downstream. The repaired shared-response shard passed.

Inherited-only attribution: CI tested merge f26ad2c9d5bfa2800e9a9403158ce02f02769643 over main parent 26e7d07934e57b66a3b411bfd479a546ec66c692. Base total/ceiling were 6,313,676 / 6,313,211; tested merge was 6,313,790 / 6,313,325. This PR adds exactly 114 test lines and 114 allocation, preserving the existing 465-line excess. Ratchet code and baseline scalar are unchanged. Local affected proof is green. Landing uses the authorized native pinned-head inherited-failure exception; failed CI is not represented as green.

@clawsweeper

clawsweeper Bot commented Oct 30, 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 size: S labels Oct 30, 2026
@steipete
steipete marked this pull request as ready for review October 30, 2026 22:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T22:33:24.264993Z 010e4f9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: e751e6b319551cf4999ca43d700367a0dcf4f972
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server-methods.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-sharing-authorization-async.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds phase timings to slow Workboard card-list warnings, including authorization and nested session preparation waits.

Example: A card-list request spends 1,200 ms preparing session access and 25 ms in its handler.

  • Before: Total RPC duration does not identify the pre-handler wait.
  • After: The warning reports 1,225 ms overall, with 1,200 ms attributed to access facts and nested row reads and 25 ms to the handler.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused and source-consistent, with meaningful production-owner harness coverage; shipped-entry-point evidence is absent and the failed CI gate remains unattributed.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored diagnostic-only PR is outside the ordinary contributor proof gate; its supplied evidence exercises the real router and session reader with an injected clock and fixture handler.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Operators investigating slow Workboard lists cannot distinguish session-access preparation from time spent in the card handler.
Reason: The maintainer-authored direction adds bounded attribution using existing diagnostic settings and explicitly avoids an unsupported latency-fix claim.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: it adds useful, focused diagnostic attribution, and no concrete introduced regression was found; the failed test-line CI gate remains unattributed.

Priority: P2
Reviewed head: e751e6b319551cf4999ca43d700367a0dcf4f972

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied running-Gateway trace exercises the new Workboard warning; the available behavioral evidence is the router/session-reader test harness.
Agent review details

How this fits together

Gateway requests pass through session authorization before reaching the Workboard plugin; the existing diagnostic recorder now observes that full request lifetime and emits bounded numeric timings.

flowchart LR
  A[Workboard client] --> B[Gateway router]
  B --> C[Session authorization]
  C --> D[Session preparation]
  C --> E[Workboard handler]
  B --> F[Slow request recorder]
  D --> F
  F --> G[Diagnostic warning]
Loading

Technical review

Best possible solution:

Keep timing in the existing router and diagnostic owners, preserving request results, authorization, and content-free logging.

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

Source confirms the missing Workboard phase attribution on fetched main; the supplied regression reports red-on-base and green-on-head results, but no target code was executed during this review.

Is this the best way to solve the issue?

The patch is a small extension of existing owners: outer request phases and fixed nested spans provide the requested attribution without changing storage or authorization semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1d2e0b28b60b.

Provenance checked

  • Router-owned slow-request diagnostics keeps the original intent (49576e2: Include pre-handler waits in subscription diagnostics while retaining the shared threshold and excluding session content.)
  • Session preparation and publication ordering keeps the original intent (12bb616: Join existing database preparation before capturing the discovery witness while preserving source identity and current authority.)
  • Shared-read logger fixture keeps the original intent (1d85663: Shared reads retain per-request diagnostics; the fixture previously supplied only warn and now uses the complete existing logger contract.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 49576e2 adds src/gateway/slow-request-diagnostics.ts:24 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 49576e21354f; files: src/gateway/slow-request-diagnostics.ts)

PR surface

Source +66, Tests +114, Docs +16, Other +2. Total +198 across 9 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 69 3 +66
Tests 3 118 4 +114
Docs 1 16 0 +16
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 9 205 7 +198

Review metrics

Metric Value Why it matters
Production versus test growth Production +66 net lines; tests +114 net lines The growth extends existing timing owners and adds distinct router success/error attribution plus bounded-span privacy coverage without introducing another state owner.

Labels

Label changes:

  • add P2: Useful operator diagnostics with limited scope; the patch does not repair or claim to repair the underlying latency.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Useful operator diagnostics with limited scope; the patch does not repair or claim to repair the underlying latency.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 7:15 PM ET / 23:15 UTC.

@steipete
steipete merged commit 4811c39 into main Oct 30, 2026
143 of 146 checks passed
@steipete
steipete deleted the steipete/perf-micro-workboard-cards-list-20260919 branch October 30, 2026 23:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
* fix(workboard): attribute slow card-list waits

* test(workboard): use complete logger in shared-read fixture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime security-sensitive-changed size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant