DeskTested

Trading tools, tested on a real desk.

Updated Oct 23, 2026Desk NotesClaims verified ✓Anthony M.

Trading Bot Stopped Running? Ours Died Silently and Acted on a Signal 3 Days Late

Our trading bot stopped running when its scheduler's session ended. Nothing alerted us, a daily signal was acted on 3 days late, and here is the fix.

A trading bot can stop running without a single error if its scheduler lives inside something that ends: an interactive session, a terminal, a laptop that sleeps. Ours did. A daily 200-day moving-average check ran on a session-scoped scheduler that died around 30 July 2026, and nothing reported it. When the rule fired at the 19 August close, it was acted on three days late.

This page covers what happened, why a dead scheduler can’t report its own death, and the fix the desk adopted: a cloud-scheduled, read-only watchdog. Everything here describes a monitoring incident from August 2026. No current positions, live signals, account values or P&L appear on this page, and nothing in it is trading advice.

What happened

The incident is recorded in the desk’s BTC journal, in the note on its 22 August 2026 rebalance row. Verbatim, with price levels redacted at ingestion and one figure cut by us (marked […]):

Missed flip: BTC crossed >200d SMA at 08-19 close ([REDACTED] vs [REDACTED]) but no daily check was running (session cron died ~07-30; CronCreate crons are session-scoped). Entered 3 days late […] — that slippage is the cost of the monitoring gap, logged honestly.

The cut in the quote is the journal’s own measure of what the gap cost: the distance between the price where the rule fired and the price where it was acted on. We’ve left that figure out, because next to BTC’s public closing price it would reveal the desk’s entry price. The delay is the part that matters here. The desk’s QLD journal records the same gap on the same date, and the fix.

Date (2026) What happened Days since the check last ran
~30 Jul The session hosting the daily check’s cron ends. The check stops running. 0
30 Jul → 19 Aug No daily check runs. Nothing reports that it stopped. 0 → 20
19 Aug, close The rule fires: BTC closes above its 200-day SMA. 20
22 Aug The missed flip is found and acted on, 3 days late. The check moves to a cloud-scheduled, read-only watchdog. 23

Bar chart of the August 2026 monitoring gap: about 20 days with no daily check running before the signal fired, then 3 more days before it was acted on

The three days are what showed up in the journal. The 20 days before them are the real failure: the check was dead for almost three weeks, and the first anyone knew of it was a signal it had missed.

Why nothing reported it

The scheduler was Claude Code’s CronCreate, which ran the check inside a Claude Code session. Anthropic’s scheduled tasks documentation, read on 22 October 2026, states the constraint directly:

Tasks are session-scoped.

Tasks only fire while Claude Code is running and idle. Closing the terminal or letting the session exit stops them firing.

No catch-up for missed fires.

The same page says recurring tasks “automatically expire 7 days after creation”, and that a task restored on resume “doesn’t fire for the runs it missed while the session wasn’t running”. So the documentation names two ways a recurring job ends: the session ends, or the task reaches its seven-day expiry. The journal says the session cron died. It doesn’t say which of these caused it, and we don’t guess.

Either way the failure looks the same from outside. A job that never runs raises no error, writes no log line and sends no alert, because everything that would have reported the problem was part of the job. Alerts built on what a job says can’t catch a job that says nothing. The only reliable signal is an absence, and something else has to be watching for it.

The fix: a watchdog that lives somewhere else

The desk moved the check to a cloud-scheduled, read-only watchdog that flags signal changes, as the QLD journal’s 22 August row records it. Two properties matter.

It’s cloud-scheduled. Its schedule no longer depends on a session staying open or a machine staying awake. The same documentation compares Claude Code’s three scheduling options:

Scheduling option Requires machine on Requires open session Persistent across restarts Minimum interval
Cloud No No Yes 1 hour
Desktop Yes No Yes 1 minute when Claude sets it, 1 hour in the forms
/loop (session-scoped) Yes Yes Restored on --resume, with exceptions 1 minute

For a check that runs once a day, the cloud option’s one-hour minimum interval costs nothing. Its tip is plain: “Use cloud tasks for work that should run reliably without your machine.”

It’s read-only. The watchdog flags a change. It doesn’t place an order. A job that runs unattended on infrastructure you don’t watch should be able to do as little as possible when it goes wrong. That’s the bound-the-blast-radius guardrail from running an autonomous trading agent.

A heartbeat turns silence into an alert

Moving the scheduler reduces how often a job dies. It doesn’t make death visible. The general pattern for that, sometimes called a dead man’s switch, has two parts: the job records a timestamp every time it runs, and a checker on different infrastructure alerts when that record goes stale. Here it is, replayed against the incident’s dates:

# Illustrative, not the desk's code. The scheduled job records a timestamp every
# time it runs; a checker on *different* infrastructure alerts when that record is
# older than one interval plus a grace period.
from datetime import datetime, timedelta

def heartbeat_alert(last_run, now, interval=timedelta(days=1), grace=timedelta(hours=6)):
    age = now - last_run
    return f"STALE: last run {last_run:%Y-%m-%d}, {age.days} days ago" if age > interval + grace else "ok"

# The watchdog compares state with the last state it recorded, so a flip is still
# caught after missed runs. A "did it cross today?" test misses it once the day passes.
def flipped(last_known_above, close, sma200):
    return (close > sma200) != last_known_above

# Replaying the incident with the journal's approximate date for the last run.
last_run = datetime(2026, 7, 30)
for day in ["2026-07-31", "2026-08-01", "2026-08-19", "2026-08-22"]:
    print(day, heartbeat_alert(last_run, datetime.fromisoformat(day)))
# 2026-07-31 ok
# 2026-08-01 STALE: last run 2026-07-30, 2 days ago
# 2026-08-19 STALE: last run 2026-07-30, 20 days ago
# 2026-08-22 STALE: last run 2026-07-30, 23 days ago

In this replay, with a one-day interval and a six-hour grace period, the alert fires on 1 August, 18 days before the signal. The flipped function covers the other half. The documentation says missed fires aren’t caught up, so a rule that asks “did price cross today?” loses a crossing that happened while the job was down. A rule that compares today’s state with the last recorded state still finds it on the next run.

The checker has to live somewhere the job doesn’t. A heartbeat checked by the same session that hosts the job dies with it.

Checks for any unattended trading job

  1. Know what ends your scheduler. Session exit, terminal close, machine sleep, a fixed expiry: find each one in your scheduler’s own documentation.
  2. Alert on absence, not just on errors. Record a heartbeat on every run, and check it from somewhere else.
  3. Compare states, not events. A missed run then delays a signal instead of losing it.
  4. Keep watchdogs read-only. Flag the change, and let a person or a separately guarded process act on it.
  5. Write down what a gap cost. The journal priced this one in the same row that logged the miss, as the distance between where the rule fired and where it was acted on.

Frequently asked questions

Why did my trading bot stop running without an error?

If there’s no error, check the scheduler before the bot: a session that closed, a terminal that was shut, a machine that slept, or a recurring task that expired. A job that never starts can’t raise an error. Ours ran on a session-scoped scheduler that died around 30 July 2026, and nothing reported it until a missed signal surfaced 23 days later.

What is a heartbeat check for a trading bot?

The bot records a timestamp each time it runs, and a separate checker on different infrastructure alerts when that timestamp is older than the expected interval plus a grace period. It turns a silent failure, a job that didn’t run, into an alert.

Do Claude Code scheduled tasks keep running after the session closes?

Not the session-scoped ones. Anthropic’s documentation, read 22 October 2026, says they “only fire while Claude Code is running and idle”, that missed fires aren’t caught up, and that recurring tasks expire after 7 days. It lists cloud scheduled tasks, Desktop scheduled tasks and GitHub Actions for work that has to survive a session.

How do I know if my trading bot missed a signal?

Compare the rule’s current state with the last state your bot acted on, not just today’s crossing. If they differ and the bot didn’t act, a signal was missed. A stale heartbeat tells you sooner, because it fires before the next signal does.


Sources: the desk’s BTC and QLD journals, 22 August 2026 rows, via pipeline/desk-log/2026-W42.md (price levels redacted at ingestion). Claude Code scheduled tasks documentation, code.claude.com/docs/en/scheduled-tasks, read 22 October 2026; behaviour may differ from July 2026. This page describes a past monitoring incident. It isn’t a trading result, a signal or advice.