openai/codex · error · anyhow::Error

sub-agent activity does not match tool call kind

Error message

sub-agent activity {:?} does not match tool call kind {tool_kind:?}

What it means

A sub-agent activity event kind (e.g. interacted) arrived paired with a tool call of a kind that does not produce such activity — the (tool kind, activity kind) pair has no reducer arm.

Solutions

  1. Fix the producer to emit activity kinds matching the tool kind
  2. Add a reducer arm for the new pairing if it is legitimate
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/rollout-trace/src/reducer/tool/agents.rs:238 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/ed1d9444835b6fde. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rollout-trace/src/reducer/tool/agents.rs:238

                    target_thread_id,
                    /*unresolved_spawn_thread_id*/ None,
                ),
            (ToolCallKind::SendMessage, SubAgentActivityKind::Interacted) => self
                .queue_sub_agent_activity_message_edge(
                    wall_time_unix_ms,
                    tool_call_id,
                    tool_edge_id(tool_call_id),
                    InteractionEdgeKind::SendMessage,
                    target_thread_id,
                    /*unresolved_spawn_thread_id*/ None,
                ),
            (ToolCallKind::CloseAgent, SubAgentActivityKind::Interrupted) => self
                .upsert_close_agent_interaction(
                    tool_call_id,
                    target_thread_id,
                    Some(wall_time_unix_ms),
                ),
            _ => bail!(
                "sub-agent activity {:?} does not match tool call kind {tool_kind:?}",
                payload.kind
            ),
        }
    }

    fn queue_sub_agent_activity_message_edge(
        &mut self,
        wall_time_unix_ms: i64,
        tool_call_id: &str,
        edge_id: String,
        edge_kind: InteractionEdgeKind,
        target_thread_id: String,
        unresolved_spawn_thread_id: Option<String>,
    ) -> Result<()> {
        let tool_call = self.rollout.tool_calls.get(tool_call_id).with_context(|| {
            format!("agent activity referenced unknown tool call {tool_call_id}")
        })?;

View on GitHub (pinned to 339751715c)