fix(mobile): attach files to the cloud workspace before a chat send imports them

Merged
SA
1mo ago
+9-1

Problem

On a cloud workspace, sending an attachment into an existing ACP chat on mobile fails with "Could not send — Attachment not found".

A cloud sandbox calling attachment.resolve only sees files anchored to its own workspace (attachments.parentKind = "cloud_workspace"). The chat send path in WorkspaceScreen.handleSubmit uploaded the file and called the host's attachments.importFromCloud without anchoring it first, so resolve filtered it out.

New chats from Home work, because workspace creation anchors the files. Terminal sessions work, because useWriteTerminalAttachments calls cloudWorkspace.attachFiles first. The chat path came in with #8238 and missed that step.

Fix

In a cloud workspace, call cloudWorkspace.attachFiles before importFromCloud on a chat send, the same way the terminal path does.

Validation

  • Biome passes on the changed file.
  • Mobile tsc reports the same error count before and after (185, none new). This checkout doesn't have the workspace packages built.
  • Not yet verified on device. JS-only, so it ships by EAS update.

Summary by cubic

Fixes sending attachments into an existing chat on a cloud workspace, which failed with "Attachment not found" because the cloud sandbox only resolves files attached to its own workspace.

  • Now calls cloudWorkspace.attachFiles before importFromCloud on chat sends, matching the terminal path.

Summary by CodeRabbit

  • Bug Fixes
    • File attachments in cloud workspaces are now linked to the workspace before they’re imported and sent with a chat message.