feat(mothership): add files to mship block#4584
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds file attachment support to the Mothership block, allowing users to upload files (basic mode) or reference files from previous blocks (advanced mode) that are then forwarded as base64-encoded attachments to the Mothership execute endpoint.
Confidence Score: 3/5The block and API surface changes are clean; the main risk is in the handler's toUserFile URL fallback, where a storage key is silently used as a URL, leading to opaque failures when files arrive without explicit URL fields. The URL-fallback-to-key issue in toUserFile means file references lacking a url or path field will have their storage key treated as an HTTP URL. If readUserFileContent uses the URL field for network access, execution silently fails in a way that is difficult to diagnose. The test suite only exercises the happy path where path is always present, leaving the fallback branch uncovered. apps/sim/executor/handlers/mothership/mothership-handler.ts — specifically the toUserFile URL fallback and the redundant base64 decode/re-encode in buildMothershipFileAttachments Important Files Changed
Sequence DiagramsequenceDiagram
participant Block as Mothership Block
participant Handler as MothershipBlockHandler
participant Storage as readUserFileContent
participant API as /api/mothership/execute
participant Mship as Mothership Lifecycle
Block->>Handler: execute(ctx, block, inputs)
Handler->>Handler: normalizeFileInput(files)
loop For each file
Handler->>Handler: toUserFile(file)
Handler->>Storage: readUserFileContent(userFile)
Storage-->>Handler: base64 string
Handler->>Handler: Buffer.from + createFileContent
end
Handler->>API: POST with fileAttachments
API->>Mship: runHeadlessCopilotLifecycle
Mship-->>API: result
API-->>Handler: JSON response
Handler-->>Block: BlockOutput
Reviews (1): Last reviewed commit: "Add files to mship block" | Re-trigger Greptile |
Summary
Add files to mship block
Type of Change
Testing
Manual
Checklist