Repository navigation
feat(ui): show optional-answer delivery and retry state - #154486
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 changes before merge. Reviewed September 21, 2026, 4:13 PM ET / 20:13 UTC (Revision 7). ClawSweeper reviewWhat this changesThe Control UI shows optional-answer delivery status, retries the existing queued answer, and preserves answer recovery through reconnect, Discard, and reload, with documentation and supporting test repairs. Merge readiness⛔ Needs changes before merge - 1 item remains This PR remains useful: current main lacks its question-to-outbox delivery association, and the merged recovery work does not supersede it. No actionable introduced correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherOptional questions appear in the chat composer, and submitted answers enter the existing message outbox. Question summaries now follow that outbox’s delivery state and use saved conversation history to confirm successful delivery. flowchart TD
A[Optional question] --> B[Answer draft]
B --> C[Existing message outbox]
C --> D[Gateway delivery]
C --> E[Delivery status and Retry]
C --> F[Explicit Discard]
F --> B
D --> G[Saved conversation history]
G --> H[Confirmed answer summary]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +195, Tests +679, Docs +11. Total +885 across 30 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep delivery and retry outbox-owned, draft recovery presentation-owned, and successful-answer confirmation derived from canonical conversation history. Do we have a high-confidence way to reproduce the issue? Yes, source and recorded browser evidence establish the reconnect path: an admitted answer loses its question association on main and can expose another Submit form. This read-only review did not execute the application. Is this the best way to solve the issue? Yes. Extending the existing outbox projection avoids a competing sender, while canonical reply identity handles ambiguous saved text and legacy rows retain their existing retry path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3d4033fbe0ac. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
4f2039b to
d5cff7e
Compare
|
Coordination note: #154312 (saved-answer reconstruction), #154473 (unfinished optional-question draft recovery), and #154692 (reversible persistent dismissal) are now merged. This PR remains necessary and open: it uniquely projects the existing outbox row as optional-answer delivery state, retries that same row without duplicating an answer, and handles successful explicit Discard recovery across panes. |
Integrate current main while preserving the original delivery-state implementation, durable drafts, dismissal, Undo, and scoped presentation owners. Prove reconnect retains one admitted outbox row and explicit retry preserves its idempotency identity. Co-authored-by: Vincent Koc <[email protected]>
Replace arbitrary polling deadlines with the real two-phase response and retain requested-broadcast and persisted-identity assertions. Drain fixture requests and worker-backed SQLite before deleting their state.
|
Additional integration proof: explicit Discard after later work completes. The existing browser scenario submits the untouched default answer, receives a definite delivery rejection, reloads, observes a later successful completion, and clicks Discard. Before the repair, the question immediately becomes “No longer pending” instead of reopening. The candidate records the current completion boundary using the existing presentation state, restoring the default answer without disabling later reminder aging. The same scenario passes after repair, including another reload; all 19 optional-answer browser scenarios pass (45.625s command wall). These inspected captures contain only synthetic mock-Gateway data. The integration candidate is under final review before publication; this is browser boundary proof, not live-provider proof. |
|
Additional draft-recovery regression found during final review: a valid free-text answer can contain the exact quoted heading of the following question. The parser intentionally rejects that ambiguous boundary. The queued projection used to replace the preserved draft with an empty map, and submitted status blocked hydration after reload. The same maintained mock-Gateway browser flow submits both answers, rejects delivery, reloads, clicks the actual Discard button, and advances to the second question. Before the fix, the first input is empty even though the outbox retains both complete answers. After the fix, both inputs survive and no new send is admitted. The projection now retains known answers when parsing fails; hydration restores stored answers while preserving live outbox admission and newer user intent. Identical diagnostic: failing command 22.329s; passing command 14.399s (2.980s case). The temporary diagnostic was removed after proof, preserving existing browser coverage; two cheap owner regressions cover mounted and reloaded drafts. All 79 presentation/draft cases pass. These are synthetic browser boundary captures, not real-provider evidence. Both full captures were inspected and delivered in chat. The related blank-summary defect is also repaired: ambiguous queued answers display the actual queued message verbatim with existing wrapping styles. This avoids substituting a preserved draft that may differ from text edited in the outbox. The same owner regressions cover both original and edited queued payloads. Identical browser summary diagnostic: RED 17.906s, GREEN 14.953s (3.101s case), followed by successful reload and Discard recovery. The additional inspected synthetic captures below show the blank summary before and the complete queued payload afterward. The successful-delivery path had a separate confirmation defect: the same conservative parser also rejected the saved answer after Retry succeeded. Reload therefore reopened the question despite one canonical saved user message and an empty outbox. The fix uses the existing canonical reply ID to identify the question and displays the exact saved text when splitting it would be ambiguous. Unlinked ambiguous replies remain unresolved; there is no new durable field or write owner. The unchanged registered browser diagnostic submits both answers, rejects the first send, clicks Retry, lets the maintained mock perform its normal canonical commit, verifies the original text and reply ID, and reloads. Before: the form reopens. After: the form stays closed, the exact answer is marked sent, the outbox stays empty, and no additional message is sent. RED 27.985s command wall; GREEN 16.250s (3.633s case). All 82 related owner/rendered cases pass. The synthetic before/after captures below were inspected in full and delivered in chat. |
Keep main's rail resize and permission projection owners, retiring the mock clock workaround that broke archive attribution and appearance refreshes. Preserve optional-answer drafts through explicit discard after later work completes and through ambiguous quoted text across reload. Show the actual queued payload when answer boundaries cannot be parsed safely. Retain the reviewed relay and approval fixture repairs, contributor ancestry, and focused browser and draft regression coverage. Co-authored-by: Vincent Koc <[email protected]>
Use the existing saved reply association when quoted headings or outbox edits prevent splitting an answer. Render the actual saved text and retain strict matching for unlinked legacy replies. Preserve reload and discard recovery, and adopt main’s shared approval fixture without a duplicate owner. Co-authored-by: Vincent Koc <[email protected]>
|
Merged via squash auto-merge.
|
) * feat(ui): show optional-answer delivery and retry state * fix(ui): retain intermediate composer resize for the rail Record committed textarea viewport changes through the existing transcript observation channel before Goal chrome can reverse them. Preserve the reader rail position while leaving focus/navigation and progress disclosure ownership intact. * test(gateway): await approval acknowledgement and worker cleanup Replace arbitrary polling deadlines with the real two-phase response and retain requested-broadcast and persisted-identity assertions. Drain fixture requests and worker-backed SQLite before deleting their state. * test(gateway): retain approval fixture initialization errors * test(ui): advance mock session clocks after patches * test(cli): control gateway relay deadline progression * test(cli): isolate preaction fixtures from installed gateways --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
The original live-region split moved the question/answer text into a text-only region but left deliveryLabel and sendError outside it, so a queued answer that changed from sending to failed no longer announced "Answer not sent" or its error - a regression against the delivery feedback PR openclaw#154486 explicitly preserved. The plain wrapper also collapsed every question into a single grid item, dropping the row gap between multiple questions. Move delivery text (label + error) into a nested live region while leaving the Retry button outside it, and give the announcement wrapper the grid participation the questions had so the row gap is preserved. Red on the previous head (2 failed): expected 'Everyone' to contain 'Answer not sent' <- delivery outside region expected undefined to be truthy Green on this head (2 passed): the delivery status and error are announced and Retry stays out of the region.








Related: #154395
Continues Vincent (@vincentkoc)'s delivery-state implementation and preserves its commit ancestry. Saved-answer recovery from #154312, contributed by @jb510, is already on main.
What Problem This Solves
Fixes optional questions appearing answered after delivery fails, reopening a second Submit form after reconnect, or losing their answer after recovery when free text resembles another question's heading.
User Impact
Questions show queued, sending, failed, uncertain, and confirmed delivery, with accessible status announcements. Retry uses the existing outbox answer; successful explicit Discard restores its draft in subscribed panes. Ambiguous free text remains visible in queued and saved summaries and survives reload/Discard. Draft persistence, dismissal, Undo, and authentication-scope retirement remain intact.
Browser-storage failure still falls back to volatile state that is not reload-durable. Two unexplained browser timeouts remain recorded below; neither is claimed fixed.
Why This Change Was Made
The existing outbox owns delivery and retry. A question retains its association with that row across reconnect, preventing a second admission. Uncertain retry preserves the original transport identity; definite rejection uses the existing queue retry policy. Only canonical saved history confirms Answer sent—an acknowledgement retiring the outbox row is insufficient.
Successful explicit Discard records the existing completion/reopen boundary before notifying subscribed panes, so the restored answer does not immediately age out. Failed removal and automatic retirement do not reopen the form. When conservative parsing cannot separate an answer containing another question's heading, the draft owner preserves known answers and hydrates stored drafts without replacing newer edits or current admission. Summaries show the actual queued or saved text. A matching canonical
replyToIdconfirms a saved answer independently of parsing; unlinked ambiguous text remains unresolved.The final scope is 32 files against main
ff26aaefcd6780f5d2781539d7b2888bff2ef608: question delivery/recovery and documentation, focused tests, distinct rail test coverage, three CLI fixture repairs, and two approval clock test files. There is no new sender, queue, storage owner, schema, or Gateway protocol. Legacy rows without a question association retain existing retry behavior. Main's split presentation/draft owners remain in place.Main owns the overlapping production repairs: synchronous rail resize observation (41cd52e170f) and equal-clock permission projection (78a45d69). The alternate rail implementation and mock-clock workaround are retired. Main's shared approval publication/SQLite fixture repair (dbb402500e42) is adopted byte-for-byte; the final head has no net changes to that approval fixture. The separate clock-test repair below preserves both transaction-time and public-worker coverage without production changes.
Evidence
Current head:
e9c8dedc393cea35ccbaece12b5f59877e65cc5e, committed and pushed with the merged #155111 owner repair. Local proof and required selected checks pass. Full review v8 plus a fresh clean review of the final public-clock regression resolve the only accepted P2; no actionable findings remain. Ready for PR preparation; new exact-head hosted CI is pending, not claimed green. The priorefa7f8b633bbhead passed all local checks in 1,337.384s and had a clean ClawSweeper review, but its hosted CI failed seven approval tests while all 13 UI browser shards passed. The repair and original-order proof are recorded below.The registered reconnect flow reproduced duplicate admission on main: the original unconfirmed row remained while a second Submit created another queue/send identity. This proves duplicate admission, not duplicate server delivery. The integrated flow retains one row and no second form; uncertain Retry preserves the original queue ID, payload, and idempotency key. Initial focused proof passed 226 tests across 11 files, including all 19 maintained mock-Gateway browser scenarios.
Later review-driven regressions establish the final recovery behavior:
Temporary browser diagnostics were removed after proof. The existing IndexedDB assertion moved to a sibling support module without another test file or browser startup; its storage/reconnect scenario passed in 13.565s.
Live QA below used the
efa7f8b633bbbuild serving the task Gateway, with the browser build identity and all eight entry assets verified. Real native optional-question QA passed: two optional questions remained after the model ended its turn; a multiline answer containing a quoted heading and Unicode, plus the Detailed choice, survived reload. Submit created one user answer, displayed Answer sent, and the real model echoed the exact payload. A final reload preserved the read-only sent summary with no answer form. The rollout confirms one native question call and one user answer. Earlier tested model sessions lacked that native tool in their pinned model catalog; an already supported model completed this proof without configuration or runtime changes.Additional shared-browser live QA passed file Save, stale-content conflict rejection and Reload, terminal execution with exit 0, reply context, session/file creation, and fork transcript inheritance with child-only output absent from the parent. These published-head observations supersede the earlier older-Gateway limitation; they remain proof for the unchanged UI paths, not a claim that the newly published head has been activated live. The automated browser regressions above remain maintained mock-Gateway evidence. Live follow-ups also passed optional-answer delivery while busy, controlled offline Submit/reload with exactly one full-text answer, and Dismiss/Undo/reload with the selection retained and zero sends. Attachment upload could not be exercised: the browser tool refused both artifact and workspace paths. That is a tool limitation, not an established product failure.
Visual proof
All captures are inspected synthetic fixtures, delivered in the originating chat and verified rendered on GitHub. The linked comments retain the additional before/after pairs:
Before reconnect: the original unconfirmed answer coexists with an enabled Submit form. After: the question reports unconfirmed delivery and offers Retry without admitting another answer.
Measured costs, retained CI repairs, and integration proof
Changed-file measurements use
pnpm test <file> --maxWorkers=1whole-command wall time. Earlier integration measurements ran on a loaded host; values below do not imply a speedup or final-head CI completion.chat-async-questions.e2e.test.tschat-question-actions.test.tschat-async-question.test.tschat-async-question-draft.test.tschat-view.async-questions.test.tschat-view.plugin-questions.test.tschat-composer.test.tsnative-hook-relay-cli.test.tspreaction-agent-owner.test.tspreaction-output-mode.test.tsoperator-approval-store.test.tsoperator-approval-store.worker.test.tsThe 23 integrated rail unit cases took 8.882s command wall. The 31 delivery/rail/progress browser cases passed in 138.410s; all 19 selected checks for the distinct rail test coverage passed in 231.671s. The original equal-clock permission fixture passes 33 units in 3.172s and both browser cases in 13.947s. A controlled metadata-before-ACK/failed-refresh flow passes in 12.692s. Removing only the retired clock workaround changes the unchanged archive/color cases from RED (42.142s) to GREEN (12.439s), without changing scripted timestamps, assertions, deadlines, or retries. Prior workaround passes are not proof of the final projection repair.
The retained relay fixture now waits for actual Gateway entry before advancing fake time across the unchanged 25ms deadline, checking abort and output while surfacing early termination. Two preaction parser suites gain the same installed-Gateway guard mock as their main sibling; production guard refusal and inspection/state-path behavior remain covered. The original nine isolation failures reproduced with normal host routing; 97 affected and guard-sibling cases then passed. The combined original 386-file/eight-worker CLI group passed 8,835 tests with 91 existing skips in 506.003s, and all 21 combined selected checks passed in 176.277s. No retries or enlarged timeouts were added.
Historical hosted costs: CI 35623533860 passed all 13 UI browser shards; the async-question file took 67.417s, including 3.184s for reconnect. At head
1b2145e7830dfadd2a45dd1842d90981545fbf44, the original 53-file/236-test browser shard passed, with the eight rail cases taking 80.357s file time and the repaired 80-message case 25.360s. Hosted head99b82ae6passed the retained relay and two preaction files with summed case times, not file wall times, of 0.285s, 0.177s, and 0.092s. That head's aggregate CI failed archive/color. The subsequentefa7f8b633bbrun passed all UI shards but failed approval cases. Final-head replacement CI is pending.Main also supplies the directive-delivery assertion repair 087ccde18c30, which preserves exact rendered code after balanced-fence delivery replaced raw indentation. Its exact 78-case failing file passed on CI-pinned Bun in 23.936s. The earlier main-owned approval fixture passed all five then-existing cases in 24.235s command wall, with 1.476s summed case time and both real SQLite contracts intact. The current six-case fixture measurement appears below; superseded PR-only proof is retained as history.
Approval CI repair
The failed baseline replay used the original 147-path order and a source tree equivalent to the hosted merge: 447.485s, with two approval-publication readiness failures, a separate SQLite clock assertion, and two observer-close unhandled errors. It corroborated the race without reproducing every hosted failure.
The integrated #155111 owner repair plus clock-test patch passes all 3,352 tests with one existing skip across those same 147 files in 387.430s, with no unhandled errors. All seven hosted failure cases and the local failures pass. The owner's new six-case fixture suite also passes in 26.680s (24.38s Vitest). These are local v8 integration measurements, not hosted final-candidate costs or a speedup claim. No retries were used.
Review v8 found that the clock-test rewrite lost coverage through the public default-clock path. A 14-line worker-sibling regression restores it: the early-clock negative control fails in 16.916s, while all four worker cases pass in 18.862s, including 442ms for the new case. The other 31 bound files remain unchanged. All 21 selected gates pass across the initial and corrective runs (246.823s total, including a formatting correction); this is a composite result, not one uninterrupted aggregate pass. Fresh scoped review found no actionable P0–P2 findings and resolves v8's only accepted finding. All owned processes joined. The final source binding covers the committed 32-file head; replacement hosted CI remains pending.
Remaining browser investigation gaps
A final hydration-file run passed 18/19 cases but stalled in the existing 430px light viewport case after Collapse: 167.913s command wall, 120.523s affected case. The first Playwright
toBeInViewportevaluation awaited its IntersectionObserver until the outer 120s test timeout closed the page before capture. Inspection of Playwright 1.63's uncancelled progress path explains why the matcher deadline did not stop that evaluation, but not why the observer failed to settle. One original-order observational replay passed all 19 in 51.477s; the case took 1.121s and its collapsed-panel assertion 11ms. This is non-reproduction, not a fix. Diagnostic edits were removed; no timeout, retry, assertion, or dependency change was made. A safe product/fixture root cause remains unestablished.Separately, historical CI 35585195106 timed out after 120.006s in the dark mobile-gutter notice case at 390/430px; 202/203 shard tests passed and the light counterpart passed. The log does not identify the stalled operation. Main's later matrix reduction in #154463 preserved 112 cells while reducing browser contexts from 56 to 28; it is lifecycle cleanup, not proof of this timeout's cause. Neither a later pass nor the replacement CI is claimed to explain that historical failure.
These unexplained browser failures remain disclosed under the repository's best-effort investigation policy; they do not create an additional landing gate.
Final hosted validation: CI 35650691661 passed on the landed head, followed by successful security review. The repaired approval clock case took 0.819s in CI, and the new public-worker default-clock regression took 0.960s. The owning Gateway-server group passed 3,359 cases plus one existing skip in 433.58s wrapper wall across 148 files; the larger 17m42s job contains 11 sequential groups, so that job wall is not the cost of the clock regression.