-
Notifications
You must be signed in to change notification settings - Fork 45
🤖 feat: support PDF attachments #1896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edfcb8fb8d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
cb20bf0 to
029ee8d
Compare
029ee8d to
7c3342b
Compare
#1896 regressed #1146 by awaiting sendMessage before calling onWorkspaceCreated. This caused the 'Creating workspace' splash to block until sendMessage resolved, which waits for init to complete. For devcontainer/SSH runtimes, init can take minutes. Restore the fire-and-forget pattern: navigate immediately after workspace.create() succeeds. Draft input/attachments are now cleared only after sendMessage succeeds (via .then()), preserving them if the send fails. Added regression test that verifies onWorkspaceCreated is called before sendMessage resolves (using a never-resolving promise mock).
## Summary Fixes a regression where the "Creating workspace" splash blocked until `sendMessage` completed. For devcontainer/SSH runtimes, this could take minutes since `sendMessage` waits for init (container build) to finish. ## Background **Regressed in #1896** ("feat: support PDF attachments") which changed `void api.workspace.sendMessage(...)` (fire-and-forget) to `await api.workspace.sendMessage(...)` and moved `onWorkspaceCreated` after it. This undid the fix from **#1146** ("perf: exit splash screen immediately after workspace.create()"). ## Implementation - Move `onWorkspaceCreated` and `setIsSending(false)` to immediately after `workspace.create()` succeeds - Change `sendMessage` back to fire-and-forget with `void` - Clear draft input/attachments only after `sendMessage` succeeds (via `.then()`), preserving them if the send fails ## Validation - Added regression test that verifies `onWorkspaceCreated` is called before `sendMessage` resolves (using a never-resolving promise mock) - Existing tests pass - `make static-check` passes --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high` • Cost: `$7.42`_ <!-- mux-attribution: model=anthropic:claude-opus-4-5 thinking=high costs=7.42 -->
## Summary Fixes a regression where the "Creating workspace" splash blocked until `sendMessage` completed. For devcontainer/SSH runtimes, this could take minutes since `sendMessage` waits for init (container build) to finish. ## Background **Regressed in #1896** ("feat: support PDF attachments") which changed `void api.workspace.sendMessage(...)` (fire-and-forget) to `await api.workspace.sendMessage(...)` and moved `onWorkspaceCreated` after it. This undid the fix from **#1146** ("perf: exit splash screen immediately after workspace.create()"). ## Implementation - Move `onWorkspaceCreated` and `setIsSending(false)` to immediately after `workspace.create()` succeeds - Change `sendMessage` back to fire-and-forget with `void` - Clear draft input/attachments only after `sendMessage` succeeds (via `.then()`), preserving them if the send fails ## Validation - Added regression test that verifies `onWorkspaceCreated` is called before `sendMessage` resolves (using a never-resolving promise mock) - Existing tests pass - `make static-check` passes --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high` • Cost: `$7.42`_ <!-- mux-attribution: model=anthropic:claude-opus-4-5 thinking=high costs=7.42 -->
Summary
Refactors chat attachments plumbing from the confusing
imagePartsnaming to genericfileParts, and extends attachments beyond images to include PDFs (application/pdf).Implementation
imageParts→fileParts,ImagePart→FilePart,MuxImagePart→MuxFilePart.inputAttachments:*and generalized UI toChatAttachments.getModelCapabilities()helper backed bymodels.jsonto detectsupports_pdf_inputandmax_pdf_size_mb.Validation
make static-checkRisks
inputImages:*drafts won’t restore).Generated with
mux• Model:openai:gpt-5.2• Thinking:xhigh• Cost:$7.74