Skip to main content

Module background_shell

Module background_shell 

Source
Expand description

Explicit, in-process background jobs for ctx_shell.

The MCP request may complete immediately, but the child keeps the exact timeout, allow-list, path-jail and process-group policy of foreground shell execution. Jobs intentionally live in the daemon: restarting it invalidates outstanding jobs rather than silently orphaning subprocesses.

Enums§

ForegroundResult
Outcome of a foreground run that is allowed to detach on a soft cap.
JobState

Functions§

cancel
record_error_telemetry_once
Persist one aggregate for a terminal failed job, then mark that concrete retained job instance. A later execution may reuse the content-addressed ID, but replaces the Job and therefore starts with a fresh marker.
run_foreground_or_detach
Legacy tuple-shaped foreground result for existing callers.
running_count
Jobs whose command is still running. An idle MCP server with one of these is not idle: it holds the child and the output the agent will poll for.
start
status