openai/codex · error · anyhow::Error
terminal operation disappeared during observation linking
Error message
terminal operation {operation_id} disappeared during observation linking What it means
While linking terminal observations, the tool call's terminal_operation_id pointed at an operation no longer present in the registry — an internal dangling reference.
Solutions
- Keep terminal operations alive for the lifetime of their tool calls
- Skip observation linking when the operation is gone
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at codex-rs/rollout-trace/src/reducer/tool/terminal.rs:297 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/b9440440e836a398.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rollout-trace/src/reducer/tool/terminal.rs:297
/// 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_observations
.iter_mut()
.find(|observation| observation.source == TerminalObservationSource::DirectToolCall)
{
observation.call_item_ids = call_item_ids;
observation.output_item_ids = output_item_ids;
} else {
operation.model_observations.push(TerminalModelObservation {
call_item_ids,
output_item_ids,
source: TerminalObservationSource::DirectToolCall,
});
}View on GitHub (pinned to 339751715c)