Skip to content

perf(dashboard): shrink gallery session list payloads - #169062

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-dashboard-sessions-list-payload-20260919
Oct 11, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-dashboard-sessions-list-payload-20260919

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The dashboard gallery repeatedly downloads session execution and settings metadata that its cards never render. Observed 200-row refreshes transfer about 348 KB, often twice per minute per open tab.

User Impact

Gallery refreshes transfer smaller rows while preserving cards, author/search filters, sorting, navigation, pagination, and event updates. Other compact and full sessions.list callers retain their response fields.

Why This Change Was Made

Add rowMode: "dashboard" at the existing session-row presentation owner. The gallery uses that projection, including the ownership and lineage facts its shared event reconciler needs. Client field provenance treats excluded fields as unknown, so gallery refreshes preserve richer descriptor/event facts. Detail panels still fetch a full descriptor.

Production LOC: +62 (86 added, 24 removed; excluding tests and docs). The existing public compact response supplies model, usage, permission, and participant fields to other callers, so narrowing it globally would break their contract. The added projection shares the existing presentation cache and revision invalidation; there is no new cache, subscription owner, configuration option, or database migration.

Evidence

On 200 synthetic persisted dashboards, same Linux process and client, five rounds of 25 warm handler + wire-serialization reads per mode:

Measurement Compact (before) Dashboard (after)
Response bytes 233,629 81,829
Median server-thread CPU per call 5.80 ms 5.56 ms
Median wall time per call 5.79 ms 5.54 ms

65.0% fewer bytes (2.86× smaller). At one or two reads per minute, this is 81.8–163.7 KB/min/tab, down from 233.6–467.3 KB/min/tab in this fixture. CPU is broadly unchanged. The fixture is smaller than the reported production payload, and cold-cache CPU and live production traffic were not measured. No operator Gateway was modified.

Remote proof used Crabbox's authorized Hetzner fallback after Testbox queueing and AWS capacity limits:

  • cbx_691e3d64764d: corrected serialization regression, 25 changed UI tests, and the benchmark above. The serialization file took 56.16 s wall / about 5.6 s test execution with node scripts/run-vitest.mjs <file> --maxWorkers=1; UI files took 9.03 s combined wall. Changed-file checks passed: the full run completed every type graph and audit, then a brace-only benchmark formatting correction passed lint and every remaining owner-planned check in run run_f8b5b73a32f363e4e1b38db53ce0c470. The successful type/test proofs were reused.
  • cbx_24c4319fe079, run run_9c6639917bac1abaf375776506303954: 63 Gateway/protocol tests including a real WebSocket response, 67 UI sibling tests, export-collision guard, 20 source-closure tests, and all five headless browser scenarios passed. Browser scenarios cover gallery navigation/retention, two independent tabs, and failure recovery. The existing WebSocket suite was included in the 177.29 s combined Gateway/protocol run; the added request ran within its existing 4.32 s persisted-usage case.
  • Original-code negative controls reject the new projection and demonstrate loss of cached model/token/settings facts in both read orders. The repaired client retains those facts and full descriptors can still clear them.
  • Independent Codex review: clean through P2. Pre-PR runtime proof used base 18941faa9629; the single commit rebased unchanged onto 6e06137f85ef (verified with git range-diff). Exact-head CI run 38132017453 reached its inherited failure in 144 s in the affected shard; cancelled checks are not counted as passes.

Commands: node scripts/run-vitest.mjs <focused files> --maxWorkers=1; OPENCLAW_DASHBOARD_BENCH=1 node scripts/run-vitest.mjs src/gateway/session-list-serialization.test.ts -t 'projects dashboard cards' --maxWorkers=1; node scripts/check-changed.mjs; the repository export/source-closure guards; and the Control UI E2E wrapper.

Remote-run accounting
Provider / lease Command / outcome
Blacksmith Testbox tbx_01m4mw0m9ek1v9vfddzef70y55 Warmup queued without a runner; stopped before validation.
AWS Initial warmup refused by the fleet active-lease limit; no lease created.
Hetzner cbx_24c4319fe079, run_da0d1b95e2cfdd42845b9b73c32a3c56 Source SHA and Node/pnpm preflight passed.
Same lease, run_40f036fea1f50c5ec94746d5d361977c Original-code UI negative controls failed as intended; the initial Gateway fixture failed before its target boundary and was repaired.
Same lease, run_9c6639917bac1abaf375776506303954 Gateway/protocol, UI siblings, closure guards, and browser proofs passed. Benchmark exposed a fixture actor-label expectation; changed gate stopped on missing rg.
Same lease, run_e25e4da639c28ac06d5c26c2547a5906 Installed rg; corrected test exposed a fixture model-selection expectation. Fixed with explicit model overrides. Lease released.
AWS cbx_f51cf62cfb47 Quota fallback provided only a 2 GB instance; released unused.
Hetzner cbx_691e3d64764d, run_28cf145c33f66e8e4cae54a7d5878636 Installed rg; final focused regressions and 200-row benchmark passed; all type graphs and audits passed. A benchmark loop needed braces for lint.

| Same lease, run_f8b5b73a32f363e4e1b38db53ce0c470 | The formatter, corrected lint step, and every remaining check from the same generated plan passed; prior successful type and test proofs reused. Lease released. |

All tests, typechecks, and browser builds ran remotely. The only Mac work was source inspection/editing, Git, formatting, and the authorized independent-review helper.

CI qualification

CI run 38132017453 failed only session-utils-store-lookup.test.ts > keeps direct selection on the physical parent across all-agent lists (separate) in checks-node-changed-compact-large-6; the fail-fast monitor cancelled the remaining selected work. The test expected modelOverrideSource: "user" after selecting the configured default, which correctly yields null.

The identical case and mismatch already failed in scheduled main run 38128806138. The test and its model-selection producers are unchanged between the tested base and this PR. Main already fixes the fixture in ec5fe47d136b. This PR retains only the dashboard change; no CI rerun or unrelated fix was added. Landing uses the maintainer-authorized inherited-failure exception, with the independent review and remote behavior/type/lint proof above.

Project gallery and membership fields through the existing session-row presenter while preserving richer client row facts and other list callers. A 200-dashboard fixture drops from 233,629 to 81,829 bytes per refresh with broadly unchanged warm server CPU.
@clawsweeper

clawsweeper Bot commented Oct 11, 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 gateway Gateway runtime size: M labels Oct 11, 2026
@steipete
steipete marked this pull request as ready for review October 11, 2026 10:27
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR adds a smaller dashboard session-row projection while preserving compact and full responses for other callers.

Example: Refresh a gallery containing 200 synthetic persisted dashboards.

  • Before: The reported compact response transfers 233,629 bytes.
  • After: The reported dashboard response transfers 81,829 bytes, a 65% reduction.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The performance case is useful and bounded validation is reported, but two verified findings remain and additional CI failure attribution is unresolved.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored PR is outside the ordinary contributor-proof gate; its reported handler benchmark, WebSocket test, and mocked-browser scenarios provide bounded validation rather than a combined real-Gateway gallery demonstration.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Open gallery tabs repeatedly download execution and settings metadata that their cards do not render.
Reason: The reported payload reduction has clear value, and the maintainer-authored direction preserves other callers rather than narrowing their response contract.

Merge readiness

⛔ Blocked before merge - 3 items remain

This PR provides a useful, distinct payload optimization, but both prior findings remain: dashboard reads can clear confirmed permission presentation, and the dashboard route tests still expect compact rows.

Priority: P2
Reviewed head: 72bd7ae10a2ddf32e0fb81b5f574641424c1dbb7

Before merge

  • Preserve omitted permission facts in the permission overlay (P2) - Dashboard rows now omit permissionMode, but SessionCapability list admission still calls permissions.reconcileList before merging held field provenance. After an event or confirmed permission change establishes a fact, a gallery read for the same session with an equal or newer updatedAt and a newer request revision records undefined at session-permission-projection.ts:144–159. Subsequent decoration clears the displayed permission setting on held rows and descriptors although the Gateway retains it. Make the permission owner treat dashboard-omitted permissionMode as unobserved, and cover a confirmed permission update followed by a dashboard refresh through SessionCapability. This prior finding remains unfixed.
  • Update the dashboard route test for the new row mode (P2) - loadDashboardsRoute obtains its query from dashboardSessionListQuery, so this change supplies rowMode dashboard to refreshList and listSnapshot. The unchanged route.test.ts expectations at lines 69 and 77 still require compact, making all three parameterized scope cases fail. Update both expectations while retaining the scope and managed-query assertions. This prior finding remains unfixed.
  • Resolve merge risk - Establish whether the additional modelOverrideSource CI failures are inherited or caused by this PR before accepting the failed validation run.

Findings

  • [P2] Preserve omitted permission facts in the permission overlay — src/gateway/session-row-presentation.ts:400-405
  • [P2] Update the dashboard route test for the new row mode — ui/src/lib/sessions/session-requests.ts:40

Tests

  • Missing end-to-end proof: Supplied browser scenarios use a mocked Gateway and do not establish a built gallery consuming dashboard-projected rows from a real Gateway; the permission-update-to-gallery-refresh composition is also uncovered.
Agent review details

How this fits together

The gallery requests sessions through the shared managed-query owner; the Gateway authorizes and projects rows, then client reconciliation combines their facts with held lists and descriptors.

flowchart LR
  A[Dashboard gallery] --> B[Managed session query]
  B --> C[Gateway session list]
  C --> D[Authorized row presenter]
  D --> E[Dashboard projection]
  E --> F[Client reconciliation]
  F --> G[Gallery and held descriptors]
Loading

Technical review

Best possible solution:

Keep the smaller projection, preserve omitted permission facts in the permission owner, and align the dashboard route expectations.

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

Source establishes both remaining findings: newer dashboard reads overwrite the permission overlay, and the route loader supplies dashboard mode to assertions requiring compact; no tests were executed during this read-only review.

Is this the best way to solve the issue?

The existing presenter and shared provenance owner are appropriate, but omission semantics must also reach the permission owner.

Full review comments:

  • [P2] Preserve omitted permission facts in the permission overlay — src/gateway/session-row-presentation.ts:400-405
    Dashboard rows now omit permissionMode, but SessionCapability list admission still calls permissions.reconcileList before merging held field provenance. After an event or confirmed permission change establishes a fact, a gallery read for the same session with an equal or newer updatedAt and a newer request revision records undefined at session-permission-projection.ts:144–159. Subsequent decoration clears the displayed permission setting on held rows and descriptors although the Gateway retains it. Make the permission owner treat dashboard-omitted permissionMode as unobserved, and cover a confirmed permission update followed by a dashboard refresh through SessionCapability. This prior finding remains unfixed.
    Confidence: 0.97
  • [P2] Update the dashboard route test for the new row mode — ui/src/lib/sessions/session-requests.ts:40
    loadDashboardsRoute obtains its query from dashboardSessionListQuery, so this change supplies rowMode dashboard to refreshList and listSnapshot. The unchanged route.test.ts expectations at lines 69 and 77 still require compact, making all three parameterized scope cases fail. Update both expectations while retaining the scope and managed-query assertions. This prior finding remains unfixed.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4db95aa552f7.

Merge-risk options

Maintainer options:

  1. Repair reconciliation and establish CI attribution (recommended)
    Preserve dashboard-omitted permissions, update the route expectations, and compare the failed model-source cases against the base before assigning any additional repair.
  2. Pause pending failure attribution
    Hold merging if the additional model-source failure cannot be explained by baseline evidence or a focused repair.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve dashboard-omitted permissionMode in session-permission-projection.ts and add a SessionCapability regression for a confirmed permission update followed by a dashboard refresh. Update both dashboard route-test rowMode expectations. Investigate the modelOverrideSource CI failures against the pinned base and repair them only if this patch causes them; preserve compact/full contracts and do not edit CHANGELOG.md.

Provenance checked

  • Compact projections and omitted-field semantics keeps the original intent (f8a5f87: Reduce list payloads while preserving richer descriptor facts and recipient-local authorization.)
  • Gallery queries, descriptor hydration, and bounded diagnostics keeps the original intent (69b2627: Consolidate gallery pagination under managed queries, hydrate settings on demand, and identify list demand without logging identities.)
  • Field ordering and confirmed outcomes keeps the original intent (1ad9fe2: Keep held session views consistent when reads, events, and confirmed actions arrive out of order.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/lib/sessions/index-supplemental-reconcile.test.ts ui/src/lib/sessions/session-row-provenance.test.ts ui/src/pages/dashboards/route.test.ts ui/src/pages/dashboards/dashboards-page.test.ts --maxWorkers=1
  • pnpm test src/gateway/session-list-serialization.test.ts src/gateway/server.sessions.list-changed.test.ts --maxWorkers=1
  • git diff --check

What I checked:

Likely related people:

  • sunlit-deng: Raw commit ac0a263 adds ui/src/lib/sessions/session-requests.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: ac0a263eebf9; files: ui/src/lib/sessions/session-requests.ts)

PR surface

Source +62, Tests +158, Docs +7. Total +227 across 14 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 86 24 +62
Tests 5 165 7 +158
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 258 31 +227

Review metrics

Metric Value Why it matters
Production versus tests Production +62 LOC; tests +158 LOC Production growth adds a projection at existing owners; tests cover payloads and field provenance but miss composition with the permission overlay.
RPC projection extension One additional rowMode value: dashboard The additive value preserves compact mode and the full-row default without adding an operator setting.

Labels

Label changes:

  • remove merge-risk: 🚨 automation: Current PR review merge-risk labels are merge-risk: 🚨 session-state.

Label justifications:

  • P2: A bounded performance improvement needs focused UI-state and test corrections.
  • merge-risk: 🚨 session-state: Dashboard omissions can replace a confirmed permission presentation fact with undefined through the separate permission overlay.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-11T10:27:11.518Z sha 72bd7ae :: needs changes before merge. :: [P2] Preserve omitted permission facts in the permission overlay | [P2] Update the dashboard route test for the new row mode

Reviewed October 11, 2026, 6:34 AM ET / 10:34 UTC (Revision 2).

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. label Oct 11, 2026
@steipete
steipete merged commit 86f4a21 into main Oct 11, 2026
197 of 232 checks passed
@steipete
steipete deleted the steipete/perf-micro-dashboard-sessions-list-payload-20260919 branch October 11, 2026 11:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged as 86f4a21 using the maintainer-authorized inherited-failure exception.

The sole test failure in PR CI 38132017453 was session-utils-store-lookup.test.ts > keeps direct selection on the physical parent across all-agent lists (separate): it expected a user model pin after selecting the configured default. The identical modelOverrideSource: null versus "user" mismatch already failed in scheduled main CI 38128806138, and main fixes that fixture in ec5fe47d136b. The failed test and model-selection producers are unchanged by this PR.

The fail-fast monitor cancelled remaining CI work; those checks are not reported as passing. The dashboard-specific remote regressions, Gateway/UI/browser sibling proof, complete type checks, lint/guard completion, and independent review passed as recorded in the PR. No CI rerun or unrelated fix was added to this branch.

steipete added a commit that referenced this pull request Oct 11, 2026
The gallery switched to dashboard rows in 86f4a21 (#169062), while this cross-route E2E still required compact rows from every caller. Preserve the no-refetch and event-rendering assertions and match the documented projection for board-filtered requests.\n\nProof: current-main reproduction failed only the dashboard case; all four routes pass after the assertion update (23.94s wrapper wall time). Scoped Codex autoreview is clean.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
Project gallery and membership fields through the existing session-row presenter while preserving richer client row facts and other list callers. A 200-dashboard fixture drops from 233,629 to 81,829 bytes per refresh with broadly unchanged warm server CPU.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
The gallery switched to dashboard rows in 8b6fa37 (openclaw#169062), while this cross-route E2E still required compact rows from every caller. Preserve the no-refetch and event-rendering assertions and match the documented projection for board-filtered requests.\n\nProof: current-main reproduction failed only the dashboard case; all four routes pass after the assertion update (23.94s wrapper wall time). Scoped Codex autoreview is clean.
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
First-parent upstream 75df19c..5ed6a30 (23 commits, including
openclaw#169005 infrastructure SQLite work and runtime-write offload, openclaw#169062,
openclaw#136677, openclaw#169070, openclaw#168857 plugin-sdk SQLite runtime writes into workers,
openclaw#169038, openclaw#168916, openclaw#169053, openclaw#169052 closed-turn transcript work in
workers, openclaw#168974, openclaw#168811, openclaw#169082, openclaw#169084, openclaw#166581 worker heap limits).

Conflicts:
- openclaw-state-worker-runtime.ts: upstream routes more update-run
  mutations to the worker; our continuation custody dispatch stays ahead
  of that branch.
- worker-access inventory: regenerated (632 files, 2429 calls).

server-restart-sentinel.ts auto-merged: upstream's awaited update-run
writes; our continuation restart delivery is unaffected.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 gateway Gateway runtime merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant