Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Claude fork falls back to a fresh session because the provider-thread key stays native-thread:pending after the native id is recorded #45988

Openkezd088(GitHub profile, opens in a new tab) opened this issue 3 comments

Summary

Native fork of a Claude thread fails and falls back to "Started a fresh session with its history", even though T3 has already recorded the real Claude session id for the source thread. The provider-thread row keeps its native-thread:pending:... placeholder as its primary key after the native id is learned, and fork appears to look the source session up by that key.

Environment

  • T3 Code (Beta) 0.1.13, macOS, local server
  • Provider: Claude (claudeAgent)

Steps to reproduce

  1. Run a Claude thread for a few turns (seen both on threads opened with t3_thread_launch and on threads created by hand in the UI).
  2. Fork it.

Expected

Native fork from the recorded Claude session.

Actual

The fork error names the source as native-thread:pending:run:thread:<id>:ordinal:1, and T3 falls back to a fresh session with the history passed as text. The first turn loses prompt cache and tool-call detail.

Evidence (read-only queries on statev2.sqlite)

orchestration_v2_projection_provider_threads, provider_instance_id = 'claudeAgent':

count
rows588
provider_thread_id still ...native-thread:pending%3Arun%3A...579
of those, payload_json.nativeThreadRef = {"driver":"claudeAgent","nativeId":"<uuid>","strength":"strong"}578

The source thread in the failing fork had run 9 turns; its nativeThreadRef.nativeId pointed at an existing, intact Claude session file, so the session itself was forkable.

Likely cause (inferred from the ids, not from source)

When the native id is learned and nativeThreadRef becomes strong, the row's provider_thread_id is not re-keyed from the pending placeholder, and the fork path resolves the source by provider_thread_id rather than nativeThreadRef.nativeId.

  1. tanstack-source added labelsbug

  2. @kezd088 Did you fork from the latest response or an earlier one, and did the response you forked from (or any turn after it) end interrupted, failed, or without a text reply? If you can, please also paste the full text of the "Could not fork the source conversation natively (...)" notice.

  3. juliusmarminge added labelsneeds more info

  4. I checked the placeholder-key hypothesis on main@59c38681ca using the Windows adapter test and a temporary Claude transcript. The source row had a real strong nativeThreadRef and a native-thread:pending:… key derived by T3's allocator.

    • With a recorded assistant message cursor, the native fork succeeded. The SDK received the UUID from nativeThreadRef.nativeId and the recorded cursor as upToMessageId. The returned transcript included the source answer.
    • With the same source row and transcript, replacing only the earlier turn's cursor with a synthetic turn:… value made the adapter reject the fork before calling the SDK when a later turn existed. The underlying cause was “no SDK assistant message cursor was recorded for that turn.”

    The session lookup reads the stored native UUID. The fork error includes the T3 provider-thread key for diagnostics. Seeing the pending key in the notice is consistent with either outcome. The local test narrows the cause without establishing which branch the reported macOS session took.

  5. juliusmarminge removed labelsneeds more info

  6. @kezd088 Did you fork from the latest response or an earlier one, and did that response or any turn after it end interrupted, failed, or without a text reply? Please also paste the server log line for the failed fork. The 'Native fork failed' notice shows only the generic 'Failed to fork claudeAgent provider thread ' text, not the actual reason.

  7. juliusmarminge added labelsneeds more info

Sign in to join this conversation.