Skip to main content

classify_last_error_source

Function classify_last_error_source 

Source
fn classify_last_error_source(message: &str) -> &'static str
Expand description

Best-effort classification of which pre-spawn failure path wrote a persisted error_during_execution frame, inferred from the message text itself (each construction site’s message is distinct and stable — see identity/resolver/errors.rs’s SpawnGateError::Display, subprocess/container_spawn.rs, subprocess/host_spawn.rs, and agent_handlers/input.rs’s container ensure_running path, the only four call sites that build this frame today). message should have the [AgentMux] prefix already stripped.

codex P2, PR #2802: SpawnGateError::AmbientHomeDirNotAllowed’s wording starts with “this agent’s”, not either prefix this function originally recognized — without this branch every ambient-home refusal reported unknown instead of identity, regressing this diagnostic for exactly the pre-spawn refusal case it exists to classify.

ReAgent P2, PR #2854: same regression again for SpawnGateError::ClaudeMdSeedFailed (a newer variant, wording starts with “could not isolate this agent’s”) — this function needs a new branch every time a SpawnGateError variant with distinct wording is added, since it infers the source from message text rather than the error’s own type. A future variant will hit the same gap again unless this doc comment (and the parallel test below) are kept in sync.