Skip to content

perf(workboard): reuse card list payloads per store revision - #164301

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-workboard-cards-revision-20260919
Oct 3, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-workboard-cards-revision-20260919

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Every workboard.cards.list caller rebuilt the full SQLite-backed card tree, sorted it, redacted claims, and recomputed board summaries even when no Workboard state had changed. Repeated and concurrent clients paid that cost independently.

User Impact

Repeated board reads share an immutable response until Workboard state changes. The RPC shape, operator scopes, card contents, and claim-token redaction stay unchanged. No configuration or migration is required.

Why This Change Was Made

The store owns one in-flight/cached payload for each normalized board filter. Local committed writes, external SQLite reconciliation, epoch publication, and shutdown retire it. A read invalidated while building joins the replacement; failed reads are evicted. Because every response includes all board summaries, all filters depend on the store-wide revision. Unknown board ids are not retained.

The old per-call Gateway response builder is removed. Raw internal card reads remain necessary for mutation and worker operations that require unredacted claims. Production LOC is +78/−17 (net +61), excluding tests/docs. This growth enforces the requested shared immutable RPC contract, failure recovery, and owner-bound invalidation; there is no alternate cached/uncached RPC path.

The staged gate reproduced an inherited environment-name budget mismatch on untouched base c81d86e82f60. A temporary exact shrink allowed full validation. Main then landed the same fix in 5f52ff0f863c; this branch was rebased through Git, retaining the upstream comment and dropping the duplicate budget change. The final PR contains only Workboard changes.

Attachment deletion also removes card metadata. Its committed deletion now advances the existing revision even if the subsequent card update fails, preventing a permanently stale cached attachment.

Current main already uses plugin.workboard.changed subscriptions and has no routine card-list polling. This change preserves the existing publication owner. Sessions-board session changes use the same revision stream with a five-second coalescer, so event fanout can trigger card-catalog reads without a polling timer. The client audit found no native-app cards.list caller in this repository. The session accessory requires the catalog's full-card hydration, so replacing that request with boards.list would break linked-card display.

Evidence

Linux rig, Node 26.8.1, 2,000 synthetic cards, two equal 900-second runs. Ten callers use a synthetic 1.875-second cadence to reproduce 320 reads/min; ten actual browser load/live-refresh controllers are measured separately, with real card mutations at 5 and 10 minutes.

Measurement Before After
Synthetic stress reads/min 320 320
Stress handler seconds / 15 min (4,800 reads) 559.717 1.130
Event-controller handler seconds (30 reads) 28.621 3.500
Combined handler seconds (4,830 reads) 588.338 4.630 (−99.21%)
Stress bytes/call 1,013,548.99 1,013,548.99
Sampled main-isolate allocation bytes/call 5,106,579 1,020,811 (−80.01%)
Persistence card/board/aggregate read operations, each 4,830 6
Distinct stress response objects 4,800 3
Errors 0 0

Six reconstructions are exactly two distinct filters (one board and all boards) × three revisions. Current main already has zero routine polling: the real controllers made ten initial reads and ten reads per mutation in both runs, with zero reads between events. No request-rate reduction is claimed.

Commands on the authorized Linux rig used TMPDIR under the task worktree, nice -n 10 ionice -c3, and the source loader: node --import ./scripts/tsx.mjs .rig/bench.ts baseline 900000, then the same command with candidate. The controlled comparison pins baseline 02dad3a3eacd7ef5776e6ad5590ea98e3bff171e and applies only this Workboard patch (SHA-256 d97e765df3df8b64d4c5a325744be80755a964655c71ab75a16f93099abaed33); the staged gate validated that Workboard source on c81d86e82f60. Final head 1008620e7d86 rebases the unchanged Workboard bytes onto 1a5eb7fdfee7; exact-head CI passed.

The harness invokes the registered Gateway handler and real SQLite worker. Handler timing ends at response-callback entry, before JSON serialization, and is not directly comparable to production RPC metrics. Wire bytes are measured separately. Allocation uses Node inspector sampling over 100 warm calls, including serialization but excluding the worker heap. Warmup/sampling are excluded from timed counts. The shared rig had other concurrent work; operation counts and payload reuse provide deterministic evidence alongside wall timings. No full Gateway WebSocket/auth framing or rendered browser was exercised.

Provider: blacksmith-testbox for focused tests; authorized Linux rig fallback for the staged gate after the replacement Testbox lease queued for more than 20 minutes.

Run Command Result
tbx_01m40r9nh9sv0jpj5z428ys8sm node scripts/run-vitest.mjs extensions/workboard/src/gateway.test.ts --maxWorkers=1 Initial 21 tests passed; 37.55s Vitest / 39.09s wrapper wall time.
Same lease Old Gateway handler/helper with new reuse regression Failed on object identity, as intended.
Same lease Focused gateway, change-events, attachments, browser activation, live-refresh, and widgets via node scripts/run-vitest.mjs ... --maxWorkers=1 Passed both Vitest shards in 19.93s wrapper wall time before mechanical file relocation; the server shard passed 29 tests.
Same lease node scripts/check-changed.mjs --staged Transport did not preserve the index; selected no files. Not counted as validation.
Same lease node scripts/check-changed.mjs Detected line-cap growth; fixed by relocating the reader and tests.
tbx_01m40w3jbhh4z7qhmdkh9ssjgr Same focused set plus gateway.cards-list.test.ts, --maxWorkers=1, verified final HEAD and source hashes Passed on final commit: seven files, two shards, 47.54s wrapper wall time.
Linux rig, /srv/rig/wt-379-check bash /srv/rig/rig-staged-check.sh 379-check c81d86e82f6022b5bcacf2b7ebe5bd0e7f3fcf20 → node scripts/check-changed.mjs --staged Passed, exit=0, 12:05–12:30Z.

The rig gate passed line-cap/ratchet checks, extension and extension-test typechecks, dead-export scans, extension/script lint (zero warnings/errors), database/storage guards, and import cycles (zero runtime cycles). Its wrapper did not emit a timing summary table; the retained terminal result is == exit=0 (12:30Z). Extension lint reported 36.1s; script lint 56.0s.

Standalone changed-test costs on final-head Testbox (--maxWorkers=1): gateway.cards-list.test.ts passed four tests in 0.625s test time / 10.27s wrapper wall time; browser/index.test.ts passed two tests in 0.171s test time / 1.78s wrapper wall time. The final lease is stopped. CI shared-job wall times: changed-extension bundles 146s and 126s; UI shards 340s, 285s, and 374s. These are whole-job costs, not incremental per-test costs.

Independent final review: scoped-clean at P0–P2, no actionable findings. Both old Testbox leases were stopped when their base/head changed; the second, tbx_01m40s0bqvrbep3wwwm9p20n46, remained queued. Final head 1008620e7d86 passed the seven focused files on tbx_01m40w3jbhh4z7qhmdkh9ssjgr: both Vitest shards passed in 47.54s wrapper wall time (cold worker compilation included); the four server files passed 29 tests. Exact-head CI passed.

Browser proof extends the activation/accessory test with a fake 15-minute quiet interval and exactly one event-triggered reread. Server regressions cover payload reuse, normalized scopes, immutable/redacted cards, mutation/board/foreign-commit invalidation, stale in-flight replacement, failure retry, shutdown, and partial attachment deletion.

Gaps: clients maintained outside this repository were not audited. Catalog/page/widget consumers may still issue separate event-triggered reads; the server coalesces their work at the same revision. No visual behavior changed.

Final verification: CI run 37123481325 passed for 1008620e7d86e669c486607266d5aeb37566c2bb; openclaw/ci-gate, dependency review, and security-sensitive review are successful. The PR merged at 12:46:11Z as c28042dade02951be3648174b7b23066ae0c4ff5.

@clawsweeper

clawsweeper Bot commented Oct 3, 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 app: web-ui App: web-ui plugin: workboard size: M labels Oct 3, 2026
@steipete
steipete enabled auto-merge (squash) October 3, 2026 12:38
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 8:43 AM ET / 12:43 UTC.

ClawSweeper review

What this changes

Workboard reuses immutable, redacted card-list responses until store changes invalidate them, avoiding repeated SQLite reads and response reconstruction.

Merge readiness

✅ Ready for maintainer review

This remains a useful optimization absent from current main. No actionable introduced defect was found, and the supplied production-boundary benchmark supports payload reuse without changing the RPC contract.

Priority: P2
Reviewed head: 1008620e7d86e669c486607266d5aeb37566c2bb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with meaningful production-boundary measurements and lifecycle regressions; no blocking correctness or security finding was identified.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied Linux benchmark exercises the changed registered card-list handler with the real SQLite worker and mutations, reporting six reconstructions across two filters and three revisions with unchanged response bytes and zero errors. Focused tests supplement lifecycle coverage; full WebSocket framing and rendered-browser behavior were not exercised. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied Linux benchmark exercises the changed registered card-list handler with the real SQLite worker and mutations, reporting six reconstructions across two filters and three revisions with unchanged response bytes and zero errors. Focused tests supplement lifecycle coverage; full WebSocket framing and rendered-browser behavior were not exercised. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: Reviewed the merge-base-to-head patch, preserving the distinction between introduced Workboard edits and unrelated base drift. The checkout remained clean.
Single response owner: The store normalizes filters, shares pending reads, replaces invalidated snapshots, redacts claim tokens, freezes results, evicts failures, and avoids retaining unknown-board results. The Gateway retains its existing operator.read scope.
Invalidation and persistence boundary: Committed tracked mutations and change publication clear cached responses; shutdown drains admitted reads before clearing the cache. Existing attachment deletion removes both blob and card metadata, explaining why its successful commit must invalidate even when the subsequent card update fails.
Findings None None.
Security None None.

How this fits together

Workboard is an optional plugin that presents local work cards in the Control UI. Its Gateway handler reads cards and board summaries from a SQLite worker and returns them to authorized operator clients.

flowchart TD
  A[Operator card-list request] --> B[Normalize board filter]
  B --> C[Store-owned response cache]
  C --> D[SQLite worker reads on cache miss]
  D --> E[Redact claims and freeze response]
  E --> F[Shared card-list response]
  C --> F
  G[Committed writes and foreign-change events] --> C
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +61, Tests +148, Docs +8. Total +217 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 78 17 +61
Tests 2 154 6 +148
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 240 23 +217

Review metrics

Metric Value Why it matters
Production versus test growth production net +61 lines; tests net +148 lines The PR explicitly justifies production growth for shared immutable responses and lifecycle invalidation; tests protect concrete cache regressions.

Technical review

Best possible solution:

Keep one store-owned response cache with revision-wide invalidation, preserving raw internal reads and the existing operator scopes and RPC shape.

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

Yes: current-main source rebuilds the card-list payload on every request, and the supplied registered-handler benchmark reports repeated SQLite reads before the patch. This reviewer did not execute target code.

Is this the best way to solve the issue?

Yes: caching at the existing store owner centralizes invalidation and removes the superseded Gateway builder while preserving internal unredacted reads.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3bfa7cd91059.

Labels

Label changes:

  • add P2: This is a bounded performance improvement for repeated Workboard reads without a demonstrated urgent user-facing regression.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied Linux benchmark exercises the changed registered card-list handler with the real SQLite worker and mutations, reporting six reconstructions across two filters and three revisions with unchanged response bytes and zero errors. Focused tests supplement lifecycle coverage; full WebSocket framing and rendered-browser behavior were not exercised. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied Linux benchmark exercises the changed registered card-list handler with the real SQLite worker and mutations, reporting six reconstructions across two filters and three revisions with unchanged response bytes and zero errors. Focused tests supplement lifecycle coverage; full WebSocket framing and rendered-browser behavior were not exercised. No stored-data contract changes.

Label justifications:

  • P2: This is a bounded performance improvement for repeated Workboard reads without a demonstrated urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied Linux benchmark exercises the changed registered card-list handler with the real SQLite worker and mutations, reporting six reconstructions across two filters and three revisions with unchanged response bytes and zero errors. Focused tests supplement lifecycle coverage; full WebSocket framing and rendered-browser behavior were not exercised. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied Linux benchmark exercises the changed registered card-list handler with the real SQLite worker and mutations, reporting six reconstructions across two filters and three revisions with unchanged response bytes and zero errors. Focused tests supplement lifecycle coverage; full WebSocket framing and rendered-browser behavior were not exercised. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head patch, preserving the distinction between introduced Workboard edits and unrelated base drift. The checkout remained clean. (1008620e7d86)
  • Single response owner: The store normalizes filters, shares pending reads, replaces invalidated snapshots, redacts claim tokens, freezes results, evicts failures, and avoids retaining unknown-board results. The Gateway retains its existing operator.read scope. (extensions/workboard/src/store-boards.ts:68, 1008620e7d86)
  • Invalidation and persistence boundary: Committed tracked mutations and change publication clear cached responses; shutdown drains admitted reads before clearing the cache. Existing attachment deletion removes both blob and card metadata, explaining why its successful commit must invalidate even when the subsequent card update fails. (extensions/workboard/src/store-runtime.ts:129, 1008620e7d86)
  • Focused regression coverage: Four new registered-handler regressions cover normalized concurrent reuse, immutable redaction, local and foreign-write invalidation, pending-read replacement, retry, shutdown, and partial attachment deletion. The changed browser test uses fake time to protect event-driven refresh without introducing real waits. (extensions/workboard/src/gateway.cards-list.test.ts:32, 1008620e7d86)
  • Current-main necessity: Fetched main still calls the per-request builder, which independently lists cards and boards and redacts each response. Its board store lacks the new response cache, so existing event-driven browser refresh does not supersede this server optimization. (extensions/workboard/src/gateway-helpers.ts:119, 3bfa7cd91059)
  • Reported production-boundary benchmark: The fully supplied PR body reports two 900-second Linux runs with 2,000 synthetic cards through the registered Gateway handler and real SQLite worker. Each persistence read operation decreased from 4,830 to 6, response bytes remained equal, and both runs had zero errors. Timing excludes WebSocket/auth framing and rendered-browser behavior; those boundaries are unchanged. The body also reports final-head focused tests and documents source identity across the rebase. (1008620e7d86)

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.

@steipete
steipete merged commit c28042d into main Oct 3, 2026
116 of 119 checks passed
@steipete
steipete deleted the steipete/perf-micro-workboard-cards-revision-20260919 branch October 3, 2026 12:46
vincentkoc added a commit that referenced this pull request Oct 3, 2026
* origin/main:
  fix(test): restore fixture state and await async completion (#164222)
  refactor(sessions): stage and settle pending inputs in workers (#164284)
  fix: speech-only replies fail when models include reasoning (#164285)
  fix(nextcloud-talk): avoid webhook migration for unconfigured channels
  fix: guide background skill reviews through Workshop proposals (#164292)
  test(build): reject AI dependencies in retained config repairs
  refactor(channels): require canonical private-network settings (#163535)
  fix(memory): migrate embedding cache in bounded batches and record oversized rows (#164303)
  feat(state): incognito actor memory and Codex history routing (P5c, inactive) (#164224)
  refactor(synology-chat): remove unused route account ID (#164280)
  test(ui): await web push preference publications (#164295)
  perf(scripts): avoid compiler projects for runtime import parsing (#164243)
  fix(worktrees): create workspaces from nested Windows repositories (#164249)
  test(agents,channels,cli): remove low-value tests (batch d173) (#164302)
  perf(workboard): serve cards per board revision and push changes instead of polling (#164301)
  refactor(sqlite): deslop sqlite stores (#164271)
  chore(ui): refresh control ui locales (#164299)
  refactor(events): deslop listener and disposal plumbing (#164221)
  fix: canonicalize fresh worker reasoning signatures (#164287)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. plugin: workboard proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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