Skip to content

perf(boards): hydrate board.get widgets from one store snapshot - #114363

Merged
steipete merged 1 commit into
mainfrom
perf/gateway-workboard-get-cost
Jul 27, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/gateway-workboard-get-cost

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

board.get is the Control UI's second-most-called method on team.openclaw.ai — 275 calls in 4h at avg 197ms (max 877ms), polled continuously by the workboard surface. Per request the handler read the board store once for the snapshot and then once more per admitted HTML widget to hydrate documents: 1 + H store reads (SQLite enumeration + conversion) for H widgets.

Why This Change Was Made

One combined snapshot-and-HTML-documents read (BoardSnapshotWithHtmlDocuments) serves the whole request: the gateway handler hydrates every admitted widget from the single snapshot instead of re-reading the store per widget. Document conversion and cloning semantics are unchanged; sandbox-origin caching stays request-local; memory and SQLite board stores keep parity (new parity regressions). RPC count and response shape are unchanged; fresh view tickets remain intact, so no protocol or revision short-circuit was introduced.

User Impact

Board polling latency approaches a single snapshot-read cost; the win scales with widget count. Empty boards unchanged.

Evidence

  • Production call stats above (journal per-method histogram).
  • Board gateway tests 28/28; board store parity 33/33 (memory vs SQLite); focused re-run post-rebase: 2 shards green.
  • Changed gate: typechecks, format, max-lines, architecture guards passed (worker run); oxlint 0 findings; no CHANGELOG edit; new export consumed by 4 prod modules (knip-safe).
  • Autoreview (Codex gpt-5.6-sol, xhigh): clean, "patch is correct (0.94)".

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 06:08
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Jul 27, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:12 AM ET / 06:12 UTC.

ClawSweeper review

What this changes

The PR changes board.get to retrieve the board snapshot and admitted HTML widget documents together, avoiding an additional board-store read for every HTML widget it prepares.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 3 items remain

Keep open for normal maintainer review. The branch is a focused internal performance optimization with no definite defect found in the supplied diff, but it carries the protected maintainer label, is behind current main, and the provided PR text does not include inspectable after-fix runtime evidence for the claimed latency improvement.

Priority: P3
Reviewed head: d2f8cb22c2f396430488cfd2a0945fcd7b18317b

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and covered by targeted parity and gateway tests, but independently inspectable after-fix behavior proof is still missing.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The PR body provides test and CI claims plus before-change production call statistics, but no inspectable after-fix terminal output, benchmark artifact, runtime log, recording, or comparable live result was included. Add redacted runtime evidence and update the PR body; a maintainer can request @clawsweeper re-review if it does not refresh automatically.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR body provides test and CI claims plus before-change production call statistics, but no inspectable after-fix terminal output, benchmark artifact, runtime log, recording, or comparable live result was included. Add redacted runtime evidence and update the PR body; a maintainer can request @clawsweeper re-review if it does not refresh automatically.
Evidence reviewed 4 items Focused implementation surface: The proposed handler replaces its initial snapshot read plus per-widget HTML document reads with one getSnapshotWithHtmlDocuments call, retaining the revision check before preparing a widget.
Memory and SQLite parity coverage: The branch adds a parity assertion for the combined snapshot/document read and a gateway test that verifies board.get uses the combined read instead of readWidgetHtml.
Branch validation status: The provided check context shows completed successes for production types, lint, guard checks, board-related compact test shards, build artifacts, security-sensitive guards, and the real-behavior-proof workflow; several broader checks remain in progress.
Findings None None.
Security None None.

How this fits together

The Control UI repeatedly requests a session board through the gateway. The gateway reads board state from memory or the per-agent SQLite store, then prepares permitted HTML widgets with sandbox metadata before returning the board response.

flowchart LR
  A[Control UI polling] --> B[Gateway board.get]
  B --> C[Board store]
  C --> D[Snapshot and HTML documents]
  D --> E[Sandbox widget preparation]
  E --> F[Board response]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR body provides test and CI claims plus before-change production call statistics, but no inspectable after-fix terminal output, benchmark artifact, runtime log, recording, or comparable live result was included. Add redacted runtime evidence and update the PR body; a maintainer can request @clawsweeper re-review if it does not refresh automatically.
  • Resolve merge risk (P1) - The branch is behind current main, so the exact three-way merge result and focused board tests should be refreshed at the rebased head before merge.
  • Resolve merge risk (P1) - The PR body reports test and production-call statistics but does not provide an inspectable after-fix runtime capture demonstrating the reduced store-read path or latency result.
Agent review details

Security

None.

PR surface

Source +64, Tests +34. Total +98 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 97 33 +64
Tests 2 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 131 33 +98

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase onto current main, preserve the single-snapshot contract across both board stores, and attach redacted after-fix runtime or benchmark output showing board.get handling multiple admitted HTML widgets without per-widget store reads.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase onto current main, preserve the single-snapshot contract across both board stores, and attach redacted after-fix runtime or benchmark output showing board.get handling multiple admitted HTML widgets without per-widget store reads.

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

No user-facing failure reproduction is applicable; source inspection of the supplied diff clearly identifies the prior 1 + H board-store-read pattern that the change targets, but no independent runtime measurement was available here.

Is this the best way to solve the issue?

Likely yes: combining the snapshot and HTML-document retrieval at the board-store boundary keeps memory and SQLite behavior aligned and avoids request-time rereads without changing the gateway response contract; the rebased result and live measurement still need confirmation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0406e6636916.

Labels

Label changes:

  • add P3: This is a scoped performance improvement to an existing gateway read path, with no reported data-loss, security, delivery, or availability regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body provides test and CI claims plus before-change production call statistics, but no inspectable after-fix terminal output, benchmark artifact, runtime log, recording, or comparable live result was included. Add redacted runtime evidence and update the PR body; a maintainer can request @clawsweeper re-review if it does not refresh automatically.

Label justifications:

  • P3: This is a scoped performance improvement to an existing gateway read path, with no reported data-loss, security, delivery, or availability regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body provides test and CI claims plus before-change production call statistics, but no inspectable after-fix terminal output, benchmark artifact, runtime log, recording, or comparable live result was included. Add redacted runtime evidence and update the PR body; a maintainer can request @clawsweeper re-review if it does not refresh automatically.

Evidence

What I checked:

  • Focused implementation surface: The proposed handler replaces its initial snapshot read plus per-widget HTML document reads with one getSnapshotWithHtmlDocuments call, retaining the revision check before preparing a widget. (src/gateway/server-methods/board.ts:138, d2f8cb22c2f3)
  • Memory and SQLite parity coverage: The branch adds a parity assertion for the combined snapshot/document read and a gateway test that verifies board.get uses the combined read instead of readWidgetHtml. (src/boards/board-store.parity.test.ts:90, d2f8cb22c2f3)
  • Branch validation status: The provided check context shows completed successes for production types, lint, guard checks, board-related compact test shards, build artifacts, security-sensitive guards, and the real-behavior-proof workflow; several broader checks remain in progress. (d2f8cb22c2f3)
  • Protected maintainer handling: The PR has the maintainer label, which requires explicit maintainer handling rather than automated cleanup or closure.

Likely related people:

  • steipete: Authored the branch’s sole board-store and gateway optimization commit; current-main feature-history ownership could not be independently expanded from the available read-only inspection surface. (role: recent board-path contributor; confidence: low; commits: d2f8cb22c2f3; files: src/boards/board-store.ts, src/boards/sqlite-board-store.ts, src/gateway/server-methods/board.ts)

Rank-up moves

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

  • Rebase onto current main and rerun the focused board store and gateway checks on the resulting head.
  • Add a redacted terminal capture, log, or benchmark showing the after-fix board.get path with multiple admitted HTML widgets and no per-widget store reads.

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 604f379 into main Jul 27, 2026
213 of 222 checks passed
@steipete
steipete deleted the perf/gateway-workboard-get-cost branch July 27, 2026 06:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant