Skip to content

[Bug]: After /clear in a fork that hasn't run yet, every send fails #38630

Closed

Description

@viktorce

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. Open a thread that has at least one finished turn.
  2. Fork it, for example with Fork from this response. Don't send anything in the fork yet.
  3. In the fork, send /clear or pick it from the slash menu. The composer shows "Your next message starts a fresh session".
  4. Type a prompt and send it.

Expected behavior

The prompt starts a fresh provider session in the fork, as /clear does in any other thread. The fork's earlier messages stay visible, and the agent doesn't see them.

Actual behavior

The send fails with "A fresh session can't start while a fork or merge is still being applied." The prompt goes back into the composer and /clear stays armed, so every retry fails the same way until the notice is dismissed.

Impact

Minor bug or occasional failure

Version or commit

T3 Code (Beta) desktop 0.1.10. The code path is unchanged on main @ 055b449.

Environment

macOS 27.2.1 (Apple Silicon), desktop app with its local server, Claude Code 2.1.311, claudeAgent provider.

Logs or stack traces

# server.trace.ndjson: the fork's thread.fork succeeds, then each send after /clear is refused (4 attempts)
orchestrationV2.dispatch.threadFork       Success  command_type=thread.fork
ws.rpc.orchestration.dispatchCommand      Failure  command_type=message.dispatch
  OrchestrationV2DispatchCommandError: A fresh session can't start while a fork or merge is still being applied.

Diagnosis

  • /clear arms a fresh session in the client, and the next send carries freshContext: true.
  • A fork's context transfer stays pending until the fork's first run applies it, as a native fork or a portable handoff.
  • Orchestrator.ts refuses a freshContext send while a fork or merge-back transfer is pending. That refusal came with fresh sends in feat(server): sends can start a fresh provider session #30323. A fork that hasn't run yet always has a pending transfer, so the send is refused every time, not only during a short "still being applied" window. A fork whose first run failed before the fork resolved keeps its pending transfer too.
  • Web offers /clear once a thread shows messages, and a fork shows its inherited messages, so web offers /clear in exactly the state the server refuses. Mobile offers it once a thread has a run, so it gets there after a failed first run. MCP t3_thread_send with freshContext reaches the same refusal.
  • Two other cases hit the same check, and there the refusal looks right. A scheduled task in fresh-session mode starts a side conversation (isScheduledFreshRun), so dropping the fork's context would leave the user's first message in the fork without it. A pending merge-back, from Merge back on a fork or Bring back on a side chat, belongs to the next ordinary message, and an ordinary send still works. Its message could say that instead of "still being applied", but that's a separate fix.
  • A fix that starts the fresh session should also mark the fork transfer superseded, or the next ordinary send would bring the parent's context back. One rare case would remain: a fresh send queued behind the fork's first run, when that run fails before the fork resolves.

Screenshots, recordings, or supporting files

Demo data in dark mode. After /clear and a send in a fork that hasn't run yet, the send is refused, the prompt is back in the composer, and /clear is still armed.

The refused send in a fork after /clear

Workaround

Dismiss the notice with Keep the current session and send normally, then use /clear after the fork's first turn. Or start a new thread instead of forking.

Related

Investigated and filed with Claude Opus 5.5 in Claude Code, running in 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