Skip to content

[Bug]: A server restart drops a Claude agent's background sleep timer, and the agent is never woken #37874

Done

Description

@josephv123

What happened

A Claude agent was monitoring overnight training jobs. After each check it started sleep 1740; date with run_in_background: true and ended its turn saying "I'll check again in 30 minutes". Claude woke it each time the timer finished, which worked for eight check-ins.

The nightly update then restarted the server at 00:55 UTC. Shutdown recorded the timer on the run's restartCancelledBackgroundWork without awaited:

22|completed|2026-11-17T00:46:03.169Z|[{"kind":"shell","label":"Wait 29 minutes before the next check (id b9zah5md0)","id":"b9zah5md0"}]

No continuation was queued, so the thread sat silent until the user sent "keep monitoring" 40 minutes later. Only then did the agent see the restart note: "The T3 server restarted, which killed my 30-minute check timer."

Cause

The restart note wakes the thread only for awaited work (isAwaitedWork in apps/server/src/orchestration-v2/RestartBackgroundNote.ts). A Claude background command is awaited only after the agent calls t3_background_wait. Agents rarely do, because Claude's own tool result already promises to notify them when the command completes. This agent made 23 turns and never called it.

#37085 closed the same gap for Claude monitors by marking new monitors as awaited. Background commands were left unmarked, because most of them are dev servers that shouldn't wake a thread. A command that starts with sleep is never a dev server: it's a timer the agent set to check back.

Steps to reproduce

  1. Start a Claude thread and ask it to run sleep 900; date with run_in_background: true, then end its turn.
  2. Restart the server, for example by applying an update, or by stopping t3 serve and starting it again.
  3. The timer is gone, and the thread is never woken. Its next turn starts only when you send a message.

Expected behavior

The thread wakes after the restart with the restart note, as it does for a monitor or a subagent, so the agent can restart its timer.

Version or commit

Nightly 0.1.10-nightly.20261116.4800; also reproduced on main at 1d20ad0.

Environment

Linux (Ubuntu 26.04), Claude Code 2.1.326, Claude Opus 5.5 and Haiku 5.5, t3 serve under systemd.

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