Real bugs from Macroscope and Bugbot, all verified against source:
- awaitAttachmentUploads consulted only live jobs, so an upload that
settled before the await lost its result and a ready image could drop
from a pick-and-send message. Terminal states are now kept in a
settled map that cancel/release clean up.
- Stashing cancelled in-flight uploads before the localStorage write was
confirmed; a quota failure stranded chips in uploading forever.
Cancellation now happens only after the write lands.
- Retargeting a draft to another environment overwrote a reload-restored
attachment's ready state with a dead failed state. The mismatch is now
derived (never written), so switching back recovers the attachment,
and re-uploads release the old environment's bytes first.
- The turn-start failure path restored chips from the pre-await
snapshot, resurrecting uploading states no job would ever advance.
- The "images were not attached" toast could fire when no message was
sent; it now waits for the turn to actually start.
- Removing a preview annotation or discarding a draft leaked the upload
and its server-side bytes; both now release like chip removal.
- Mobile paste drops now surface the needs-an-update banner instead of
a console.warn.
- Normalizer error mappings keep their PlatformError causes; the dead
unstructured AttachmentUploadRequestError is deleted; the sweep test
no longer reads the real clock (effect-diagnostics CI failure).
Also folds the rebase onto main: the new moveComposerPromptAndImages
draft-carry now merges the unified image list, and in-flight uploads are
retargeted to the destination draft so moved chips keep their progress.
Co-Authored-By: Claude Fable 5 <[email protected]>
Attachments used to ride the turn-start command as base64 data URLs:
send carried the bytes, the stash re-encoded them into localStorage,
and a 10MB image meant a 14M-char string in a single ws frame.
Images now upload the moment they are attached. A ws RPC mints a
pending-<uuid> id plus a signed, expiring upload URL (mirroring signed
asset GETs, so it works against any environment); the browser POSTs the
compressed bytes to it with progress and abort; the turn-start command
carries id references only. The Normalizer renames pending files to
their thread segment at send, resolving by uuid so retries after a
partial send are idempotent. Never-sent uploads are deleted on chip
removal and swept after 30 days.
Breaking: the dataUrl upload variant is deleted with no compatibility
path. RN mobile compiles with image attach gated off behind
IMAGE_ATTACH_ENABLED and tells the user an update is needed; drafts and
stash persist id references (v9/v3 storage, old payloads purged).
Co-Authored-By: Claude Fable 5 <[email protected]>