Skip to content

Refuse Side chat replies inside a running turn instead of forking an older checkpoint - #6514

Merged
ymichael merged 1 commit into
mainfrom
bb/fix-issue-6497-in-bb-thr_tmd4y3drew
Oct 29, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/fix-issue-6497-in-bb-thr_tmd4y3drew

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

An anchored fork inside a turn that has not completed is refused by core with fork_source_session_unavailable, the same code core uses for refusals where Side chat may fall back to a tip fork (for example, an earlier message on a tip-only provider). Side chat caught that code and retried without sourceSeqEnd. While a turn is running, the tip is the previous completed turn's checkpoint, so the reply opened successfully with the quote but silently lacked the selected turn's context. See the issue's reproduction report.

What changed

  • apps/server/src/services/threads/thread-fork-history.ts: the "turn containing it has not completed" refusal now uses its own code, fork_source_turn_incomplete (same HTTP 400 and message). Every other anchored refusal keeps fork_source_session_unavailable.
  • Side chat's fallback still keys only on fork_source_session_unavailable, so a running-turn reply now surfaces the server error through the existing "Failed to start side chat" toast, matching core's Fork action, instead of forking an older checkpoint. Fallback cases such as tip-only providers are unchanged.
  • No daemon wire, CLI, or guide changes; the CLI already documents that --source-seq-end anchors on a completed turn.

How you verified

  • New end-to-end test in apps/server/test/public/public-thread-fork.test.ts: installs the real built-in Side chat plugin, calls createSideChat on an agent message inside a running turn, and asserts it fails without queuing a fork. It then completes the turn and asserts the same request forks at that turn's checkpoint. With the server change reverted, it fails with expected 200 not to be 200 (the bug).
  • Updated the running-turn assertion in the existing fork test, and added a Side chat unit test that the new code is rethrown without a retry.
  • pnpm exec turbo run test typecheck --filter=@bb/server --filter=bb-plugin-side-chat: 361 server test files passed, Side chat tests passed.
  • Manual check on a pnpm start:worktree server with real Codex threads: replying to commentary inside a held-open turn was refused with "the turn containing it has not completed"; replying to the same message after the turn completed opened a side chat that correctly recalled the code introduced in that turn.

Fixes #6497

AGENT GENERATED

🤖 Generated with Claude Code

…older checkpoint

An anchored fork inside an unfinished turn threw the same
fork_source_session_unavailable code as the cases Side chat may answer
with a tip fork. Side chat retried without the anchor, and while a turn
runs the tip is the previous completed checkpoint, so the reply silently
lost the selected turn's context. The running-turn case now has its own
fork_source_turn_incomplete code; Side chat surfaces it as an error toast.

Fixes #6497

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 64248c3 into main Oct 29, 2026
32 checks passed
@ymichael
ymichael deleted the bb/fix-issue-6497-in-bb-thr_tmd4y3drew branch October 29, 2026 03:19
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.

Side chat replies to running-turn commentary silently inherit the previous checkpoint

1 participant