Skip to content

[Bug]: After Merge back, every /clear send in the parent thread fails #38728

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 with Fork from this response, send one message in the fork, and let it finish.
  3. In the fork's Lineage list, use Merge back to the parent. The app opens the parent.
  4. In the parent, send /clear, then type a prompt and send it.

Expected behavior

/clear says the next message starts a fresh session in the same thread. Either the send starts one, or the composer says what to do first, such as sending a normal message so the merged context lands.

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. Waiting doesn't help, because nothing is being applied. The merged context waits for the next ordinary message.

Impact

Minor bug or occasional failure

Version or commit

main @ f3b168b, web app.

Environment

macOS 27.2.1 (Apple Silicon), the web app from vp run dev through the scenario harness, with the replay provider. Bring back on a side chat sends the same thread.merge_back command, so it should behave the same, but I only ran Merge back.

Logs or stack traces

# scenario run on main @ f3b168b9f, demo data
Earlier work: Fork from this response, then send "second" in the fork and wait for its reply
Fork: Merge back to Earlier work
Earlier work: /clear, then send "Start over"
toast: A fresh session can't start while a fork or merge is still being applied.

Diagnosis

  • Orchestrator.ts refuses a freshContext send while a merge-back transfer targets the thread. The check came with fresh sends in feat(server): sends can start a fresh provider session #30323.
  • The refusal itself looks deliberate. A merge-back belongs to the next ordinary message, as docs/user/thread-sidebar.md promises for Bring back, and starting a fresh session first would drop it without telling anyone.
  • The way out is what's broken. The message says the merge is "still being applied", but nothing runs until an ordinary send. The web composer restores the prompt and keeps /clear armed after the refusal, so a retry can't succeed.
  • Possible fixes, for whoever picks this up: word the refusal as what to do, for example sending a message without /clear first; disarm /clear when this refusal comes back; or ask before a fresh session drops the merged context.
  • The same refusal, with the same wording, also comes back for a scheduled task in fresh-session mode that fires into a fork that hasn't run yet. Nothing retries there, but "still being applied" is just as wrong, and a reworded message should cover it too.
  • The fix for [Bug]: After /clear in a fork that hasn't run yet, every send fails #38630 keeps this refusal for a fresh send in a side chat while its fork is pending, because a side chat's first message carries a digest of the parent that a fresh session must not inherit. So /clear in a side chat whose first run failed gets stuck the same way. A fresh send that waited in the queue there does start, on main too, but it still receives the side chat's first-message note, with its digest of the parent.
  • [Bug]: After /clear in a fork that hasn't run yet, every send fails #38630 is the same refusal in a fork that hasn't run yet. Fixing that case doesn't need to change this one, so the two can be fixed separately.

Screenshots, recordings, or supporting files

Demo data in dark mode, on main @ f3b168b. After Merge back and a send with /clear armed, the send is refused, the prompt is back in the composer, and /clear is still armed.

The refused send after Merge back, with the prompt back in the composer and /clear still armed

Workaround

Dismiss the notice above the composer, send a normal message so the merged context lands, then use /clear.

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