Skip to content

feat(site): support workspace file uploads from the new chat page - #27112

Merged
ibetitsmike merged 7 commits into
mainfrom
mike/chat-workspace-upload/new-chat-ui
Sep 27, 2026
Merged

ibetitsmike merged 7 commits into
mainfrom
mike/chat-workspace-upload/new-chat-ui

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Written by Mux on behalf of Mike.

What

Workspace-routed files, such as zip archives, can now be attached on the new-chat page when a running workspace is selected. Previously the upload endpoint required a chat ID that did not exist yet, so the landing page rejected these files with a misleading toast.

How

  • Queue workspace files locally until submit, then create an idle chat, upload the queued files, send the first message with workspace-file references, and navigate after the message succeeds.
  • Keep retries and partial failures safe by re-uploading into a fresh chat, archiving failed shell chats, and preserving the draft. If archiving returns 409 because the server did commit the first message, navigate to the chat instead of showing errors.
  • Ignore files explicitly removed before or during upload, but treat reset, scope changes, and unmount as cancellation so the flow cannot continue with stale or partial workspace files.
  • Lock the organization, workspace, and composer controls for the complete create, upload, and send sequence, and keep them locked after success until the page navigates. A synchronous guard ignores any second submit, so a pending Enter or Send click cannot create a duplicate chat without the files.
  • Refuse new files of any kind (picker, drop, paste) while a submit is in flight, with a toast (paste goes through a small plugin because Lexical ignores paste on a read-only editor), so a file added mid-sequence is never uploaded and then silently dropped.
  • Files attached before submit show a deferred chip state ("Uploads when sent"), distinct from the chat page's queued state ("Waiting to upload...").
  • Show landing-page copy that asks the user to select a running workspace.

Follow-ups

  • The create page gates workspace uploads on any connected root agent; the server picks the agent with agentselect.FindChatAgent, so a multi-root-agent workspace with a disconnected chat-suffixed agent passes the gate and fails on upload (error toast, draft preserved, shell chat archived). An exact probe needs the selection exposed by the API. Tracked in CODAGT-1174.

  • Freeze regular attachment remove controls while the deferred workspace upload runs (adding files is already refused); the message is sent with the attachment IDs snapshotted at submit time, and AttachmentPreview/AgentChatInput currently have no read-only mode (the same window exists on the chat page while a send is pending).

  • Skip the final navigation when the user leaves the page while the deferred first-message request is in flight (needs an unmounted signal through the page; the regular create path on main has the same window).

  • Route a failed deferred first message through the form's inline hook-failure presentation (with the lifecycle-hook dispatch detail) instead of the toast; needs the send mutation state lifted into the form.

  • Recover from a first-message request that never responds (client timeout or cancel, archiving the shell chat on abandon); the create path on main has the same hang (CODAGT-1177).

  • Show one refusal toast per paste batch and use one policy for inline attachments during a pending send on both pages (CODAGT-1178).

Testing

  • AgentCreatePage.test.tsx covers the create, upload, send, navigate order and each archive path; AgentCreateForm.test.tsx covers the deferred-upload form behavior. The stories added here keep only distinct visual states.

Notes

Queued File objects do not survive a page reload. A browser closing mid-sequence can leave an idle, archivable chat after an explicit submit.

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ibetitsmike

Copy link
Copy Markdown
Collaborator 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: 0d665f9937

ℹ️ 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 force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 0d665f9 to 32a777a Compare July 8, 2026 22:26
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 32a777af27

ℹ️ 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 force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 32a777a to db35883 Compare July 8, 2026 22:38
@ibetitsmike

Copy link
Copy Markdown
Collaborator 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: db35883c08

ℹ️ 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 force-pushed the mike/chat-workspace-upload/new-chat-ui branch from db35883 to 40f2a3b Compare July 8, 2026 22:52
@ibetitsmike

Copy link
Copy Markdown
Collaborator 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: 40f2a3b583

ℹ️ 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 force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 40f2a3b to 84d79af Compare July 8, 2026 23:05
@ibetitsmike

Copy link
Copy Markdown
Collaborator 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: 84d79afa43

ℹ️ 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 force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 84d79af to d11e67d Compare July 8, 2026 23:14
@ibetitsmike

Copy link
Copy Markdown
Collaborator 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: d11e67d0b8

ℹ️ 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 force-pushed the mike/chat-workspace-upload/new-chat-ui branch from d11e67d to aad65b9 Compare July 8, 2026 23:24
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: aad65b93fc

ℹ️ 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".

@github-actions github-actions Bot added the stale This issue is like stale bread. label Jul 26, 2026
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Stopping the automated Codex loop on this PR as well and handing it to a human reviewer.

Reason: this PR's own diff has not changed since round 3 (only the layers below were restacked), and Codex approved it on four consecutive heads before this round produced three new findings on the same code (an FE8 design point about the scope-key reset effect, the navigate-after-unmount window during the first-message request, and the error presentation of a failed deferred send). Each is answered and resolved above; the two behavioral items are tracked as follow-ups in the description and the design point is left for the reviewer.

@github-actions github-actions Bot removed the stale This issue is like stale bread. label Sep 22, 2026

@jscottmiller jscottmiller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. See the summary comment on #27078 and the non-blocking inline follow-ups across the stack.

Approval posted by Coder Agents on Scott's behalf.

@ibetitsmike
ibetitsmike force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 92320a9 to 91bb9e3 Compare September 23, 2026 19:01
@ibetitsmike
ibetitsmike force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 91bb9e3 to 608799c Compare September 23, 2026 19:46

@jscottmiller jscottmiller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approved after the fix commits. Verified the addressed threads against the code (agent atomic publish, workspace status, normalized references, logging/metric, first-message fallback title, reasoning-effort override, Vitest coverage, archive-409 navigation) and ran the affected Go and Vitest suites; the remaining notes are acceptable as is. The three open follow-up threads are resolved as agreed follow-ups.

Approval posted by Coder Agents on Scott's behalf.

@ibetitsmike
ibetitsmike force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 608799c to 675276b Compare September 24, 2026 00:16
@ibetitsmike
ibetitsmike requested a review from a team as a code owner September 26, 2026 20:09
@ibetitsmike
ibetitsmike force-pushed the mike/chat-workspace-upload/new-chat-ui branch 2 times, most recently from 7a36398 to 468ec93 Compare September 27, 2026 10:25
Base automatically changed from mike/chat-workspace-upload/empty-create to main September 27, 2026 14:38
Workspace-routed files (zips and other non-attachment types) can now
be attached on the new-chat page when a workspace is selected. Since
the upload endpoint needs a chat ID, files queue locally and the
submit becomes a three-step sequence: create the chat without content,
upload the queued files, then send the first message carrying the
workspace file references.

Failure handling: any upload failure archives the just-created chat
and keeps the composer state for retry; a failed first message lands
on the created chat with a toast since the uploads are already there.
Deselecting the workspace drops queued files with a notice. The
no-workspace toast now says to select a workspace instead of the
misleading "attach a running workspace to the chat".
…t send conflicts

A first-message send can fail on the client after the server already
committed it. Archiving the chat then returns 409 because it left the
idle state, so treat that as success and open the chat instead of
showing error toasts on the composer.
…ertions to Vitest

Story play functions may drive state but must not assert. Cover the
deferred workspace upload behavior in AgentCreateForm.test.tsx and keep
only the visually distinct stories, without assertions. Drop stories
that duplicated existing coverage or had no visual state to capture.
… locked until navigation

After the page's create call resolved, the form cleared its chips and
unlocked while the page had not yet navigated. A pending Send then took
the text-only path and created a duplicate chat without files, and a
file added in that window was uploaded and silently dropped.

Guard submits with a synchronous in-flight ref and keep the composer
locked after a successful submit; only a failed submit releases it.
Attachments are refused with a toast while a submit is in flight.
…a send is pending

The composer's Lexical editor becomes non-editable during a pending
send, and Lexical ignores paste events on a non-editable root. Pasted
files were therefore dropped silently, while the file picker and drop
target showed the "wait for the current message" toast.

Route pasted files through the same path while a send is pending so
the form and composer refuse them visibly. Read-only composers keep
ignoring paste.
@ibetitsmike
ibetitsmike force-pushed the mike/chat-workspace-upload/new-chat-ui branch from 468ec93 to 68d1ea5 Compare September 27, 2026 14:38
…able in the picker when workspace uploads are wired

iOS greys out types excluded by the input's accept attribute with no
explanation, so zips, tarballs and videos were unselectable whenever no
workspace was ready. Leave accept unset and let routeFiles show the
unavailable-workspace message instead.
@ibetitsmike
ibetitsmike merged commit 856e764 into main Sep 27, 2026
28 checks passed
@ibetitsmike
ibetitsmike deleted the mike/chat-workspace-upload/new-chat-ui branch September 27, 2026 14:50
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants