Skip to content

[Bug]: A Claude resume rejected before the prompt leaves the handoff marker pending, so the next send swaps the session for a summary #34756

Closed

Description

@wawow830

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. Get a Claude thread into a state where query.open is rejected before Claude reads the prompt because the resume point is bad. Today the reliable way is [Bug]: Stopping a Claude turn mid-thinking and then reverting bricks the thread: the cursor names a thinking-only entry Claude Code drops on load #34753: stop a turn while Claude is still thinking after a tool result, then send a message and undo it.
  2. Send a message. It fails: Claude Code returns result { subtype: "error_during_execution", num_turns: 0, duration_ms: 0, errors: ["No message found with message.uuid of: …"] }.
  3. Repair the cause (fix the session file, or pick up a build with [Bug]: Stopping a Claude turn mid-thinking and then reverting bricks the thread: the cursor names a thinking-only entry Claude Code drops on load #34753's fix), then send again.

Expected behavior

The prompt was never read, so the native session's history is still certain. The next send resumes the original native session.

Actual behavior

The next send never tries the original session. ProviderTurnStartService logs Recovering provider context in a fresh native session with reason: "uncertain_history_delivery". It binds a brand-new Claude session and primes it with a full_thread_summary handoff: in my thread, 16 of 84 items and about 14k tokens instead of about 98k. The thread's nativeThreadRef then points at the new session for good, so repairing the original transcript can no longer bring back the full history without editing files by hand.

Cause. This is the same mechanism as #22198, with a different trigger.

  • Run 20's start saved a delta_since_target_last_seen handoff with delivery: { nativeThreadId: <original session>, status: "pending" }.
  • When the start fails, ProviderTurnStartService restores the marker (delivery.unsent) only if refusedBeforePrompt(error) is true.
  • PROMPT_REFUSAL_TAGS covers background-work replacement, launch-argument errors and the MCP registration timeout (fix(server): a Claude MCP registration timeout no longer discards the native session #22365), but not a resume that Claude Code rejects before any turn (num_turns: 0, duration_ms: 0).
  • So the marker stays pending, uncertainDelivery is true on the next send, and T3 skips resumeThread on purpose.

Suggested direction: when Claude Code ends a query open with a zero-turn error_during_execution result naming the resume point (No message found with message.uuid, and likely the other resume-target errors in the same CLI path), surface it as a tagged pre-prompt refusal and add the tag to PROMPT_REFUSAL_TAGS. The pending marker is then restored and the next send resumes natively. Clearing the bad resumeSessionAt pin at the same point would let the thread recover by itself instead of failing every send.

Impact

Major degradation or frequent failure

Version or commit

0.1.10-nightly.20261111.4544; code checked on main @ a41b882

Environment

Fedora Asahi Linux (aarch64), T3 Code desktop with local server, provider claudeAgent (claude-fable-5-2), Claude Code 2.1.322, @anthropic-ai/claude-agent-sdk ^0.3.321

Logs or stack traces

# Runs 19 and 20 (04:38:03 UTC), each rejected before any turn
query.open { resume: "44905028-…", resumeSessionAt: "caba13d4-…" }
result { subtype: "error_during_execution", is_error: true, num_turns: 0, duration_ms: 0, errors: ["No message found with message.uuid of: caba13d4-…"] }

# Run 21 (04:47:55 UTC), after the session file had been repaired
WARN Recovering provider context in a fresh native session { reason: "uncertain_history_delivery", errorTag: "ProviderAdapterTurnStartError" }
query.open { sessionId: "e2fa66ec-…" }   # no resume; full_thread_summary handoff, 16 of 84 items

Workaround

None in the app. I copied the original transcript (with the #34753 repair) into the new session's JSONL, rewriting each sessionId, so that resuming the new session id picks up the full history.

Related

#34753 (the trigger here), #22198 / #22365 (the same pending-marker mechanism for the MCP registration timeout), #28178 / #28195 (the fallback is now visible as a "Context handoff" divider; this issue is about the fallback firing when the history is certain).

Filed by

Claude Code (claude-opus-5-5) via T3 Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions