Skip to content

refactor(ui): unify chat outbox delivery - #117387

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-ui-delivery-owner-0801-2d45
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-ui-delivery-owner-0801-2d45

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

Control UI chat submission, durable admission, FIFO draining, transport, acknowledgement handling, retry, and composer recovery had overlapping owners. Those split responsibilities allowed picker updates, active-run follow-ups, reconnect drains, and durable-storage failures to observe different state and produce inconsistent outcomes.

The architectural owner is now explicit:

  • chat-send-submit.ts captures the immutable draft, attachments, submitted route, reply target, and pending settings operation.
  • chat-outbox-drain.ts owns serialized outbox draining and reconciliation order.
  • chat-send-delivery.ts owns delivery admission, busy/route parking, transport, acknowledgements, and retry outcomes.
  • chat-send-composer.ts owns composer restoration and cancellation.

The obsolete parallel implementations in chat-send-queued.ts and chat-send.ts are removed.

Correctness repairs included

The consolidation also fixes inconsistencies found while proving the owner boundary:

  • picker cancellation no longer looks like a successful send;
  • failed delayed sends do not overwrite or combine with a newer attachment-only draft;
  • busy/route parking and acknowledged-row retirement surface durable-storage failures;
  • picker-delayed sends wake correctly after reconnect and cannot bypass overlapping picker updates;
  • late picker-barrier persistence failure cannot leave a drainable unsent row;
  • waiting-model serialization remains fail-closed;
  • local commands are not gated by unrelated model-picker work;
  • active-run steer/follow-up admission is not delayed behind older history reconciliation;
  • reply targets and recovery state remain owned by the submitted turn.

No config, locale, schema, protocol, dependency, or public plugin surface changes.

Line-count impact

Against base e7950d968b873a87e899d61b41b7e553aaaffecd:

  • Production: 987 additions, 1,190 deletions — net -203 LOC.
  • Tests: 401 additions, 2 deletions — net +399 LOC.
  • Total: 1,388 additions, 1,192 deletions — net +196 LOC.

The test growth is nine distinct ordering/storage/recovery regressions. They intentionally remain explicit rather than being packed behind timing-sensitive parameterization.

Latest-main merge proof

Exact candidate: 65728052fc95d314d8849ba859af52b6652e3d34
Latest reviewed main: 71b35c3e1db158b21983fde1e456dd6f0b6b3797

git merge-tree --write-tree 71b35c3e1db158b21983fde1e456dd6f0b6b3797 65728052fc95d314d8849ba859af52b6652e3d34 completed without conflicts and produced tree 7153d64d2319fe932e66351fbce2e39db0412e2f. Relative to latest main, that merge result changes exactly the same eight UI chat files with the same numstat above. No intervening main commit touched ui/src/pages/chat/**; git diff --check on the merge result is clean.

This addresses ClawSweeper's rank-up move to review the actual current-main merge result without adding behind-main rebase churn.

Exact-head evidence

  • Focused unit proof: node scripts/run-vitest.mjs ui/src/pages/chat/chat-send.test.ts ui/src/pages/chat/chat-send-submit.test.ts ui/src/pages/chat/chat-state.test.ts — 336/336 passed.
  • Targeted lint: node scripts/run-oxlint.mjs over the changed production owner files — passed.
  • Full changed-surface gate and packaged build: Blacksmith Testbox tbx_01kyz8sf5f7hpyaavb784cmdzt, pnpm check:changed && pnpm build — passed in 22m40s. Runner record.
  • Mocked-Gateway Chromium: messaging 16, navigation/presentation 12, history/recovery 6, pending handoff 2 — 36/36 passed on the exact candidate.
  • Real built Gateway + Chromium: the browser loaded the Gateway-served Control UI, entered prove real Gateway browser delivery, clicked Send, the deterministic mock OpenAI request log contained that prompt, and the UI rendered OPENCLAW_E2E_OK. Screenshot captured at .artifacts/control-ui-e2e/real-gateway-chat/real-gateway-chat.png (validation artifact, not committed).
  • Fifth independent xhigh autoreview on the exact candidate: no P0-P2 findings, overall-correct confidence 0.83.
  • git diff --check — passed.

Real-Gateway verdict:

{
  "verdict": "pass",
  "candidate": "65728052fc95d314d8849ba859af52b6652e3d34",
  "gateway": "real built child process",
  "provider": "deterministic mock-openai",
  "browser": "Chromium",
  "promptReachedProvider": true,
  "finalReplyVisible": "OPENCLAW_E2E_OK",
  "browserPageErrors": [],
  "testbox": "tbx_01kyz8sf5f7hpyaavb784cmdzt"
}

AI-assisted: yes. The state machine, owner boundaries, main merge result, failure modes, and validation evidence were reviewed directly.

@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 11:50
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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, 3:08 PM ET / 19:08 UTC.

ClawSweeper review

What this changes

This PR centralizes Control UI chat submission, durable outbox draining, Gateway delivery, acknowledgement/retry handling, and composer recovery in dedicated owner modules, replacing the previous parallel send helpers.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR is still necessary: current main retains the split chat-send-queued.ts/chat-send.ts delivery path, while the PR introduces the consolidated delivery owner and removes those parallel modules. I found no discrete correctness defect in the proposed ownership flow; exact-head browser/Gateway proof and focused regression coverage are strong. The maintainer protected label means the remaining decision is a human merge-risk review of this broad message-delivery and session-state refactor.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The PR has strong exact-head real behavior proof and focused regression coverage, with the remaining gate being maintainer acceptance of its broad state-machine boundary.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides exact-head built-Gateway plus Chromium evidence: the submitted prompt reached the deterministic provider and the Control UI rendered OPENCLAW_E2E_OK; it also records focused tests and mocked-Gateway browser coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides exact-head built-Gateway plus Chromium evidence: the submitted prompt reached the deterministic provider and the Control UI rendered OPENCLAW_E2E_OK; it also records focused tests and mocked-Gateway browser coverage.
Evidence reviewed 7 items Current main still uses the pre-refactor delivery split: Current main exports sendQueuedChatMessage and sendChatMessageNow through chat-send.ts, with the delivery implementation still in chat-send-queued.ts; the PR's new chat-send-delivery.ts is therefore not already implemented on main.
Delivery owner preserves the intended state gates: The candidate waits for pending picker work, publishes a durable barrier, parks work for route/busy state, and performs the Gateway request only after admission; this is the central owner boundary claimed by the PR.
Acknowledgement and recovery behavior is handled in the same owner: The candidate records terminal failures, updates the visible session projection, restores the composer where appropriate, and retires acknowledged durable rows with an explicit persistence-failure check.
Findings None None.
Security None None.

How this fits together

The Control UI captures a chat draft, persists or queues it, sends it through the Gateway, and reconciles acknowledgements, retries, transcript state, and composer recovery. The changed subsystem owns the transitions between those steps so reconnects, picker updates, and active runs cannot race into conflicting visible state.

flowchart LR
  Draft[Composer draft and attachments] --> Submit[Submit owner]
  Submit --> Outbox[Durable or memory outbox]
  Outbox --> Drain[Serialized outbox drain]
  Drain --> Delivery[Gateway delivery owner]
  Delivery --> Result[Acknowledgement, retry, or failure]
  Result --> Recovery[Transcript and composer recovery]
Loading

Decision needed

Question Recommendation
Does a maintainer accept consolidating the Control UI’s existing delivery, retry, durable-outbox, and composer-recovery behavior behind this single owner on the reviewed clean merge head? Merge the consolidated owner: Accept the reviewed exact-head delivery and recovery invariants, using the submitted built-Gateway browser proof and focused regressions as the merge evidence.

Why: The patch is a broad user-visible state-machine consolidation with intentional message-delivery and session-state risk; source and proof support the implementation, but accepting that behavioral boundary is a maintainer merge decision.

Before merge

  • Resolve merge risk (P1) - This changes the durable outbox and visible recovery state for retries, reconnects, picker updates, and active runs; a maintainer should accept that behavioral consolidation after reviewing the exact merge head rather than treating green unit coverage as the sole gate.
Agent review details

Security

None.

PR surface

Source -203, Tests +399. Total +196 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 7 987 1190 -203
Tests 1 401 2 +399
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 1388 1192 +196

Review metrics

None.

Stored data model

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

Merge-risk options

Maintainer options:

  1. Merge with the reviewed state-machine risk (recommended)
    Accept the cleanly mergeable exact head after maintainer review of its durable outbox, acknowledgement, retry, reconnect, and composer-recovery invariants.
  2. Pause for a narrower rollout
    Keep the PR open if maintainers want to split the delivery-owner consolidation before accepting its cross-cutting behavioral change.

Technical review

Best possible solution:

Land the single canonical delivery owner only after a maintainer accepts the exact-head merge result and its message-delivery/session-state behavior; do not preserve the removed parallel send wrappers.

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

Not applicable as a standalone issue: this PR contains a refactor plus regression repairs, and its exact-head proof exercises the relevant Control UI send-to-Gateway-to-visible-reply path.

Is this the best way to solve the issue?

Yes. Consolidating admission, delivery, acknowledgement, retry, and recovery under one owner is a more maintainable solution than retaining the current parallel queued-send wrappers, and the candidate removes those old paths rather than adding another fallback layer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 71b35c3e1db1.

Labels

Label justifications:

  • P2: The refactor affects a bounded but user-visible Control UI chat workflow, with no demonstrated emergency regression.
  • merge-risk: 🚨 message-delivery: The patch changes admission, transport, acknowledgement, retry, and durable retirement for queued chat turns.
  • merge-risk: 🚨 session-state: The patch changes durable outbox reconciliation, route parking, visible projections, and composer restoration across session changes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head built-Gateway plus Chromium evidence: the submitted prompt reached the deterministic provider and the Control UI rendered OPENCLAW_E2E_OK; it also records focused tests and mocked-Gateway browser coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head built-Gateway plus Chromium evidence: the submitted prompt reached the deterministic provider and the Control UI rendered OPENCLAW_E2E_OK; it also records focused tests and mocked-Gateway browser coverage.

Evidence

What I checked:

  • Current main still uses the pre-refactor delivery split: Current main exports sendQueuedChatMessage and sendChatMessageNow through chat-send.ts, with the delivery implementation still in chat-send-queued.ts; the PR's new chat-send-delivery.ts is therefore not already implemented on main. (ui/src/pages/chat/chat-send.ts:1, 71b35c3e1db1)
  • Delivery owner preserves the intended state gates: The candidate waits for pending picker work, publishes a durable barrier, parks work for route/busy state, and performs the Gateway request only after admission; this is the central owner boundary claimed by the PR. (ui/src/pages/chat/chat-send-delivery.ts:80, 65728052fc95)
  • Acknowledgement and recovery behavior is handled in the same owner: The candidate records terminal failures, updates the visible session projection, restores the composer where appropriate, and retires acknowledged durable rows with an explicit persistence-failure check. (ui/src/pages/chat/chat-send-delivery.ts:344, 65728052fc95)
  • Composer restoration avoids combining a prior send with a newer attachment-only draft: The candidate's strict restore plan requires a completely blank composer before restoring either captured draft text or attachments, then releases no-longer-owned attachment payloads. (ui/src/pages/chat/chat-send-composer.ts:158, 65728052fc95)
  • Focused regression coverage accompanies the state-machine change: The candidate adds 401 test lines to the existing chat-send suite, and the PR records exact-head focused tests, Chromium mocked-Gateway coverage, and a built Gateway plus Chromium run that reaches the provider and renders OPENCLAW_E2E_OK. (ui/src/pages/chat/chat-send.test.ts:1818, 65728052fc95)
  • Feature-history provenance: The currently shipped send path appears to originate with Peter Steinberger's aa2a5c96, while Shakker recently maintained the adjacent command-recovery and composer ownership paths in aeabd484, e1b639947, c0be827f, and 8137f971. (ui/src/pages/chat/chat-send-composer.ts:153, 8137f9712226)

Likely related people:

  • Peter Steinberger: Current-main history attributes the central queued-send, submit, outbox, composer, and actions surfaces to this prior feature change; the PR is also authored by the corresponding GitHub account. (role: feature-history contributor; confidence: high; commits: aa2a5c96f69a; files: ui/src/pages/chat/chat-send-queued.ts, ui/src/pages/chat/chat-send-submit.ts, ui/src/pages/chat/chat-outbox-drain.ts)
  • Shakker: Recent main commits changed the command-recovery and composer ownership invariants that this refactor preserves and reorganizes. (role: recent adjacent contributor; confidence: high; commits: aeabd4841490, e1b639947d01, c0be827ff2ad; files: ui/src/pages/chat/chat-send-submit.ts, ui/src/pages/chat/chat-send-composer.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain the protected-label maintainer decision on the exact clean merge head.

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 (3 earlier review cycles)
  • reviewed 2026-08-01T11:55:55.124Z sha 9bb75f2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T12:36:07.673Z sha 9bb75f2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T14:15:44.612Z sha 9bb75f2 :: needs maintainer review before merge. :: none

@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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@steipete
steipete force-pushed the codex/goal100k-ui-delivery-owner-0801-2d45 branch from 9bb75f2 to 6572805 Compare August 1, 2026 19:01
@steipete
steipete merged commit 6c9cb8e into main Aug 1, 2026
103 checks passed
@steipete
steipete deleted the codex/goal100k-ui-delivery-owner-0801-2d45 branch August 1, 2026 20:21
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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: 🐚 platinum hermit Good normal PR readiness with ordinary 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