Skip to content

improve: reduce session-row bookkeeping during UI refreshes - #146797

Merged
steipete merged 1 commit into
mainfrom
codex/swarm-ui-row-provenance
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/swarm-ui-row-provenance

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.

Before: ordinary session row with synthetic data

After: unchanged ordinary session row with synthetic data

@clawsweeper

clawsweeper Bot commented Sep 13, 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 app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 06:19
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 2:25 AM ET / 06:25 UTC.

ClawSweeper review

What this changes

Reduce 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
Reviewed head: 8b8a30d81720924fa0fecf6844ff9401160ebe77

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with credible contract coverage and appropriately limited benchmark claims; no blocking defect was found.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The ordinary external-contributor gate does not apply to this maintainer-authored PR. Its supplied microbenchmark targets provenance checks and self-merges; inspected mock-Gateway screenshots support unchanged appearance, not real-Gateway latency or runtime security claims.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor gate does not apply to this maintainer-authored PR. Its supplied microbenchmark targets provenance checks and self-merges; inspected mock-Gateway screenshots support unchanged appearance, not real-Gateway latency or runtime security claims.
Evidence reviewed 7 items Pinned change and semantic equivalence: The complete introduced patch changes only the provenance owner and its tests. The self-merge shortcut requires existing metadata; unobserved rows retain the full owner-binding path. Read predicates retain their zero-revision defaults without allocating metadata.
Production callers and lifecycle: Roster projections call mergeRow for held and incoming rows. Connection checks still fence publication, and reset replaces the provenance WeakMap. These are renderer freshness records, not authorization grants; the patch has no Codex dependency-contract signal.
Current main and release comparison: Fetched main and latest release v2026.9.4 both contain the original provenance blob 42ee6ef90fba6a854d3ea55acc3163ce79cc9f3e; neither contains this optimization.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +21, Tests +57. Total +78 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 31 10 +21
Tests 1 57 0 +57
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 88 10 +78

Review metrics

Metric Value Why it matters
Production versus test growth production +21 net lines; tests +57 lines Explicit short-circuit loops explain the production growth by removing temporary allocations while retaining the existing owner.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is an internal performance improvement with no claimed change to visible behavior or urgent broken workflow.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor gate does not apply to this maintainer-authored PR. Its supplied microbenchmark targets provenance checks and self-merges; inspected mock-Gateway screenshots support unchanged appearance, not real-Gateway latency or runtime security claims.

Label justifications:

  • P3: This is an internal performance improvement with no claimed change to visible behavior or urgent broken workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor gate does not apply to this maintainer-authored PR. Its supplied microbenchmark targets provenance checks and self-merges; inspected mock-Gateway screenshots support unchanged appearance, not real-Gateway latency or runtime security claims.

Evidence

What I checked:

  • Pinned change and semantic equivalence: The complete introduced patch changes only the provenance owner and its tests. The self-merge shortcut requires existing metadata; unobserved rows retain the full owner-binding path. Read predicates retain their zero-revision defaults without allocating metadata. (ui/src/lib/sessions/session-row-provenance.ts:150, 8b8a30d81720)
  • Production callers and lifecycle: Roster projections call mergeRow for held and incoming rows. Connection checks still fence publication, and reset replaces the provenance WeakMap. These are renderer freshness records, not authorization grants; the patch has no Codex dependency-contract signal. (ui/src/lib/sessions/session-roster-observations.ts:183, 8b8a30d81720)
  • Current main and release comparison: Fetched main and latest release v2026.9.4 both contain the original provenance blob 42ee6ef90fba6a854d3ea55acc3163ce79cc9f3e; neither contains this optimization. (ui/src/lib/sessions/session-row-provenance.ts, b2670d47f621)
  • Feature-history routing: The symbol-history search identifies the prior session-view consistency change. Its raw recorded parent was inspected, and the parent comparison adds the provenance module, including the current WeakMap declaration. (ui/src/lib/sessions/session-row-provenance.ts:33, 1ad9fe2a759d)
  • Contract coverage: The new tests protect fallback ownership, read/event field receipts, and reset invalidation. Existing row-observation and optimistic-provenance suites cover foreign-agent isolation, stale reads, deleted rows, connection retirement, and concurrent local edits. Tests were inspected, not executed during this read-only review. (ui/src/lib/sessions/session-row-provenance.test.ts:7, 8b8a30d81720)
  • Supplied performance and appearance evidence: The captured PR body reports 57 passing tests and seven benchmark rounds: 8,192 read checks fell from median 11.449 to 0.635 ms, and self-merges from 36.042 to 0.472 ms. Both downloaded screenshots were inspected and have identical SHA-256 7cdd7ab13cbdeb47d97b4a33e9393adddd128989735f4c012db4d2478e4d5335. They show the renamed session, conversation, and composer draft; they do not establish end-to-end latency. The body explicitly limits its timing claim because of background load. (8b8a30d81720)

Likely related people:

  • Peter Steinberger: Raw commit 1ad9fe2 adds ui/src/lib/sessions/session-row-provenance.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1ad9fe2a759d; files: ui/src/lib/sessions/session-row-provenance.ts)

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 849c260 into main Sep 13, 2026
180 checks passed
@steipete
steipete deleted the codex/swarm-ui-row-provenance branch September 13, 2026 06:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* 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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant