[Bug]: Forking a running Claude thread replaces native history with a context handoff
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 42/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- ai-infra-agents, backend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Use the Claude provider and let a turn finish.
- Send another message in that thread and leave it running.
- Fork from the finished turn, or open a side chat.
- 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
forkSessionhandle a source transcript that the running session is still appending to, including a half-written last line? - Is the fork's
upToMessageIdalways 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.
- Linguagem predominante
- TypeScript
- Estrelas
- 24.8k
- Forks
- 6.4k
- Merge médio
- 4h 16min
- PRs com merge (30d)
- 352
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de pingdotgg/t3code
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
Todas as issues de pingdotgg/t3code
Issues semelhantes
-
idea-scout idea:453
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
jeanibarz/agent-notebook#453 ·
Mantenedores costumam responder em até 1 dia
-
level/task
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 95/100
wazuh/wazuh-dashboard-plugins#9642 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 91/100
unicef/adt-studio#1112 ·
Mantenedores costumam responder em até 2 dias
-
feature request good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
TabularisDB/tabularis#1513 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100