Skip to content

🤖 fix: a new workspace waits for its branch list before it can be sent - #6035

Merged
ThomasK33 merged 6 commits into
mainfrom
fix/6033-creation-send-waits-for-branches
Oct 10, 2026
Merged

ThomasK33 merged 6 commits into
mainfrom
fix/6033-creation-send-waits-for-branches

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Summary

In a new-workspace (creation) view, Send now stays disabled until the project's branch list has loaded. Before this change, a send in that window failed with the error toast "Trunk branch is required for worktree and SSH runtimes". Local and scratch chats are not gated.

Fixes #6033

Background

Until the branch list loads, the trunk branch is "" (useDraftWorkspaceSettings.ts), and the creation send passed it to workspace.create with no check. The backend refuses every runtime except local without a trunk (workspaceService.ts).

What a user saw (repro on a production build of 9c1d222f47, branch list delayed by a git wrapper that sleeps on for-each-ref):

  1. They type a message and press Enter while the "from" branch picker still shows its loading skeleton.
  2. They confirm "Trust this project?", if the project is untrusted.
  3. A red error toast appears: "Trunk branch is required for worktree and SSH runtimes". No workspace is created, and the message stays in the composer.

Before: the error toast after an early send

Implementation

ChatInput/index.tsx adds one term to canSend, next to the existing coderPresetsLoading term: a creation composer (not scratch) whose branches have not loaded, with any runtime except RUNTIME_MODE.LOCAL. canSend already gates the button, Enter and slash commands (sendComposerInput returns early on !canSend). This mirrors the backend rule: buildRuntimeConfig maps only LOCAL to type: "local". The change adds no new copy, tooltip or spinner, because the picker's skeleton already shows that the list is loading.

Project switch: the gate cannot stay open from another project. ProjectPage.tsx keys the creation ChatInput by ${projectPath}:${pendingDraftId}, so a project switch remounts it with branchesLoaded=false. The load effect also resets branchesLoaded when projectPath changes (useCreationWorkspace.ts).

Validation

  • tests/ui/agents/creationWaitsForBranches.test.ts (new, real backend): projectService.listBranches is held on a promise.
    • "a worktree workspace cannot be sent until the branches load, then it uses the loaded trunk": failed before the fix (Send was enabled) and passes after it. While the list is held, the button and Enter create nothing and no error toast appears. After the release, workspaceService.create gets a non-empty trunk.
    • "a local workspace can be sent while the branches are still loading": passes before and after.
  • The existing creation-view UI tests pass (creationGoalFormalRepro, creationSlashCommands, newChatStreamingFlash, docker, initBanner). tests/ui/workspaces/nameGeneration.test.ts also fails on the base commit. That is tests: 3 tests/ui tests fail on main (creationGoalFormalRepro, nameGeneration) #6016, which 🤖 tests: wait for the branch list before sending from a creation view #6032 fixes.

Dogfood (production build of this branch, branch list delayed):

Send disabled while the list loads (1280 px):
After: Send disabled while the branch list loads, desktop

Send enabled once the picker shows main:
After: Send enabled once the branches loaded, desktop

Send disabled while the list loads (390 px). The layout is unchanged:
After: Send disabled while the branch list loads, 390 px

Recording (36 s): Enter during loading does nothing, Send turns on, and the send creates the workspace with no error.

send-waits-for-branches.mp4

Risks

Low. The change only makes Send unavailable for a short time in the creation view: until listBranches settles, which includes a failed call. If listBranches rejects, the old backend toast still explains it, as it did before.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $262.60

While the creation view's branch list loads, the trunk branch is empty,
and the backend refuses every runtime except local with "Trunk branch is
required for worktree and SSH runtimes". Send (button, Enter and slash
commands) now stays disabled until the list loads, except for the local
runtime and scratch chats.

Fixes #6033

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T11:48:34.679067Z 0f17e12 New commits
🔒 Security Review ✅ Completed 2026-10-10T11:51:18.421507Z 0f17e12 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 719a729af7

ℹ️ 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
ProjectPage's "Run /init" banner calls the composer's imperative send()
once. With Send gated while the branch list loads (#6033), that call
was refused and nothing retried it, so the click did nothing. The
composer now keeps an imperative send made while the branches load and
sends it once they have loaded.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_

@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: f4e9028b57

ℹ️ 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 Outdated
The deferred send kept only the fact that send() was called, so a user
who replaced /init with another prompt while the branch list loaded had
that prompt sent without pressing Send. The deferred send now holds the
draft text at the time of the call, and any edit withdraws it. The
edited text stays in the composer for the user to send.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_

@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: 4c07d6879d

ℹ️ 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
…robe

The creation view loaded branches and runtime availability with one
Promise.allSettled and marked the branches loaded only after both
settled. With Send now gated on the branch list (#6033), the runtime
probe (Docker, Podman, devcontainer CLI, multi-second timeouts) held
worktree and SSH sends even after the branches were ready. Each request
now settles on its own.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_

@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: 0fa1105429

ℹ️ 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
Comment thread src/browser/features/ChatInput/index.tsx Outdated
Three review rounds found new holes in the deferred send (an edited
draft sent without a Send press, the dev container runtime probe
dropping the intent, attachments added after the click uploaded on
their own). Scope reduction: the imperative send() is refused while the
branch list loads like any other send. "Run /init" leaves /init in the
composer, and the user presses Send once the branches load. The Send
gate and the independent branch loader stay.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
Since #6032, openProjectCreationView waits for the branch selector. The
#6033 tests hold listBranches before they open the view, so on main the
helper timed out ("Source branches not loaded"). The tests now open the
view with their own click-and-wait for the composer.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 10, 2026
Merged via the queue into main with commit 0c8d685 Oct 10, 2026
60 of 62 checks passed
@ThomasK33
ThomasK33 deleted the fix/6033-creation-send-waits-for-branches branch October 10, 2026 12:36
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.

🤖 fix: Send in a creation view before its branch list loads fails with "Trunk branch is required"

1 participant