feat(agent-composer): render sent messages immediately and cancel queued ones - #5589
Conversation
…ued ones Optimistic user rows render before the transport echoes them, with a per-item cancel control for queued messages. Send failure restores the draft only into an empty composer, and cancel keeps a Restore row when the composer is occupied.
Restored cancel/restore file chips were re-sent under the rotated current path, not the message UUID that holds their R2 objects. restoreFileParts now points the upload path at the restored object's message UUID, and a success path rotation (commitSent) keeps the next message's UUIDs fresh without breaking failed-send restore.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental changes are i18n for queued-message controls plus a merged profile-row extract and queue-cancel idempotency; previously reported restore and paperclip issues are fixed or declined. Files Reviewed (90 files)
Previous Review Summaries (5 snapshots, latest commit b66e33f)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit b66e33f)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
Fix these issues in Kilo Cloud Previous review (commit 5ea9a1c)Status: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Previous review (commit e278f68)Status: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (17 files)
Fix these issues in Kilo Cloud Previous review (commit 012eaf9)Status: 6 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Previous review (commit 3948f93)Status: 6 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (22 files)
Reviewed by grok-4.6 · Input: 83.2K · Output: 14.8K · Cached: 648.3K Review guidance: REVIEW.md from base branch |
# Conflicts: # apps/mobile/src/lib/agent-attachments/use-agent-attachment-upload.test.ts
|
(bot) The latest summary repeats two resolved findings without new evidence. The queue restore fix inserts cloud-agent:// file references directly into storage in insertOptimisticUserMessage; it does not call stripPartContentIfFile. Accepted authoritative messages cannot be canceled. The paperclip timing suggestion remains a documented residual risk; restructuring the verified send flow costs more than this short race. Both dispositions remain unchanged. |
Summary
Maintainer changelog
The immutable level-4 change modifies 114 files: 14 source files, 13 test files, and 87 generated files.
Each file entry gives its class, status, and size from the supplied diff statistics.
Mmeans modified; size counts added plus removed lines, not the full file length.SessionManager.cancelQueuedMessage,CloudAgentSession.cancelQueuedMessage,Transport.dropQueuedMessage, andCloudAgentApi.cancelQueuedMessagenow returnPromise<{ dropped: boolean }>so callers can confirm removal.Mobile connects the existing
cloudAgentNext.cancelQueuedMessageandorganizations.cloudAgentNext.cancelQueuedMessagemutations; a remotedrop_queued_messageacknowledgment returns{ dropped: true }without callinginterrupt.The provider hook stays optional; implementations must return the result, absent sessions return
{ dropped: false }, and unsupported remotes retainCLI_UPGRADE_REQUIRED.Files
packages/cloud-agent-sdk/src/transport.ts— Source; M; 4 changed lines. Requires the typed cancellation result from transport and Cloud Agent providers.packages/cloud-agent-sdk/src/session.ts— Source; M; 2 changed lines. Exposes the cancellation result through the session interface.packages/cloud-agent-sdk/src/cli-live-transport.ts— Source; M; 9 changed lines. Converts a successful remote cancellation acknowledgment into{ dropped: true }.apps/mobile/src/components/agents/mobile-session-manager.ts— Source; M; 29 changed lines. Adds personal and organization cancellation adapters, diagnostics, upgrade classification, and restore-outcome selection.packages/cloud-agent-sdk/src/cli-live-transport.test.ts— Test; M; 4 changed lines. Updates remote cancellation assertions for the result contract.packages/cloud-agent-sdk/src/cloud-agent-transport.test.ts— Test; M; 4 changed lines. Updates Cloud Agent cancellation test support for the result contract.apps/mobile/src/components/agents/mobile-session-manager.test.ts— Test; M; 81 changed lines. Extends mobile cancellation adapter and restore-policy coverage.MessageBubbleProps.onCancelQueuedandonRestoreQueuedexpose queued-only cancellation and later restoration, with platform-sized controls and announced outcomes.CancelQueuedRestoreOutcomerestores the first non-ignored prompt and recoverable files into an empty composer; an occupied composer keeps a canceled row instead.A false
droppedresult preserves the row; explicit Restore replaces nonempty prompt text and appends recoverable files, while session changes reset cancellation state.Files
apps/mobile/src/components/agents/session-detail-content.tsx— Source; M; 160 changed lines. Handles confirmed cancellation, retained or hidden rows, attachment restoration, status announcements, and haptics; forwards optimistic-send options.apps/mobile/src/components/agents/message-bubble.tsx— Source; M; 87 changed lines. Adds Cancel and Restore buttons with accessible labels and minimum heights of 44 points on iOS and 48 density-independent pixels on Android.apps/mobile/src/components/agents/session-detail-content.test.ts— Test; M; 697 changed lines. Expands the session-screen regression suite for optimistic sending, cancellation, and restoration.apps/mobile/src/components/agents/message-bubble.test.ts— Test; M; 157 changed lines. Extends queue-control rendering and accessibility coverage.SessionManager.sendinserts the prompt and file placeholders before transport confirmation, then invokesonOptimisticSend; failed sends remove the local row.Cloud replies replace the same identifier; live remote
message.updatedevents match identifiers or remove the oldest outstanding placeholder for older command-line interface (CLI) senders.queue.changed, child-session events, and history replay cannot consume remote placeholders; session changes clear tracking, and cloud attachments retainCLOUD_AGENT_RESTORE_URL_PREFIXreferences.Files
packages/cloud-agent-sdk/src/session-manager.ts— Source; M; 173 changed lines. Adds optimistic text/files, identity reconciliation, replay guards, failure cleanup, and cancellation results; preserves cloud upload references.packages/cloud-agent-sdk/src/session-manager.test.ts— Test; M; 239 changed lines. Extends optimistic-message and cancellation regression coverage.ChatComposerProps.onSendnow acceptsChatComposerSendOptionsinstead of positional attachment arguments; hosts must invokeonOptimisticSendafter insertion to clear prompt drafts.ChatComposerSubmissionCleanupremovesresetAttachments; prompts no longer clear after confirmation, while commands and session controls retain acceptance-based cleanup.ChatComposerControl.hasContentandrestoreAttachmentssupport recovery; failed sends restore only into an empty composer, and successful sends preserve newer drafts.Files
apps/mobile/src/components/agents/chat-composer.tsx— Source; M; 63 changed lines. Adopts send options, clears text/chips and sending feedback on insertion, restores failed sends, and commits successful uploads.apps/mobile/src/components/agents/chat-composer-submission.ts— Source; M; 9 changed lines. Removes attachment-reset cleanup and leaves prompt clearing to the optimistic-send callback.apps/mobile/src/components/agents/chat-composer.test.ts— Test; M; 23 changed lines. Updates composer send and attachment-hook test support.apps/mobile/src/components/agents/chat-composer-attachment-send.test.ts— Test; M; 7 changed lines. Updates attachment-send test support for the composer contracts.apps/mobile/src/components/agents/chat-composer-exit-submit-lock.test.ts— Test; M; 5 changed lines. Updates exit and submission-lock test support for the shared composer dependencies.apps/mobile/src/components/agents/chat-composer-submission.test.ts— Test; M; 10 changed lines. Aligns submission cleanup expectations with caller-owned prompt clearing.apps/mobile/src/components/agents/use-new-session-creator.test.ts— Test; M; 4 changed lines. Updates new-session creation test support for the shared attachment hook.upsertPartDroppingStaleSyntheticPartsreplacesupsertPartDroppingStaleSyntheticTextPartsand removes same-messagesyntheticplaceholders when real text or file parts arrive.The
FilePart.syntheticmarker lets file placeholders use the same replacement rule as text.Both storage implementations adopt the renamed helper; real parts and placeholders of other types remain, so attachments reconcile without duplicates.
Files
packages/cloud-agent-sdk/src/storage/helpers.ts— Source; M; 14 changed lines. Renames the helper and extends same-type synthetic replacement from text to files.packages/cloud-agent-sdk/src/storage/jotai.ts— Source; M; 4 changed lines. Uses the renamed helper for reactive part storage.packages/cloud-agent-sdk/src/storage/memory.ts— Source; M; 4 changed lines. Uses the renamed helper for memory part storage.packages/cloud-agent-sdk/src/storage/helpers.test.ts— Test; M; 63 changed lines. Updates the helper name and extends synthetic-part replacement coverage.packages/app-shared/src/opencode.gen.ts— Generated; M; 2 changed lines, both additions. Updates the generated OpenCode types.UseAgentAttachmentUploadReturnaddsrestoreFileParts,clearOptimistic,restoreChips, andcommitSentto separate draft recovery from destructive resets.ResolvedRestoredAttachmentReferencerecovers original object identities from sandbox, optimistic, and signed cloud references for resends, excluding signed credentials from admission markers.clearOptimisticretains files and upload identities;commitSentrotates identities only after success, whilerestoreFilePartsskips parts with an emptyurl.Files
apps/mobile/src/lib/agent-attachments/use-agent-attachment-upload.ts— Source; M; 190 changed lines. Restores uploaded chips and original object references; retains cache files for recovery and eventual reaping.apps/mobile/src/lib/agent-attachments/use-agent-attachment-upload.test.ts— Test; M; 215 changed lines. Extends attachment restoration and optimistic-send lifecycle coverage.agentChat.sessionaddscancelQueuedRestored,cancelQueuedRestoreAvailable,cancelQueuedUpgradeRequired, andcancelQueuedFailedfor cancellation outcomes and upgrade guidance.agentChat.messageBubbleaddscancelQueued,cancelQueuedAccessibility,restoreQueued, andrestoreQueuedAccessibilityfor the controls and their spoken labels.The English catalog supplies eight source strings; 86 tool-merged translation assets add 688 values while retaining existing wording, key order, and plural forms.
Files
apps/mobile/src/i18n/locales/en.json— Source; M; 10 changed lines. Adds eight English cancellation, restoration, accessibility, and upgrade strings.apps/mobile/src/i18n/locales/af.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/am.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ar.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/az.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/be.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/bg.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/bn.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/bs.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ca.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ckb.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/cs.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/cy.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/da.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/de.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/el.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/es.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/et.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/eu.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/fa.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/fi.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/fil.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/fr.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ga.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/gl.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/gu.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ha.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/he.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/hi.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/hr.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ht.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/hu.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/hy.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/id.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ig.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/is.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/it.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ja.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ka.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/kk.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/km.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/kn.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ko.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/lo.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/lt.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/lv.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/mg.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/mi.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/mk.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ml.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/mn.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/mr.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ms.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/mt.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/my.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/nb.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ne.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/nl.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/om.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/or.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/pa.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/pl.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ps.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/pt-BR.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/pt.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ro.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ru.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/si.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/sk.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/sl.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/so.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/sq.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/sr.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/sv.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/sw.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ta.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/te.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/th.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/tr.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/uk.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/ur.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/uz.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/vi.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/yo.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/zh-Hans.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/zh-Hant.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.apps/mobile/src/i18n/locales/zu.json— Generated; M; 12 changed lines. Adds eight cancellation and restore translations.Tests: 13 files modified, with 1,509 changed lines: chat-composer-attachment-send, chat-composer-exit-submit-lock, chat-composer-submission, chat-composer, message-bubble, mobile-session-manager, session-detail-content, use-new-session-creator, use-agent-attachment-upload, cli-live-transport, cloud-agent-transport, session-manager, and storage/helpers suites.
Generated: 1 OpenCode type file (
opencode.gen.ts) and 86 tool-merged locale catalogs modified, with 1,034 changed lines.Verification
No manual test paths were run for this level. Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level of the stacked set.
E2E report: none attached; the cumulative report belongs to tip PR 5617.
Visual Changes
Visual Changes: N/A
Reviewer Notes
Human steps
drop_queued_message.No new environment values, secrets, flags, database migrations, or cache-clearing steps are required.
Scope
Kilo-Org/cloudworktree:/Users/igor/Projects/.worktrees/agent-composers-c07a. This description uses immutable base5e90f69c285d563dc1907aee019281e6af579895and head70a2b95c57715dcb5a1d6bc355adb19eb8155bf2, not the checked-out tip.Kilo-Org/kilocodeworktree:/Users/igor/Projects/.worktrees/agent-composers-c07a-kilocode. This worktree is a sibling reference only; its changes are outside this description.Notes
Cumulative runtime verification and its limits are recorded in #5617.
Current-head CI and Kilobot approve this PR.
Queued-message cancellation has automated coverage, but no deterministic live verification.
The sibling remote sender PR is Kilo-Org/kilocode#13496.
Translation verification: The landing report records four passing checks: formatting, format checking, translated-value/placeholder/preservation auditing, and catalog whitespace checking.
This is level 4 of a 6-level stacked set of PRs. Merge bottom to top. Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Stacked PRs — merge bottom to top. Each level shows only its own diff.
Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.
agent-composers-c07a— feat(agent-composer): add message identity and queue cancel APIs #5537agent-composers-c07a-s2— feat(mobile): pre-upload attachments and release abandoned files #5538agent-composers-c07a-s3— feat(mobile): reorder composer attachments with drag and a11y moves #5540agent-composers-c07a-s4— feat(agent-composer): render sent messages immediately and cancel queued ones #5589agent-composers-c07a-s5— feat(mobile): keep agent composers editable during live dictation #5607agent-composers-c07a-s6— feat(mobile): adapt agent composers for keyboard, height, and preferences #5617 (tip)