Skip to content

API Reference parrot.flows.dev_loop.procs

github-actions[bot] edited this page Nov 5, 2026 · 4 revisions

parrot.flows.dev_loop.procs

View source

Bounded subprocess execution for the dev-loop kernels.

Every subprocess the sdd_coder engine spawns from an MCP request handler (git, ruff, black) used to be awaited with a bare proc.communicate(): no deadline, stdin inherited from the server (the JSON-RPC channel itself), and git free to open an editor or a credential prompt. A single hung child therefore pinned the handler forever, and because the stdio MCP server processed requests one at a time, every later call — read-only ones included — died at the MCP host's 30-minute idle timeout.

run_bounded is the one place that spawns those children now: own process group, stdin=DEVNULL, a wall-clock deadline that kills the whole owned tree, and a conventional 124 return code on expiry so callers keep their existing rc != 0 error paths.

Attribute DEFAULT_SUBPROCESS_TIMEOUT_S

Type: float

Attribute SPAWN_FAILED_RC

Type: int

Attribute TIMEOUT_RC

Type: int

Function git_env

Environment for a headless, never-prompting git child.

git_env(base: Optional[Mapping[str, str]] = None) -> Dict[str, str]

Parameter Type Default Description
base Optional[Mapping[str, str]] None Environment to start from; defaults to os.environ.

Returns: Dict[str, str] — A copy of base with every interactive git surface disabled: no terminal credential prompt, no editor (true accepts the default message), no pager, and no optional index-refresh locks so a concurrent session cannot make a read-only command fail or wait.

Function run_bounded

Run argv with a wall-clock deadline and return (rc, stdout, stderr).

On POSIX the child gets its own session (so it can neither reach a controlling terminal nor survive the deadline through a grandchild); on every platform its stdin is DEVNULL. When timeout_s elapses the whole process group is terminated and (124, "", <reason>) is returned; when the executable cannot be spawned (127, "", <reason>) is returned. Cancellation of the awaiting task also kills the child before propagating.

run_bounded(argv: Sequence[str], *, cwd: Optional[str] = None, timeout_s: float = DEFAULT_SUBPROCESS_TIMEOUT_S, env: Optional[Mapping[str, str]] = None) -> Tuple[int, str, str]

Parameter Type Default Description
argv Sequence[str] Program and arguments.
cwd Optional[str] None Working directory for the child.
timeout_s float DEFAULT_SUBPROCESS_TIMEOUT_S Wall-clock cap in seconds.
env Optional[Mapping[str, str]] None Environment for the child; inherits the server's when None.

Returns: Tuple[int, str, str] — (returncode, stdout, stderr) with both streams decoded as UTF-8 (undecodable bytes replaced).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally