Expand description
Background monitor daemon.
Spawns a detached child process that owns the coding agent: it launches
the agent, captures its stdout and exit code into .devflow/, and — when
the agent exits — runs devflow advance to advance the stage machine.
Owning the agent is the key fix over a CLI-scoped capture thread: because
the monitor outlives devflow start, the agent’s stdout keeps flowing into
the capture file and its exit code is still reaped after the CLI exits.
This is the core automation primitive — no cron, no scheduler, no agent cooperation needed.
Structs§
- Close
Rule - Idle
Timeout Setting - A resolved idle timeout together with how it was arrived at.
Enums§
- Idle
Timeout Resolution - How
parse_idle_timeout_secsarrived at the timeout now in force. - Monitor
Error - Errors produced by monitor operations.
- Monitor
Launch - Which supervision shape
spawn_monitorshould launch.
Constants§
- DEFAULT_
IDLE_ TIMEOUT_ SECS - Idle-timeout default in seconds (D-02): the measured constraint-8 floor.
- IDLE_
TIMEOUT_ ENV - The environment variable that raises the idle timeout above its floor.
- IDLE_
TIMEOUT_ FLOOR_ SECS - The floor an idle timeout can never be configured below (D-02/D-04, 31-02).
- MAX_
IDLE_ EXTENSIONS_ WITH_ TASKS_ OPEN - How many consecutive idle windows the monitor will wait through while a background task is known to be outstanding, before treating the silence as a hang after all.
Functions§
- idle_
timeout_ setting - The thin environment wrapper over
parse_idle_timeout_secs. - parse_
idle_ timeout_ secs - Resolve a raw idle-timeout override into the value actually in force.
- run_
pipe_ owning_ monitor - Supervise a
stream-jsonchild, owning both of its pipes, until the close rule is satisfied and the child exits. Returns the child’s exit code, which is also written to the phase exit file. - spawn_
monitor - Spawn a background monitor that owns the agent for the given workflow state.
- user_
turn_ line - The single place the stdin wire shape is constructed: one line of JSON
carrying the initial user turn for a
--input-format stream-jsonchild. - wait_
for_ agent_ pid - Poll for the agent PID that the monitor records, for up to ~1 second.