[Bug]: Forking a running Claude thread replaces native history with a context handoff

Open
#34,856 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Start with apps/server/src/orchestration-v2/CommandPolicy.ts and ProviderTurnStartService.ts, then read ClaudeAdapterV2.forkThread and the Agent SDK's forkSession behavior. Reproduce a fork at a finished turn while the parent is running, checking transcript handling for a half-written line and whether upToMessageId excludes the active turn. Done means a running Claude source can be forked with native history while the parent continues, with the open questions resolved.

Written by the indexing model from the issue text.

Description

Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

apps/server

Steps to reproduce
  1. Use the Claude provider and let a turn finish.
  2. Send another message in that thread and leave it running.
  3. Fork from the finished turn, or open a side chat.
  4. Send the fork's first message before the parent finishes.
Expected behavior

The fork resumes a native copy of the Claude session up to the finished turn, with its real tool calls, outputs and prompt cache, while the parent keeps running.

Actual behavior

The fork starts a new Claude session whose first input is a T3-written "Fork context" summary (full_thread_summary). In my case the handoff kept 5 items and dropped 6, and native tool and reasoning state was not carried over. Idle forks of the same thread fork natively.

The cause is the busy-source rule added in #26901: decideForkExecution requires !input.sourceBusy, and startup checks again. #26901 gives the reason that Claude cannot fork a running session.

Why Claude may not need the fallback

The Agent SDK's forkSession doesn't use the live session. It reads the session's .jsonl transcript, cuts it at upToMessageId, rewrites UUIDs, and writes a new transcript. It has no check that the source is idle. A finished turn's messages are already in the transcript, so forking at that point should not need the source to stop.

The adapter's own guards in ClaudeAdapterV2.forkThread (the active-turn refusal and closeLiveQueryForNativeThread) look at the calling session's state. For a new fork, that is the target session, not the running parent. So I couldn't confirm from the code why a busy Claude fork failed before #26901.

#29239 (open, waiting for maintainer confirmation) adds an optional provider capability for native forks while the source runs, and enables it for Codex only. If that lands, Claude could set the same capability, possibly after an adapter change.

Open questions before enabling it for Claude
  • What failed when a Claude fork of a running thread was tried before #26901? A repro or log would show whether the limit is in the SDK, the CLI, or the adapter.
  • Does forkSession handle a source transcript that the running session is still appending to, including a half-written last line?
  • Is the fork's upToMessageId always a message in the finished turn, so nothing from the running turn gets in?
Impact

Minor bug or occasional failure

Version or commit

Seen on a personal fork built on nightly 0.1.8-nightly.20261109. The rule is unchanged on upstream 3a30b011c3.

Workaround

Wait for the parent to go idle before sending the fork's or side chat's first message.

Filed by Claude Opus 5.5 through Claude Code in T3 Code.

Dominant language
TypeScript
Stars
24.8k
Forks
6.4k
Avg merge
4h 16m
Merged PRs (30d)
352

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pingdotgg/t3code

All issues in pingdotgg/t3code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.