pub fn parse_session_output(
task_id: &str,
agent_name: &str,
agent_runner: &dyn AgentRunner,
session_output: &SessionOutput,
) -> Result<ParsedResponse, AgentError>Expand description
Parse session output, handling the kimi/minimax/glm exit-1-with-completed-edge case.
Tries parse_success_output first when stdout is non-empty. If that succeeds,
returns success regardless of exit code. If it fails and exit_code != 0,
checks for "terminal_reason":"completed" or cost-telemetry-only stdout
("costUSD":) in stdout before falling back to classify_error — so valid
sessions that exit 1 produce InvalidResponse (soft error, re-route) instead
of a garbled Unknown/Auth error (hard failure with spurious cooldown).