Skip to content

perf(boards): admit reads alongside transcript-only appends - #173763

Merged
steipete merged 2 commits into
mainfrom
steipete/perf-micro-read-admission-behind-writes-20260919
Oct 16, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/perf-micro-read-admission-behind-writes-20260919

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Board data reads waiting behind ordinary transcript appends even though SQLite WAL permits a concurrent snapshot read. An observed request took 33.185 seconds, including 33.167 seconds in two writer FIFO waits.

User Impact

Board widgets can read while a prepared transcript-only append holds the database writer. Widget grant changes, Board mutations, session lifecycle work, and cold initialization retain exclusive admission through native settlement. No configuration, schema, or stored-format changes are required.

Why This Change Was Made

Board authority reads used the generic write reservation. Reuse the existing queue's conflict keys: Board reads reserve the Board key, and certified warm actor appends reserve the transcript key. Every other writer remains exclusive; all writers retain mutual exclusion and FIFO ordering. Commands with initialization or reducers cannot opt into concurrency, and prepared-generation authority prevents reopening under the narrower reservation.

The redundant whole-database reservation is removed from Board reads. Production delta: +71/-21 lines (+50 net); this growth carries the transcript-only classification through the existing actor transport and preserves the live grant/settlement contract. No new queue, cache, revision fence, or compatibility path is introduced. Test delta: +108/-2 lines.

Evidence

The isolated Linux fixture contains 5,000 sessions, 6,000 retained runs, 200 approvals, 100 cron jobs, and 12 project worktrees. Baseline: 060a63ff446a. Measurements alternate baseline/head, head/baseline, baseline/head; each sample exercises the two real Board authority reads used by the RPC.

Workload Before After
600 ms native writer held, median (12 samples/version) 612.775 ms 2.221 ms
Four owned actors appending, Board read p95 (120 samples/version) 50.399 ms 2.944 ms
Same actor workload, maximum Board read 100.612 ms 14.005 ms

The held-writer case improves about 276×; real owned-actor traffic p95 improves about 17×. Every actor run commits 100 messages and completes 40 Board read pairs without failure. Observing the existing pending queue confirms exclusive admission before and transcript admission after. Idle medians remain within noise (1.37–1.86 ms across paired controlled runs). Actor-workload medians are 1.14/1.30 ms and include idle reads after writers finish; the tail and controlled results isolate the contention benefit.

Validation:

  • The actual board.data.read regression completes while a real BEGIN IMMEDIATE transaction is held. The old admission path exceeded the original five-second reproduction bound. The committed test uses framework cancellation for cleanup rather than a separate wall-clock deadline.
  • Queue regression proves concurrent transcript/read admission while preserving subsequent mutation and read ordering.
  • Four focused files passed (70 tests), one worker: openclaw-agent-write-admission.test.ts, board.runtime-boundaries.test.ts, board.plugin-capabilities.test.ts, and sqlite-board-store.worker.test.ts. Existing grant, closure, publication, and read-after-write coverage remains intact.
  • CI correctly rejected the new timeout helpers on the first head. Replaced them with withinTest, independently reviewed the repair, and reran only the two affected files: 36 tests passed. All other first-head CI gates passed. Final-head CI passed on 9b7cbb7e09d5df97cb1631303d6473b87b2322f2, including the combined CI gate, build, lint, typechecks, and selected test lanes.
  • Changed-file formatting, lint, and git diff --check passed. PR CI owns broad build/typecheck/test gates; no Testbox lease or local broad suite was run.
  • Review: independent subagent review (autoreview route unavailable), no actionable P0–P2 findings. The configured route refused preflight; operator configuration was left unchanged.

Measurement limits: the remote harness omits RPC transport and binding-handler work; the focused regression covers the actual RPC handler. Legacy append and unbound SDK-manager controls retain exclusive admission. Two fixture-preparation attempts timed out before measurements; actor preparation was serialized outside the measured interval and the process startup allowance increased before completing the remaining matched pairs. An extra unpaired head run is excluded from aggregates. No production data or Gateway was used, and no production stress deployment is claimed.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 16, 2026 04:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T04:18:23.545095Z 9b7cbb7 New commits
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Oct 16, 2026
@steipete
steipete merged commit d372cdd into main Oct 16, 2026
142 of 143 checks passed
@steipete
steipete deleted the steipete/perf-micro-read-admission-behind-writes-20260919 branch October 16, 2026 04:28
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…#173763)

* perf(boards): admit reads alongside transcript-only appends

* test(boards): use test cancellation for concurrency cleanup
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 size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant