Skip to content

A queued message disappears from the timeline when a server restart cancels its run after it started #41290

Closed

Description

@EtanHey

What happened

I came back to a long, idle Claude thread. T3 started its automatic idle compaction (a /compact message with idleCompaction: "onReturn", which t3_thread_read shows as created by system). Right after that I sent a long message: about 5.5k characters, 17 images, video attachments and a thread reference. The message went into the queue, and T3 skipped the compaction so it could send it. About 18 seconds later I ran the nightly update, which restarted the server and cancelled that run.

After the restart my message was gone from the timeline. The thread shows "Run interrupted before provider start", "Cancelled because the server shut down before the provider work completed", and then "T3 Code restarted and resumed this turn", with nothing in between. The message itself was never lost. It is stored, the agent received it in full (with attachment paths), and the agent acted on it in the continuation run. But it can't be seen, and thread search can't find it.

Diagnosis

The turn-item visibility rule hides a queued_turn user message whenever its run is cancelled:

// packages/shared/src/orchestrationV2Timeline.ts
// "…cancelled queued inputs stay hidden."
(status === "queued" || status === "cancelled") &&
  item.type === "user_message" &&
  item.inputIntent === "queued_turn"

That rule is for a queued input the user withdraws before it is sent. But cancelled is also the status a server shutdown gives a run that had already started: the provider got the message and the turn was cut short. Here, run 3467 had startedAt set (06:11:54), the provider received the message at 06:12:02, and server recovery marked the run cancelled at 06:12:11. The same rule is repeated in SQL: the snapshot window query, the hidden-row lookup in openLocalTimeline, both shell item-count queries, and the thread-search filter in ThreadSearch.ts. So the message is missing from every read: the timeline, t3_thread_read, history pages, the shell item count and search.

The server already treats "cancelled and never started" as the definition of a withdrawn queued input (NOT (status = 'cancelled' AND startedAt IS NULL) in the last-executed-run index), so startedAt is the natural way to tell the two cases apart.

Steps to reproduce

  1. Open a long Claude thread that has been idle long enough for T3 to auto-compact when you return to it (or send /compact).
  2. While the compaction is still queued or starting, send a normal message. It is queued as queued_turn, and T3 skips the compaction to send it.
  3. While that run is still in progress (after startedAt is set), restart the server, for example by updating the desktop nightly.
  4. After the restart, open the thread. The run is cancelled, a restart continuation resumes the turn, and the queued message is missing from the timeline and from search.

Expected: a message whose run started stays visible, as it does for interrupted or failed runs.

Version

0.1.12-nightly.20261123.5124 (desktop app and local server, same build; commit 2808e87). The rule is unchanged on main as of 58e309e.

Environment

macOS 27.0 (darwin arm64), T3 Code Desktop nightly with the local server, Node v24.22.1. Provider: Claude Agent (claude-fable-5-2). A long thread: about 3,450 runs and about 32,900 items.

Evidence

  • orchestration_v2_projection_runs:
    • 3466 (the idle compaction) is interrupted.
    • 3467 (my message) is cancelled, with startedAt 06:11:54.535Z and completedAt 06:12:11.893Z.
    • 3468 is completed, with restartContinuationOfRunId = 3467.
  • Run 3467's user_message turn item is in orchestration_v2_projection_turn_items and orchestration_v2_turn_item_positions. t3_thread_read (activity) skips it: the row for the 3466 interrupt result is followed directly by the 3467 server-recovery notice.
  • The Claude native session transcript has the message, delivered at 06:12:02 inside a delta_since_target_last_seen context handoff.
  • I ran the visibility function from the user's build and from a fixed branch on the real rows of runs 3466–3468. The build hides the 3467 user_message; the fixed branch shows it. Nothing else changes.

Related issues

Workaround

None in the UI. The message is still in orchestration_v2_projection_messages, and the agent did receive it.

Agent

Diagnosed and written by Claude Opus 5.5 (Claude Code, running in T3 Code) through t3 triage.

Activity

  1. EtanHey commented on Nov 23, 2026

    @EtanHey
    ContributorAuthor

    Follow-up from #41292, now closed:

    startedAt is the wrong way to tell a delivered message from a withdrawn one. A review found three problems with it:

    • Undelivered prompts would show. Older builds set startedAt before calling the provider, so a recovered cancelled run can have startedAt set without the prompt ever arriving. rewindUnacceptedRuns in ProviderRuntimeRecoveryService.ts already treats a provider turn on one of the run's attempts as the only proof of delivery. The visibility rule should use that same check.
    • Forks get inconsistent. In createInheritedTurnItemVisibility, a source rewind that turns the run into rolled_back with a cancelled attempt would hide the prompt in an existing fork that had shown it.
    • The rule has several copies. Besides the shared rule in orchestrationV2Timeline.ts, it lives in the snapshot window SQL, the openLocalTimeline hidden-row lookup, selectShellRunItemCounts and selectShellItemCounts (which must keep their covering status lookups), and ThreadSearch. The client re-filters visibleTurnItems with the shared rule, so it needs the provider turns for those runs as well.

    On the reporter's machine, 16 queued messages are hidden this way. Every one belongs to a cancelled run that has a provider turn, so all 16 were delivered.

    This touches the core visibility contract and needs an e2e scenario that restarts the server mid-turn, so I'm leaving the fix to the team instead of sending a larger outside PR.

    🤖 Claude (Opus 5.5) on behalf of Etan

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