Expand description
Agent completion detection — parses DEVFLOW_RESULT markers and evaluates exit codes to determine whether a coding agent succeeded or failed.
Four-layer decision engine: 0. Run operator-authored external post-condition probes (authoritative failure)
- Parse DEVFLOW_RESULT from agent stdout (authoritative for ordinary plans)
- Exit code + commit count gate (reliable fallback)
- Process gone + commits exist (last resort warning)
Structs§
- Agent
Result - Parsed agent completion result.
- Sequentagent
Slot - A
sequentagentslot record: which slot (A/B) is currently running, and whichcrate::state::AgentKindoccupies it. Path-free by construction (WR-02) — only the slot letter and agent kind are ever written, never a filesystem path or OS username.
Enums§
- Agent
Status - Agent completion status determined by DevFlow.
- Result
Error - Errors produced by agent result evaluation.
- Sequentagent
Slot Kind - Which slot of
sequentagent’s two-agent handoff is currently running. - Verdict
- The Validate stage’s self-reported verdict (13b verdict-vs-ran split).
Functions§
- agent_
pid_ path - Path to the file where the monitor records the launched agent’s PID.
- archive_
phase_ files - Archive the prior stage’s stdout/exit captures into bounded per-phase
history instead of wiping them outright, so a false-positive self-report
can be diagnosed after the fact (16b). Replaces the old
cleanup_phase_files, which deleted these files unconditionally. - clear_
sequentagent_ slot - Best-effort removal of the
sequentagentslot record forphase. A missing file is not an error — this is called unconditionally bySequentagentSlotGuard’sDropimpl inparallel.rs, on everysequentagentexit path. - detect_
rate_ limit - Detect agent-specific rate-limit output and return the retry description.
- evaluate_
agent_ result - Full four-layer evaluation: returns the best available AgentResult.
- evaluate_
layer1 - Layer 1: Try to detect agent result from the native per-adapter envelope or the DEVFLOW_RESULT marker in stdout.
- evaluate_
layer2 - Layer 2: Use exit code + commit count to determine result.
- evaluate_
layer3 - Layer 3: Last resort — agent process is gone.
- exit_
code_ path - Path to the exit code file for a given phase.
- history_
dir - Path to the archived-capture-history directory for a phase (16b).
- parse_
devflow_ result - Search stdout for a DEVFLOW_RESULT marker.
- read_
sequentagent_ slot - Read the
sequentagentslot record forphase, if present. - sequentagent_
slot_ path - Path to the
sequentagentslot record for a given phase — mirrorsagent_pid_path’s naming convention. - stderr_
path - Path where the agent’s stderr is captured for a given phase.
Lives alongside
stdout_pathunder.devflow/. - stdout_
path - Path to the stdout file for a given phase.
- write_
sequentagent_ slot - Write the
sequentagentslot record forphase, naming the currently running agent slot (A/B) and itscrate::state::AgentKind.