openai/codex · error · anyhow::Error
tool call disappeared during terminal observation linking
Error message
tool call {tool_call_id} disappeared during terminal observation linking What it means
While mirroring model-visible items onto the terminal observation view, the referenced tool call vanished from rollout.tool_calls mid-reduction — an internal state-consistency break.
Solutions
- Audit code paths that remove tool calls during linking
- Re-insert or look up the tool call lazily
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at codex-rs/rollout-trace/src/reducer/tool/terminal.rs:285 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/454f32302f26dda2.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rollout-trace/src/reducer/tool/terminal.rs:285
bail!(
"terminal session {terminal_id} belongs to thread {}, not {thread_id}",
session.thread_id
);
}
push_unique(&mut session.operation_ids, operation_id);
Ok(())
}
/// Mirrors model-visible tool items onto the terminal observation view.
///
/// Runtime terminal rows are useful on their own, but the model-visible call
/// and output item ids let viewers jump between transcript and terminal timelines.
pub(in crate::reducer) fn sync_terminal_model_observation(
&mut self,
tool_call_id: &str,
) -> Result<()> {
let Some(tool_call) = self.rollout.tool_calls.get(tool_call_id) else {
bail!("tool call {tool_call_id} disappeared during terminal observation linking");
};
let Some(operation_id) = tool_call.terminal_operation_id.clone() else {
return Ok(());
};
let call_item_ids = tool_call.model_visible_call_item_ids.clone();
let output_item_ids = tool_call.model_visible_output_item_ids.clone();
if call_item_ids.is_empty() && output_item_ids.is_empty() {
return Ok(());
}
let Some(operation) = self.rollout.terminal_operations.get_mut(&operation_id) else {
bail!("terminal operation {operation_id} disappeared during observation linking");
};
// A terminal result and a model-visible tool output are intentionally
// separate: the former is what the runtime saw, the latter is what later
// inference payloads prove was shown back to the model.
if let Some(observation) = operation
.model_observationsView on GitHub (pinned to 339751715c)