Repository navigation
refactor(ui): unify chat outbox delivery - #117387
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:08 PM ET / 19:08 UTC. ClawSweeper reviewWhat this changesThis 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 readinessThis PR is still necessary: current Priority: P2 Review scores
Verification
How this fits togetherThe 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]
Decision needed
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
Agent review detailsSecurityNone. PR surfaceSource -203, Tests +399. Total +196 across 8 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat 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) |
9bb75f2 to
6572805
Compare
|
Merged via squash.
|
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.tscaptures the immutable draft, attachments, submitted route, reply target, and pending settings operation.chat-outbox-drain.tsowns serialized outbox draining and reconciliation order.chat-send-delivery.tsowns delivery admission, busy/route parking, transport, acknowledgements, and retry outcomes.chat-send-composer.tsowns composer restoration and cancellation.The obsolete parallel implementations in
chat-send-queued.tsandchat-send.tsare removed.Correctness repairs included
The consolidation also fixes inconsistencies found while proving the owner boundary:
No config, locale, schema, protocol, dependency, or public plugin surface changes.
Line-count impact
Against base
e7950d968b873a87e899d61b41b7e553aaaffecd: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:
65728052fc95d314d8849ba859af52b6652e3d34Latest reviewed
main:71b35c3e1db158b21983fde1e456dd6f0b6b3797git merge-tree --write-tree 71b35c3e1db158b21983fde1e456dd6f0b6b3797 65728052fc95d314d8849ba859af52b6652e3d34completed without conflicts and produced tree7153d64d2319fe932e66351fbce2e39db0412e2f. Relative to latestmain, that merge result changes exactly the same eight UI chat files with the same numstat above. No intervening main commit touchedui/src/pages/chat/**;git diff --checkon 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
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.node scripts/run-oxlint.mjsover the changed production owner files — passed.tbx_01kyz8sf5f7hpyaavb784cmdzt,pnpm check:changed && pnpm build— passed in 22m40s. Runner record.prove real Gateway browser delivery, clicked Send, the deterministic mock OpenAI request log contained that prompt, and the UI renderedOPENCLAW_E2E_OK. Screenshot captured at.artifacts/control-ui-e2e/real-gateway-chat/real-gateway-chat.png(validation artifact, not committed).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.