Skip to content

🤖 feat: stage arbitrary files from the creation composer#3748

Merged
ibetitsmike merged 14 commits into
mainfrom
mike/creation-composer-file-staging
Jul 23, 2026
Merged

🤖 feat: stage arbitrary files from the creation composer#3748
ibetitsmike merged 14 commits into
mainfrom
mike/creation-composer-file-staging

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Creation composers (new chat on project/scratch pages) can now accept arbitrary files. Non-provider files (.md, .csv, binaries, ...) are held in memory as a new pending-file attachment kind and staged into the workspace via the existing workspace.stageAttachment IPC right after workspace.create, before the first sendMessage. The backend stageAttachment handler now waits for the workspace init barrier (same as executeBash) so staging works on deferred-init runtimes.

Background

#3746 added arbitrary file paste/drop/pick, but only for workspace composers: files are written immediately into .mux/user-attachments/ of an existing workspace. The creation composer has no workspace yet, so dropping a non-provider file threw "Files can be staged after opening a workspace." and the picker was filtered to image/*,.svg,.pdf.

Implementation

  • New pending-file kind in the ChatAttachment union: filename, media type, size, and base64 bytes held in composer state (like provider data URLs), rendered with the same chip as staged files.
  • processAttachmentFiles gains holdNonProviderFiles; creation composers enable it. Provider-native formats still route first and the existing 10 MiB cap applies before reading bytes.
  • On creation submit: create -> stage each pending file (new stagePendingFiles helper, sequential, per-file failure collection) -> append the <attached-files> notice built from returned staged paths -> sendMessage.
  • Fail closed: if any staging call fails, the initial send is skipped, the draft (text + staged results + still-pending files) is transferred into the new workspace's composer keys, and the error is persisted via the existing pending-send-error mechanism so the workspace view toasts. No duplicate workspace on retry.
  • Backend: WorkspaceService.stageAttachment awaits initStateManager.waitForInit before writing, closing the race where deferred runtimes (Coder/SSH/devcontainer) return from create while provisioning continues in background init.
  • Workspace composers stage transferred pending-file drafts at submit time before building the notice.
  • /goal typed with attachments bypasses command processing and sends as a normal message instead of silently dropping files; other commands with pending files are blocked with the existing toast.
  • Draft persistence: pending-file validator added; records are self-contained so the fork draft-copy path keeps them (unlike staged, which is worktree-local). Existing 4M-char size guard unchanged.
  • Picker accept gate removed (canStageFiles prop deleted); every composer takes any file type.

Validation

  • New tests: pending-file hold/routing/oversize rejection; stagePendingFiles ordering and failure aggregation; draft round-trip and self-healing; creation flow asserting create -> stage x N -> send ordering with staged paths in the notice; fail-closed flow asserting no send, draft transfer, and persisted error.
  • make static-check and full bun test src (10109 pass) locally.

Risks

  • Creation send path (useCreationWorkspace.handleSend) now has a staging step between create and first send; a regression there would affect first-message delivery for new workspaces. The fail-closed path degrades to a draft in the new workspace rather than data loss.
  • Devcontainer runtimes: create returns while post-create setup still runs; staging writes go through the host-mounted worktree, and a failure lands in the fail-closed retry path.

Generated with mux • Model: anthropic:claude-fable-5 • Thinking: xhigh • Cost: $111.51

Creation composers (new chat on project/scratch pages) previously rejected
non-provider files because no workspace exists to stage into. Hold such
files in memory as a new pending-file attachment kind, then stage them via
the existing stageAttachment IPC right after workspace creation and append
the attached-files notice to the first message.

If any staging call fails, fail closed: skip the initial send, transfer the
draft (text + staged/pending attachments) into the new workspace's composer,
and surface the error as a toast after navigation so the user can retry
without creating a duplicate workspace. Workspace composers stage any
pending-file drafts (from such transfers) at submit time.

The file picker accept filter gate is removed since every composer can now
take arbitrary files.
Reuse filePartsToChatAttachments for the failed-transfer draft, derive the
staging mock types from stagePendingFiles instead of duplicating the IPC
shapes, and trim comments to the non-obvious invariants.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 6291eb71e0

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts
Deferred runtimes (Coder/SSH/devcontainer) return from create before
provisioning finishes, so staging right after creation could write into a
not-yet-ready workspace. Await the same InitStateManager barrier executeBash
uses.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: b10a50c7e2

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts Outdated
Comment thread src/node/services/workspaceService.test.ts
… init test

Creation skill sends built muxMetadata.rawCommand before staging, so the
transcript (which prefers rawCommand for display) lost the attachment chips;
patch rawCommand with the notice after staging. Replace the fixed test sleep
with an explicit barrier-reached gate.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: fbcb26215d

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts Outdated
…nsfer

For slash-skill creation sends, the transferred draft contained the
rewritten skill text, so a retry lost the skill invocation. Prefer
muxMetadata.rawCommand (the original typed command) for the draft text.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: ff55a31f5a

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts Outdated
Staging can succeed and the initial sendMessage still fail; the creation
draft was already cleared, so the workspace opened without the text or
staged chips needed to retry. Reuse the staging-failure draft transfer.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: f8d7782c16

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts Outdated
…retries

Creation sends with project-scoped skills force project-path discovery; a
transferred-draft retry resolved the slash command against the new worktree
instead, so it could miss or run a different skill. Persist an ephemeral
per-workspace flag with the transfer, honor it in the workspace composer's
skill resolution and send options, and clear it after the next successful
send.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 0673fa850a

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 9a20217971

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 23ec38eb5b

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/index.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: b1df87256b

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: f11c15d2c5

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 4268432f14

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/index.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 39aca0dfeb

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/useCreationWorkspace.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 92ee77170a

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike added this pull request to the merge queue Jul 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 23, 2026
@ibetitsmike
ibetitsmike added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit 601359d Jul 23, 2026
21 of 22 checks passed
@ibetitsmike
ibetitsmike deleted the mike/creation-composer-file-staging branch July 23, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant