Skip to content

fix(server): Stop ends the agents' check-backs - #1057

Merged
badcuban merged 4 commits into
mainfrom
fix/stop-ends-check-backs
Nov 23, 2026
Merged

badcuban merged 4 commits into
mainfrom
fix/stop-ends-check-backs

Conversation

@badcuban

@badcuban badcuban commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Pressing Stop interrupted the turn but left the check-backs a Claude agent had set (ScheduleWakeup, CronCreate). A recurring one kept waking the agent and spending usage after the user pressed Stop.

Fix. The decider's thread.turn.interrupt now also emits thread.check-back-cancel-requested for every agent in the thread that holds a check-back, room agents included. The reactor's existing cancel handler stops that agent's runtime, the only way to drop a schedule from a live Claude CLI. This covers every user Stop (chat button, keybinding, command palette, phone) and outside agents' Stop, since they all send this command.

  • Background work. Ending the runtime also stops the commands and agents it left running. A first Stop normally spares them. Here it doesn't, because a runtime left alive keeps firing its check-backs.
  • Check-backs saved to the project. Threadlines can't delete them. Stop still ends their runtime so they don't fire now. They stay listed and come back the next time that agent runs.
  • thread_stop on a child (local or on a linked computer) now counts a check-back as work to stop, through a shared hasLiveCheckBack. Before, it answered not_running and left the check-back alive.
  • Check-backs set during the stopped turn. Claude reports its list only when a turn ends, and a stopped turn may never get there. The Claude adapter now publishes the list as soon as ScheduleWakeup, CronCreate or CronDelete returns, and Claude's own report at the turn's end replaces it. If that update lands just after Stop read the list, ingestion sees the session's pending Stop and cancels the new check-back.
  • Saved jobs before the first report. A fresh Claude runtime doesn't know the saved jobs it restored until its first end-of-turn report. Its updates before then are marked partial, and ingestion keeps the saved jobs already listed, so they don't drop off the Scheduled page.
  • Only runtimes that can hold check-backs. The cancel stops a runtime only if its provider sets check-backs (the checkBacks capability). A saved Claude job left on an agent that switched to Codex no longer stops the Codex runtime.
  • Removing a link now also stops a thread started over that link that has only a check-back.
  • Providers. Only Claude reports check-backs. Other drivers have nothing to cancel.

Known limits.

  • A thread_stop for a quiet child on a linked computer that has only a check-back answers not_running and leaves it. The status the other computer sends doesn't include check-backs. Sending the stop anyway could kill a turn the user starts there before a delayed stop arrives, and an older computer wouldn't stop it anyway. The fix is to add check-backs to that status, which changes the link protocol, so it's left for a follow-up. A stop for a working child does end its check-backs.
  • The late-update cancel covers the agent holding the thread. Other room agents' turns aren't interrupted by Stop, so a check-back one of them sets while its turn runs on isn't caught that way.
  • If an update that lands after Stop adds only a saved job, the cancel is refused, because Cancel never ends saved jobs. This needs Stop to land within milliseconds of a CronCreate that saves to the project.

The guide topics for scheduled tasks and child threads, the thread_stop tool description, and docs/design/child-threads.md now describe this.

Tested by a new reactor test: a room where both agents hold check-backs (one saved to the project, one agent running background work). Stop stops both runtimes. The test fails without the decider change. A new check-back module test covers the list as it changes when each tool returns. A new ingestion test covers a check-back reported after Stop for the stopped turn, which is cancelled, and a partial list, which keeps the saved job. A new reactor test covers a runtime whose provider sets no check-backs, which is left running. Each new test fails without its change.

agentContextBudget.json: on-demand tool definitions grow 17 bytes, for the thread_stop description saying a quiet child with only a check-back is stopped too.

@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 23, 2026 4:42pm UTC

Request Review

Pressing Stop interrupted the turn but left check-backs a Claude agent
set (ScheduleWakeup, CronCreate) alive in its runtime, so a recurring one
kept waking the agent and spending usage after the user stopped it.

The Stop decision now also requests a check-back cancel for every agent
in the thread that holds one, room agents included. The existing cancel
path stops that agent's runtime, the only way to drop a schedule, along
with background work it left running. Jobs saved to the project count
too: they would fire in that runtime; they stay listed and come back the
next time the agent runs.

thread_stop on a child, local or on a linked computer, now treats a
check-back as work to stop instead of answering not_running.
Claude reports its check-back list only when a turn ends, and a stopped
turn may never get there, so Stop missed a check-back set earlier in that
same turn. The adapter now publishes the list as soon as ScheduleWakeup,
CronCreate or CronDelete returns; Claude's report at the turn's end
replaces it whole.

thread_stop now counts any check-back, including one saved to the
project: in a room, the thread's single session doesn't show whether
another agent's runtime is still up. For a child on a linked computer,
the stop goes even when the child reads as idle, since only that
computer can see its check-backs, and it stops the child only if
something is still going.
…k-backs

- A check-back the stopped turn set, reported just after Stop read the
  list, is cancelled by ingestion while the session's Stop is pending.
- A fresh Claude runtime's updates before its first report are partial:
  ingestion keeps the saved jobs already listed instead of dropping them.
- The cancel stops a runtime only if its provider sets check-backs, so a
  saved Claude job on an agent now running Codex can't stop Codex.
- Removing a link stops a thread it started that has only a check-back.
- thread_stop no longer sends a stop to a quiet child on a linked
  computer: it could kill a turn started there before a delayed stop
  lands. A check-back-only linked child is a documented limit.
…description

thread_stop now says a quiet child with only a check-back counts as running and is stopped, and what happens for a child on a linked computer. That is 17 bytes, worth it so the agent knows a stop ends the child's check-backs.
@badcuban
badcuban force-pushed the fix/stop-ends-check-backs branch from c5ebc33 to 50c2016 Compare November 23, 2026 16:42
@badcuban
badcuban added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 66ab809 Nov 23, 2026
23 checks passed
@badcuban
badcuban deleted the fix/stop-ends-check-backs branch November 23, 2026 16:55

This branch was previously deployed

1 inactive deployment
Preview — 50c2016b Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant