Skip to content

feat(threads): launch Best of N into isolated candidate worktrees (#1223) - #1272

Merged
currentbits merged 1 commit into
coder/1223-bon-isolate-servicefrom
coder/1223-bon-isolate-launch
Sep 10, 2026
Merged

currentbits merged 1 commit into
coder/1223-bon-isolate-servicefrom
coder/1223-bon-isolate-launch

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Stack 3/3, based on #1271.

Wires Best of N to the isolate contract: preflight before any fork, pass isolate: true plus the first candidate's recorded start snapshot through useCoder.forkThread, fork every candidate, then start runs. Ordinary Fork and Hand off still omit isolate. Ask threads keep Best of N hidden.

Partial start failure leaves already-forked candidates inspectable. Unsupported projects surface the preflight error instead of launching an unsafe parallel implementation.

Why

This is the user-facing path for #1223. Isolation is chosen before any candidate starts, not patched onto a thread afterward.

Tests

  • test/bestOfNComposer.test.tsx — fork-all-then-start, isolate + reused snapshot, remote preflight, start failure keeps forks

  • test/forkHandoff.test.tsx — App Best of N hits threads.fork with isolate; ordinary Fork does not

  • test/support/fakeCoder.ts / src/devCoder.ts honor isolate fail-closed

  • PR created by the Grok agent

)

Preflight before any fork, pass isolate:true with a shared start snapshot
through useCoder.forkThread, and start runs only after every candidate is
forked. Ordinary Fork and Hand off still omit isolate.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 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-09-10T16:24:19.072954Z e54c96c PR opened
ℹ️ 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.

@currentbits
currentbits merged commit 2907dc3 into coder/1223-bon-isolate-service Sep 10, 2026
0 of 6 checks passed

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

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

model: entry.model,
})
: await onFork({ provider: entry.provider });
const forked = await onFork(bestOfNForkOpts(entry, snapshot));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the prompt when staging candidate forks

When a second or later fork fails, the earlier onFork has already selected its new thread because App delegates to useCoder.forkThread, which calls setSelectedThreadId. App then gates out the old detail and unmounts its Composer, whose draft exists only in draftsRef; because this new fork-all loop has not started any run yet, the rejection leaves the user on an idle fork with the original prompt permanently lost. Avoid selection while staging, or restore/reselect the source and its draft when staging fails.

Useful? React with 👍 / 👎.

currentbits added a commit that referenced this pull request Sep 20, 2026
* feat(threads): fail-closed isolate:true on forkThread (#1223)

Require a worktree and record the source committed HEAD before creating
the candidate. Reuse a caller-supplied SHA so a race shares one start.
Ask, remote, non-git, and unsupported scm throw instead of sharing the
checkout. Ordinary Fork, worktree:true chips, and worktree:false workers
are unchanged.

* feat(threads): launch Best of N into isolated candidate worktrees (#1223) (#1272)

Preflight before any fork, pass isolate:true with a shared start snapshot
through useCoder.forkThread, and start runs only after every candidate is
forked. Ordinary Fork and Hand off still omit isolate.

Co-authored-by: Willem <[email protected]>

---------

Co-authored-by: Willem <[email protected]>
@currentbits
currentbits deleted the coder/1223-bon-isolate-launch branch October 3, 2026 16:07
currentbits added a commit that referenced this pull request Oct 19, 2026
* feat(threads): fail-closed isolate:true on forkThread (#1223)

Require a worktree and record the source committed HEAD before creating
the candidate. Reuse a caller-supplied SHA so a race shares one start.
Ask, remote, non-git, and unsupported scm throw instead of sharing the
checkout. Ordinary Fork, worktree:true chips, and worktree:false workers
are unchanged.

* feat(threads): launch Best of N into isolated candidate worktrees (#1223) (#1272)

Preflight before any fork, pass isolate:true with a shared start snapshot
through useCoder.forkThread, and start runs only after every candidate is
forked. Ordinary Fork and Hand off still omit isolate.

Co-authored-by: Willem <[email protected]>

---------

Co-authored-by: Willem <[email protected]>
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