Skip to main content

Module background_tasks

Module background_tasks 

Source
Expand description

Claude Code background tasks and print-mode turns (hive-mind#2301, #3015).

After the main thread goes idle, claude -p waits for background tasks (Agent, or Bash with run_in_background) up to CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS, then writes “Background tasks still running after 600s; terminating” to stderr and stops every task. The result event still says success, but the work is unfinished, so the run is incomplete and should be resumed.

Structs§

BackgroundTask
A background task that has not reported an end.
BackgroundTaskAssessment
Whether a print-mode turn ended with background work unfinished.
BackgroundTaskState
Background tasks and print-mode turn state over a message list.
StoppedBackgroundTask
A background task stopped while the main thread was idle.

Statics§

PRINT_BG_CEILING_PATTERN
Claude’s announcement that it stopped background tasks at its ceiling.

Functions§

assess_background_tasks
Decide whether a print-mode turn ended with background work unfinished.
extract_observed_models
Model ids a tool reports about itself (hive-mind#2840).
is_real_model_id
Whether a model id names a real model; <synthetic> does not.
print_wait_ceiling_seconds
Read the print-mode wait ceiling (seconds) from Claude’s stderr announcement.
track_background_tasks
Follow background tasks and the print-mode turn over a message list.