feat(mobile): pre-upload attachments and release abandoned files - #5538
Merged
Conversation
Upload images and documents on select; strip-fail never uploads and blocks send; remove releases admitted pending keys; leave confirms then releases unclaimed uploads; retryable failure keeps the chip recoverable. Retry releases the prior admitted key and re-checks liveness before re-presigning.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (87 files)
Previous Review Summary (commit ea938f0)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ea938f0)Status: No Issues Found | Recommendation: Merge Files Reviewed (13 files)
Reviewed by grok-4.6 · Input: 195.1K · Output: 13.9K · Cached: 838.1K Review guidance: REVIEW.md from base branch |
This was referenced Aug 27, 2026
# Conflicts: # apps/mobile/src/components/agents/new-session-screen-body.tsx
RSO
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useAgentAttachmentUploadnow uploads documents at selection time, matching images, so progress and failures appear before submission.uploadPendingrejects every failed or uploading attachment instead of retrying failed uploads; users must explicitly choose Retry or remove the file. Uploaded files keep the existingAgentAttachmentWireandAgentAttachmentSubmissionPayloadcontracts, and still-pending files retain a fallback upload.Files
apps/mobile/src/lib/agent-attachments/use-agent-attachment-upload.ts— Source; M; 119 changed lines. Starts document uploads early, blocks failed submissions, and adds metadata rejection plus cleanup of unclaimed uploads.apps/mobile/src/lib/agent-attachments/use-agent-attachment-upload.test.ts— Test; M; 330 changed lines. Updates the upload lifecycle tests.apps/mobile/src/components/agents/chat-composer-attachment-send.test.ts— Test; M; 60 changed lines. Updates the attachment submission tests.metadataStripFailednow marks a terminal error, preventing upload of the original photo when metadata removal fails.ChatComposerreplaces its send-time warning with a persistentAccessibleStatus;useNewSessionCreatorremoves its warning-only path. Send and Start stay blocked until the user removes the photo, and Retry is unavailable.Files
apps/mobile/src/components/agents/use-new-session-creator.ts— Source; M; 10 changed lines. Removes the metadata warning and relies on the blockinguploadPendingresult before session creation.apps/mobile/src/components/agents/use-new-session-creator.test.ts— Test; M; 29 changed lines. Updates the session creation tests.uploadOneadds optionalonAdmittedbefore PUT;hasAnyUnclaimedAttachmentdriveshasUnclaimedAttachmentsfromremoteKey, whileremoteFilenamestays success-only.UseAgentAttachmentUploadReturn.releaseUnclaimedUploadsand the newreleasePendingUploadshelper release admitted keys on removal or confirmed leave; Retry releases its previous key first. The existing 24-hour reaper handles failed releases and pre-admission cancellation; cleanup failures stay silent, while failed uploads remain recoverable.Files
apps/mobile/src/lib/agent-attachments/agent-attachment-types.ts— Source; M; 10 changed lines. AddshasAnyUnclaimedAttachment, which detects admitted object keys regardless of upload success.apps/mobile/src/lib/agent-attachments/upload-task.ts— Source; M; 33 changed lines. Adds the optional admission callback and the release helper withorganizationIdandobjectKeys. UsescloudAgentNext.releasePendingUploadsororganizations.cloudAgentNext.releasePendingUploads; empty key lists do nothing.apps/mobile/src/components/agents/chat-composer.test.ts— Test; M; 12 changed lines. Updates the composer contract tests.Chat navigation now confirms leaving unclaimed uploads, including header Back, Android Back, and the iOS swipe gesture.
useNewSessionDiscardGuardadds optionalhasUnclaimedAttachments = false; attachment-only drafts now trigger confirmation, while old callers keep text-only messages. In new-session drafts, Discard releases uploads only after stored text clears; failed clears preserve uploads, and successful creation retains its navigation bypass.Files
apps/mobile/src/components/agents/chat-composer.tsx— Source; M; 44 changed lines. Adds an upload-discard alert and replaces the metadata toast with an accessible inline error.apps/mobile/src/components/agents/new-session-screen-body.tsx— Source; M; 15 changed lines. Includes unclaimed uploads in the dirty condition and releases them only after successful draft deletion.apps/mobile/src/app/(app)/agent-chat/use-new-session-discard-guard.ts— Source; M; 9 changed lines. Adds the optional upload flag and selects attachment-aware confirmation text.apps/mobile/src/app/(app)/agent-chat/__tests__/use-new-session-discard-guard.mounted.test.tsx— Test; M; 49 changed lines. Updates the mounted discard guard tests.Four new messages keep attachment safety and discard alerts in the selected language. The keys are
agentChat.composer.discardAttachmentsTitle,agentChat.composer.discardAttachmentsMessage,agentChat.newSession.discardWithUploadsMessage, andchat.attachment.metadataStripFailed. English adds four messages; 86 translated catalogs add 344 values without changing existing values, key order, or hierarchy.Files
apps/mobile/src/i18n/locales/af.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/am.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ar.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/az.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/be.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/bg.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/bn.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/bs.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ca.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ckb.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/cs.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/cy.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/da.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/de.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/el.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/en.json— Generated bundled asset; M; 4 changed lines. Adds four English attachment messages.apps/mobile/src/i18n/locales/es.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/et.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/eu.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/fa.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/fi.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/fil.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/fr.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ga.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/gl.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/gu.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ha.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/he.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/hi.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/hr.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ht.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/hu.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/hy.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/id.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ig.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/is.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/it.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ja.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ka.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/kk.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/km.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/kn.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ko.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/lo.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/lt.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/lv.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/mg.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/mi.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/mk.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ml.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/mn.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/mr.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ms.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/mt.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/my.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/nb.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ne.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/nl.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/om.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/or.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/pa.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/pl.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ps.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/pt-BR.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/pt.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ro.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ru.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/si.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/sk.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/sl.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/so.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/sq.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/sr.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/sv.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/sw.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ta.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/te.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/th.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/tr.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/uk.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/ur.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/uz.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/vi.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/yo.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/zh-Hans.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/zh-Hant.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.apps/mobile/src/i18n/locales/zu.json— Generated bundled asset; M; 10 changed lines. Adds four translated attachment messages.Tests: 5 files modified—
use-new-session-discard-guard.mounted.test.tsx,chat-composer-attachment-send.test.ts,chat-composer.test.ts,use-new-session-creator.test.ts, anduse-agent-attachment-upload.test.ts—480 changed lines.Generated: 87 bundled locale catalogs modified—
en.jsonand 86 translated catalogs—864 changed lines (4 English; 10 per translated catalog).Verification
Visual Changes
Visual Changes: N/A
Reviewer Notes
Human steps
Scope and evidence
Kilo-Org/cloud. This description covers base5b47fbea5fd57ceb366bc033e094bf8906f6c53cthrough immutable head79a18adec0c0a2a51d0bc780902c61b63dd8b1b0only./Users/igor/Projects/.worktrees/agent-composers-c07a. The checkout is onagent-composers-c07a-s6; its tip changes are outside this description./Users/igor/Projects/.worktrees/agent-composers-c07a-kilocode, branchagent-composers-c07a. This level includes no changes from that worktree.Mmeans modified. File sizes count changed lines from the supplied statistics: 99 files, 1,178 insertions, and 406 deletions.Cumulative runtime verification and its limits are recorded in #5617.
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