Repository navigation
perf(sessions): compact shared lists and apply row deltas - #164573
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 3, 2026, 7:41 PM ET / 23:41 UTC (Revision 4). ClawSweeper reviewWhat this changesThis PR adds compact session-list responses, shares immutable row serialization, and applies session events directly to Activity views to reduce payload size and repeated roster reads. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain Keep open: the optimization remains useful, but the previously reported compact-row reconciliation defect is still present on the pinned head. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway projects stored session and runtime facts into authorized client rows. Control UI reconciles those rows with descriptors and events to drive session lists, Activity, and Chat settings. flowchart TD
A[Stored session facts] --> C[Gateway row projection]
B[Runtime and viewer facts] --> C
C --> D[Full or compact response]
C --> E[Authorized session events]
D --> F[Shared row reconciliation]
E --> F
F --> G[Activity and Chat settings]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +581, Tests +1370, Docs +43. Total +1994 across 34 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Preserve omitted details only while their owning model/runtime identity remains compatible, using the shared provenance owner to prevent incompatible metadata from returning through older donors. Do we have a high-confidence way to reproduce the issue? Yes, from source: hold a full descriptor for model A, then admit a newer compact row for model B with the same session identity. The field receipts retain A's thinking metadata; no executable reproduction was run in this read-only review. Is this the best way to solve the issue? The optimization direction is reasonable, but the current patch is incomplete: independent field freshness must also respect the identity that owns model-specific details. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against db966d62ae0f. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
…tead of refetching (openclaw#164573) * perf(sessions): compact shared lists and apply row deltas * test(sessions): align fixtures with shared compact rows
What Problem This Solves
Session row events made Activity refetch the entire roster even when they already contained an authoritative update. List responses also repeated detail metadata and serialized the same rows separately for every viewer.
User Impact
Activity and Current Work update admitted rows immediately from events, with a fallback refresh after at least 60 seconds. Complete Current Work windows also accept certified session starts. Sidebar, dashboard, and Activity queries request compact rows; native clients and the Sessions management view retain the full response contract. No configuration or protocol-version change is required.
Why This Change Was Made
The existing projection owns immutable row presentations and encoded bytes across requests, while every read still checks the current viewer, runtime authority, and expiring facts. The RPC serializer reuses those bytes for both list and subscription responses. Embedded readers keep separate caller-bound authorization receipts.
Compact rows explicitly mark omitted detail fields, so a later roster response cannot erase capabilities or settings admitted by a full descriptor or chat history. History merges accepted event field receipts with overlapping authoritative reads through the shared row-provenance owner. Current Work coalesces superseded full snapshots while retaining ordered partial completions. Actual membership and generation facts replace the previous reason whitelist when deciding whether another list read is necessary. List admission and Current Work share one held-ancestor coverage check; incomplete child-only events still trigger paced catch-up for parent facts.
Production LOC: +581 (+757/−176), plus 30 net lines in scoped UI instructions. The requested non-test/non-doc stat including those instructions is +611. Growth preserves four existing contracts: the default native/full-row API and compact omission semantics; per-reader authorization despite shared immutable presentation; fresh samples for active runs and expiring facts; and generation/field continuity while events overlap authoritative reads. The previous event-local encoder, reason whitelist, duplicate Current Work field copying, and History packet-replay machinery are removed.
Evidence
Synthetic Linux rig: 5,000 persisted sessions, 20 viewers, real resident projection,
sessions.listhandler and Gateway serializer. Event measurements replay the real Activity controller for five virtual minutes, two row updates/second/client and 20 ms request latency. These are synthetic measurements, not production captures.The request reduction holds for held Current Work rows, a 20-row Current Work roster replacing one session every ten seconds, and unfiltered Activity history. All three scenarios were replayed successfully against the final candidate. A fourth replay covers the actual excluded-subagent path: 20 History clients hold 100 parents while child events carry certified parent updates. It also falls from 1,180 to 80 reads over five minutes, with the final parent label updated immediately instead of remaining 100 events stale; no excluded child enters History and no parent-child link is lost. The last changed title arrives through the event immediately. The synthetic event fixture uses full rows to measure frequency savings independently of compact payload savings.
Largest sidebar field contributions before compaction: thinking levels 39,400 B; owner 34,500 B; creator 33,900 B; agent runtime 23,000 B; display name 18,690 B; label 17,490 B; thinking options 12,800 B. Owner, title, preview, lineage, placement, and other fields used by current list views are preserved.
Negative controls fail on the old source for repeated row encoding, loss of buffered row updates, and clearing compact-omitted details. Additional controls reproduce stale timestamps after permission/run state cycles, unapplied ancestors, generation conflicts, stale unheld liveness, missing parent catch-up, and resurrection of an active row from an older overlapping snapshot. The corrected source passes those regressions.
Validation uses Blacksmith Testbox (
blacksmith-testbox, profileopenclaw-check). The latest lease istbx_01m41tqn5te2a7n2mj10kfgj94: Current Work (53 cases), History and shared list-query siblings (73 cases), the resumed changed gate, and all seven Control UI browser E2E cases pass. Earlier leasestbx_01m41s4ahnntb3gasm0p6g87fpandtbx_01m41nerk3zt1sp6vnfhbxwvdhsupplied Current Work and Gateway proof, respectively;tbx_01m41ackjy89bqd9x12p3af0gpsupplied generated Swift/Kotlin and protocol verification. Core typechecking plus all 27 core test typecheck groups passed on the authorized Linux rig; unchanged inputs reuse that proof. Test fixture lint issues, a new-lease path mismatch, missing Playwright FFmpeg, and an overstrict negative-control report check were corrected; no test assertion or gate was waived. The parent-coverage repair passes all affected tests and the resumed changed gate. Independent Codex review is scoped-clean with no actionable P0–P2 findings; it covered presentation caching, serialization, compact-field preservation, and event reconciliation.Limitations: filtered or unheld history membership and full/truncated Current Work windows retain authoritative refreshes. One changed row currently retires the whole shared presentation revision: the 20-client probe encoded 400 rows (200 rows × two sharing presentations), instead of traversing 4,000 rows at transport. Active subagent durations retain fresh samples instead of reusing an older runtime value. Handler timing is inconclusive because same-head rig runs varied materially; this PR does not claim a handler-latency improvement. Initial exact-head CI exposed five test jobs with outdated expectations: immutable title rows, cached sampling clocks, and compact dashboard query identities. The follow-up changes only five test files, preserves the behavior assertions, and has a clean independent review. Its staged changed gate passed on the authorized Linux rig, including all four affected test type graphs (agents-tools 91.1 s, UI-pages 115.8 s, UI-e2e 90.3 s, Gateway-methods 94.9 s), zero dead exports, and zero lint findings. Focused runtime proof passed on Blacksmith Testbox
tbx_01m420s54azyt6vj9gttj1zw5v(openclaw-check): 55 tests covering title hydration, resident cache, privacy, serialization, dashboard unit/route behavior, and all four dashboard browser E2E cases. The command completed in 164.3 s. Two earlier leases were rejected by the workflow admission-age guard after queuing; the third hydrated and passed.Remote pre-publication proof ran on base
4ed742a52184plus the candidate; the final rebase onto711e57e41b37had zero overlapping files, an identical range-diff, and identical changed-file bytes. GitHub CI validates the rebased head. No live production Gateway or native application runtime was changed or tested. The optional compact mode leaves the default native full-row API unchanged.Focused test cost
Measured with
pnpm test <file> --maxWorkers=1on Testbox. Gateway wall times include the compiled worker preparation; test execution itself was 1.56 s for the new serialization test and 1.47 s for event parity.src/gateway/session-list-serialization.test.tssrc/gateway/serialized-json.test.tssrc/gateway/session-row-event-parity.test.tssrc/gateway/server-methods/sessions-read-diagnostics.test.tsui/src/lib/sessions/session-row-provenance.test.tsui/src/pages/activity/current-work.test.tsui/src/pages/activity/session-activity.test.tsui/src/lib/sessions/session-roster-refresh.events.test.tssrc/agents/tools/sessions-list-title.test.tssrc/gateway/server-methods/sessions-read-cache.test.tsui/src/pages/dashboards/dashboards-page.test.tsui/src/pages/dashboards/route.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/activity-session-refresh.e2e.test.ts: 7 passed, 13.11 s including the bundled app setup. The added Current Work/history browser cases each take about 0.4–0.5 s and prove visible updates plus RPC counts at the browser boundary.The existing dashboard E2E suite passed 4 cases in 43.56 s with the same E2E wrapper command and
ui/src/e2e/dashboards-list-demand.e2e.test.ts. Its error/retry and per-tab demand assertions remain intact.Current CI blockers inherited from main
The lane-caused title, cache, dashboard unit/route, and dashboard E2E failures are fixed and pass on the latest head. CI run 37161631895 tested merge
9b7a0e74a9f3(headef3ab2b3467d, base4bcd6956b0a4) and exposed two separate main regressions:check-dependencies: upstream53eb4193d0edrenamed the Linux Node tests totest-runtime-boundary.mjsandtest-stage-runtime.mjs, butconfig/knip.config.tsstill lists their old names. The two new paths exist in the CI base and are absent from this lane head. The owner fix is to update those two executable-root entries.checks-ui-e2e (5/6): upstream fix: show authoritative tool outcomes #163545 (8db9539ee84a) intentionally renders unfinished live tool cards asRunningand updates the unit expectations. The unchangedchat-tool-item-outcomes.test-support.tsstill expectsOutcome unknownand zero running rows during its live stage. The failing assertion is exactlyRunning/one row; the history contract remainsOutcome unknown/zero. The owner fix is to distinguish the live and history expectations.Neither failing owner is modified by this PR. These failures are recorded, not waived or counted as green; their repairs belong on main, followed by a rebase if needed. No unrelated upstream fixes were copied into this lane.