Repository navigation
improve: reduce session-row bookkeeping during UI refreshes - #146797
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: needs maintainer review before merge. Reviewed September 13, 2026, 2:25 AM ET / 06:25 UTC. ClawSweeper reviewWhat this changesReduce temporary allocations and redundant merging when the Control UI checks and refreshes session rows, with tests preserving ownership and freshness behavior. Merge readiness✅ Ready for maintainer review Keep open: this is a useful, bounded optimization absent from the reviewed main and latest release. No actionable correctness or security defect was found. Priority: P3 Review scores
Verification
How this fits togetherThe Control UI tracks which Gateway read or event supplied each session field. This bookkeeping lets session lists and conversation views share fresh information without accepting stale updates. flowchart TD
A[Gateway reads and events] --> B[Session roster]
B --> C[Row ownership and freshness]
C --> D{Already tracked self-merge?}
D -->|Yes| E[Reuse existing row]
D -->|No| F[Merge field observations]
E --> G[Session lists and conversation views]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +21, Tests +57. Total +78 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep freshness tracking in the existing provenance owner while avoiding work that cannot change the row or its observation receipts. Do we have a high-confidence way to reproduce the issue? Not applicable to a correctness bug: the PR explicitly proposes an optimization. Source confirms the redundant allocations and self-merge work; reported timing results were not rerun. Is this the best way to solve the issue? Yes. The patch optimizes the existing owner without introducing another cache, changing its public contract, or weakening the unobserved-row fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b2670d47f621. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* commit '2acbeee461474b6ba41f5186ae1a4e0e80f4087a': (117 commits) fix(ui): import the shared deferred helper in sidebar scope tests (#146862) fix(ui): copy chat content from its context menu (#146679) perf(memory): defer legacy sidecar writer imports (#146815) fix(e2e): accept expected Kitchen Sink worker rejection (#146681) fix(ui): distinguish absolute and relative file links (#146572) feat(ui): keep file previews in tabs and render HTML (#146672) refactor: reuse shared deferred promises in UI tests (#146670) fix: gateway stop/restart refuses a healthy gateway when the Windows process snapshot misses (#146387) improve(crabbox): keep healthy cloud desktops warm on resume (#146816) fix: report blocked SQLite WAL checkpoints in status and doctor (#146775) feat: share browser dashboards with agents (#146702) fix(doctor): continue repairs after legacy agent directory collisions (#146092) feat(agents): retry cyber-refused embedded turns on Daybreak (#145291) fix: restore media uploads through protected egress (#144902) refactor(qa): share capture filter rendering (#146696) fix(cli): keep running stream jobs visible as running (#146793) refactor(parallels): share gateway readiness loop (#146694) fix(sessions): avoid rewriting already-consumed input on release (#146795) fix: preserve scheduled conversation delivery after Doctor (#146794) perf(ui): avoid redundant session-row provenance work (#146797) ...
Related: #130741
What Problem This Solves
Repeated session-roster checks and projections allocate temporary provenance objects and scan fields even when no new facts need merging.
User Impact
There is no visible behavior change. Session views retain the same ownership, field freshness, and connection-reset behavior.
Why This Change Was Made
Read existing observation receipts directly and reuse an already-observed row during self-projection. Unobserved rows still take the full merge path so their fallback owner binds correctly.
Evidence
The two ownership-contract tests and existing row-observation, optimistic-provenance, and supplemental-reconciliation suites pass: 57 tests across four files. The canonical changed gate and independent P1 review passed. These tests protect behavior during optimization; they do not demonstrate an old-code correctness failure.
One fixed before/after microbenchmark on Node 24.21.0 retained all 28 predefined samples, including warmups. Across all seven rounds, median read-check batches fell from 11.449 to 0.635 ms and observed self-merge batches from 36.042 to 0.472 ms, each over 8,192 operations. The host had substantial background load, so these results support the local cost reduction without establishing isolated-host timing or end-to-end latency.
The ordinary mock-Gateway UI flow passed before and after: a session-name event updates the visible row while preserving the conversation and composer draft. Both complete screenshots were inspected, contain only synthetic data, and are byte-identical. They document unchanged appearance rather than a visual bug reproduction.