Skip to content

[Bug]: Background-task wake-up run ends empty after T3 closes and reopens the Claude session; thread idles silently #38221

Closed as not planned

Description

@culfin

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

Self-hosted T3 server (macOS, desktop app), Claude provider (Claude Agent SDK). Intermittent: seen twice on one day, both in delegated child threads. The same pattern in the same thread woke correctly later the same day.

  1. In a Claude thread (here a delegated child), the agent starts a command with run_in_background (a CI watcher, a test script), immediately calls t3_background_wait with its task ID (accepted, task matched), and ends its turn.
  2. The background command finishes a few minutes later.
  3. The completion notice starts a new run in the thread (user message created by the provider: Background command "…" completed).

Expected behavior

The wake-up run delivers the completion notice to the model, and the agent continues (reads the output, goes on with its task).

Actual behavior

The wake-up run completes within 2–4 seconds with no assistant message (executedModel null, only an empty checkpoint item). The run status is completed, not failed. Nothing reaches the model, and nothing tells anyone. The thread then sits idle until a human sends a message (here about 9 hours).

The provider event log of the wake-up shows T3 closing the Claude session itself right after it opened, then reopening it, without re-sending the notice:

06:42:35.451  incoming  system/task_updated        status=completed
06:42:35.453  incoming  system/task_notification   status=completed
06:42:35.454  incoming  system/background_tasks_changed
06:42:36.416  incoming  system/init                (new run starts)
06:42:36.436  incoming  system/status              requesting
06:42:36.691  outgoing  query.close                <- 0.27 s after init
06:42:40.651  outgoing  query.open                 options.resume=<same session id>
06:42:40.651  incoming  system/hook_started …      SessionStart:resume hooks
06:42:40.691  run marked completed, no assistant message, no model call

The second case looks the same (run.completed 2 s after the wake-up, no assistant message).

Impact

Major degradation or frequent failure

Version or commit

T3 Code 0.1.9 (desktop)

Environment

macOS 27.0.1, Claude Code 2.1.326, model claude-opus-5-5.

Logs or stack traces

Pattern above, from the provider event log (logs/provider/events.<thread>.log). Relevant DB state after the lost wake-up: last run status = completed, its user message has creationSource = provider, and there is no assistant message with that run_id.

Workaround

An external watcher (every 5 min) looks for threads whose last run is a provider-sent message without an assistant reply, idle for 5 min, and sends the thread one message ("your background task finished, T3 ended the wake-up turn before you saw it…"). That message starts a normal run, which works. Waits expected to finish within ~9 minutes now run in the foreground with a timeout instead of run_in_background + t3_background_wait.

Possibly related, but a different path: #30156 (the provider process exits while the thread is idle, so no wake at all). Here the wake-up run does start and is emptied by the session close/reopen.

Activity

  1. juliusmarminge commented on Nov 17, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Commit ffc5bbf (origin/main). Started T3CODE_DEV_SEED=0 vp run dev in a fresh worktree (fresh database), added a scratch git project with t3 project add, then t3 thread start --provider claudeAgent --model claude-haiku-5-5 with a prompt to run sleep 25; echo DONE-MARKER via Bash with run_in_background, call t3_background_wait on the task id, and end the turn. Claude Code 2.1.326. Result: the turn ended with WAITING; ~25 s later the provider-started wake-up run delivered the notice and the agent replied WOKE DONE-MARKER. The provider event log showed no query.close or query.open around the wake. So the plain steps from the report do not reproduce. The report's log (close 0.27 s after the wake's system/init, then query.open with resume about 4 s later, then an empty completed run) needs an extra precondition. I could not create that precondition through the app: an earlier run in the thread that ended failed, interrupted or cancelled while its provider turn was still marked running, which makes the start of the next run 'recover' it by restarting the Claude runtime. Toggling the Linked environments setting during the wait could cause the same thing.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

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