Skip to content

refactor(ui): centralize chat outbox projections - #117284

Merged
steipete merged 1 commit into
mainfrom
codex/prod-wave-ui-outbox-052208-2d45
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/prod-wave-ui-outbox-052208-2d45

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • centralize durable, process-live, and pane-local chat outbox projection in one per-tab/per-gateway owner
  • remove the parallel chatQueueByScope, projection-host, transient-projection, and manual publish paths
  • preserve strict quota-only volatile provenance while making direct store mutations and live send/command state visible to every subscribed pane

Root cause

Chat outbox state had multiple owners: durable rows lived in session storage, live transport state lived in a process-global map, and each pane maintained its own scoped queue cache. Mutations had to manually update or publish all three representations. That made already-open panes stale, let late acknowledgements leak back into a newly selected route, and forced consumers to infer whether a row was durable, process-live, or an explicit storage-capacity fallback.

The canonical owner is now scoped to the actual browser-tab storage object and Gateway. It reads durable snapshots from the store, overlays only owner-recorded live or pane-local facts, and publishes one projection to subscribed panes. Its lifecycle retains a source pane while live work exists, then defers empty-owner eviction across synchronous send transitions. Foreground route presentation is retained only while that pane remains on the submitted route; restored durable rows use their canonical route.

Operator-visible behavior

  • A delayed chat.send acknowledgement stays with the submitted session after the operator switches routes.
  • Split panes observe live sends, local-command execution, store mutations, removals, and compare-and-swap ownership without resurrecting stale rows.
  • Restored main aliases replay through canonical global + agent routing, while immediate foreground presentation keeps the route the operator used.
  • Attachments, send timing, waiting-model presentation, FIFO replay, steering cleanup, and crash-safe durable states survive projection.
  • Only explicit storage-capacity fallbacks acquire volatile retry provenance; ordinary durable read failures never bypass the store.
  • Session-storage isolation remains tab-local; owners are additionally separated by Gateway.

Removed paths

  • chatQueueByScope
  • chatOutboxProjectionHosts
  • transientQueueProjections
  • manual stored-outbox publication and downstream scoped-cache reconciliation

Proof

  • Blacksmith Testbox tbx_01kyy1c3tne63vsbr424ms6weq (run): 317/317 focused UI tests passed (chat-send, chat-state, outbox-store); pnpm check:changed passed every selected typecheck, lint, boundary, schema, storage, and import guard; pnpm ui:build passed Vite, 688 precompressed-sidecar checks, and Control UI performance budgets
  • Current rebased head b104a338911a: the focused changed-test router regression passes 1/1, 317/317 affected UI tests pass, and the complete pnpm check:architecture chain passes locally, including zero runtime or Madge import cycles
  • Runtime ordering proof covers pane A submitting before switching to pane B and receiving its acknowledgement afterward without projecting into B; a peer pane subscribing while a send or local command is live receives that overlay, and unrelated durable mutations do not clobber it
  • Browser ordering proof writes a canonical outbox row to the real tab sessionStorage, dispatches its storage event, navigates from session B back to session A, and observes the outbox-triggered refresh only after that route flip; all four current-head hosted UI E2E shards passed in CI run 30692862626
  • The same current-head hosted run passed all 75 reported checks, including checks-ui, check-additional-runtime-topology-architecture, compact test shards, and the repaired Memory Core changed-test router regression
  • Additional deterministic cases cover same-session split-pane FIFO, stale-pane deletion protection, route-switch steer recovery, attachment retirement, alias canonicalization, and strict storage-failure provenance
  • Fresh current-head Codex autoreview (gpt-5.6-sol, xhigh): clean, no accepted/actionable findings (0.98 confidence)

Scope

  • production: +417 / -422 (net -5)
  • tests: +121 / -122 (net -1)
  • no config, protocol, persistence-schema, or public plugin API changes

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 07:40
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 5:13 AM ET / 09:13 UTC.

ClawSweeper review

What this changes

This PR replaces separate Control UI chat-outbox caches with one browser-tab- and Gateway-scoped owner that projects stored queue rows and live send state to subscribed chat panes.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for Control UI owner review before merge. The branch has strong targeted proof and no concrete patch defect found in this read-only pass, but it changes the authoritative reconciliation of durable, in-flight, and pane-local outbox state across route switches and split panes.

Priority: P2
Reviewed head: b104a338911ae18577d6b2dd0ccdf809b1180817
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong targeted browser and CI proof supports a coherent deletion-heavy state-owner refactor, with final approval resting on Control UI ownership intent.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies after-fix browser ordering evidence using real tab sessionStorage and storage events, plus hosted UI E2E and focused Control UI test results on the current head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies after-fix browser ordering evidence using real tab sessionStorage and storage events, plus hosted UI E2E and focused Control UI test results on the current head.
Evidence reviewed 5 items Canonical projection owner: The new owner keeps per-host local rows, durable visibility, retry provenance, and per-scope live overlays, then projects one sorted queue for each subscribed pane.
Lifecycle and route callers: The existing chat state controller subscribes each page state to the outbox projection, while the branch routes save/restore through the centralized read/write projection API instead of the removed scoped cache.
Focused regression coverage: The branch changes chat-send coverage for volatile/durable ordering, route switches, split-pane projection, stale-pane deletion protection, and storage-event navigation; its browser E2E test now writes the canonical session-storage row and dispatches the real storage event.
Findings None None.
Security None None.

How this fits together

The Control UI chat page queues messages in browser session storage while sends and local commands are in progress. Chat panes subscribe to an outbox projection so route changes, split panes, storage events, and send acknowledgements present the correct queued rows.

flowchart LR
  A[Chat pane] --> B[Outbox projection subscription]
  C[Session storage rows] --> D[Tab and Gateway outbox owner]
  E[Live send and command state] --> D
  D --> F[Route-aware queue projection]
  F --> G[Subscribed chat panes]
  G --> H[Send drain and transcript updates]
Loading

Decision needed

Question Recommendation
Should Control UI maintainers accept this PR's single tab- and Gateway-scoped owner as the permanent authority for durable, live, and pane-local chat outbox projection? Approve the canonical owner: Accept the centralized projection owner after confirming that its tab/Gateway lifetime and route-presentation semantics are the intended Control UI model.

Why: The tests and CI support the refactor, but choosing the durable ownership model for cross-pane session state is an architectural responsibility decision rather than a mechanically provable patch detail.

Before merge

  • Resolve merge risk (P1) - Merging changes session-scoped UI state reconciliation: a subtle missed ownership case could show a stale, removed, or wrong-route queued message after route switching or split-pane activity.
  • Resolve merge risk (P1) - The PR is behind current main; its outbox files did not overlap the observed intervening UI changes, but the exact merge head should receive the normal review/check refresh before landing.
  • Complete next step (P2) - No mechanical repair is identified; a Control UI owner must confirm the session-state ownership model before merge.
Agent review details

Security

None.

PR surface

Source -5, Tests -1. Total -6 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 11 417 422 -5
Tests 4 121 122 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 538 544 -6

Review metrics

Metric Value Why it matters
Compatibility surface 0 config/default, protocol, persistence-schema, or public plugin API changes The refactor confines its compatibility risk to Control UI session-state reconciliation rather than adding an upgrade or public-contract surface.

Stored data model

Persistent data-model change detected: serialized state: ui/src/e2e/chat-flow.navigation-presentation.e2e.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Approve the projection ownership model (recommended)
    Accept the session-state risk after a Control UI owner confirms that one tab- and Gateway-scoped owner is the intended permanent source of visible outbox state.
  2. Pause for ownership redesign
    Hold this refactor if maintainers want durable storage, live sends, or pane-local recovery to remain independently owned rather than merged at the projection boundary.

Technical review

Best possible solution:

Adopt one tab- and Gateway-scoped outbox owner if the Control UI owner agrees that durable rows, live sends, and pane-local recovery state belong in that single projection boundary, then merge only after the exact merge head retains the demonstrated route-switch and split-pane behavior.

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

Yes. The branch contains focused source-level route-switch, split-pane, volatile-storage, and browser storage-event cases that exercise the reported stale-projection ordering paths; this read-only review did not execute them locally.

Is this the best way to solve the issue?

Yes, conditionally. Centralizing the projection removes the parallel caches and manual publication paths at the ownership boundary, but Control UI owner approval is still needed for the chosen long-term lifecycle semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0d8b70f39e44.

Labels

Label justifications:

  • P2: This is a substantial but bounded Control UI state refactor with strong proof and no confirmed user-facing regression.
  • merge-risk: 🚨 session-state: The branch changes how durable, in-flight, and pane-local queued messages are reconciled across route changes and split panes.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies after-fix browser ordering evidence using real tab sessionStorage and storage events, plus hosted UI E2E and focused Control UI test results on the current head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix browser ordering evidence using real tab sessionStorage and storage events, plus hosted UI E2E and focused Control UI test results on the current head.

Evidence

What I checked:

  • Canonical projection owner: The new owner keeps per-host local rows, durable visibility, retry provenance, and per-scope live overlays, then projects one sorted queue for each subscribed pane. (ui/src/pages/chat/chat-outbox-owner.ts:31, b104a338911a)
  • Lifecycle and route callers: The existing chat state controller subscribes each page state to the outbox projection, while the branch routes save/restore through the centralized read/write projection API instead of the removed scoped cache. (ui/src/pages/chat/chat-state-controller.ts:96, c86493e8d90a)
  • Focused regression coverage: The branch changes chat-send coverage for volatile/durable ordering, route switches, split-pane projection, stale-pane deletion protection, and storage-event navigation; its browser E2E test now writes the canonical session-storage row and dispatches the real storage event. (ui/src/pages/chat/chat-send.test.ts:5143, b104a338911a)
  • Current-main drift check: Current main has advanced after the PR base, but the intervening UI changes are in Appearance and realtime-talk files rather than this outbox projection surface; GitHub reports the PR cleanly mergeable but behind base. (0d8b70f39e44)
  • Feature-history provenance: The current outbox queue implementation appears to be maintained in Peter Steinberger's recent Control UI work; the PR commit is also authored by Peter Steinberger and replaces that same queue owner boundary. (ui/src/pages/chat/chat-queue.ts:1, c86493e8d90a)

Likely related people:

  • steipete: Current-main history and blame for the pre-refactor outbox queue surface identify Peter Steinberger, and the branch's central projection-owner commit is authored by the same contributor. (role: recent area contributor and proposed owner-boundary author; confidence: high; commits: c86493e8d90a, b104a338911a; files: ui/src/pages/chat/chat-queue.ts, ui/src/pages/chat/chat-outbox-owner.ts, ui/src/pages/chat/chat-state-route.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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-01T07:47:00.405Z sha f5f9ff2a1a56ac89157415344b3fcc438f6550b6 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T08:09:31.050Z sha c296c4614097dd5af97a5086ec1e0d8bff212d77 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T08:20:56.408Z sha c296c4614097dd5af97a5086ec1e0d8bff212d77 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T09:06:17.842Z sha b104a33 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/prod-wave-ui-outbox-052208-2d45 branch from f5f9ff2 to c296c46 Compare August 1, 2026 07:59
@steipete
steipete force-pushed the codex/prod-wave-ui-outbox-052208-2d45 branch from c296c46 to b104a33 Compare August 1, 2026 08:59
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@steipete
steipete merged commit 66ff7b6 into main Aug 1, 2026
114 of 116 checks passed
@steipete
steipete deleted the codex/prod-wave-ui-outbox-052208-2d45 branch August 1, 2026 09:16
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to Alix-007/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
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 merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL 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