openai/codex · error · anyhow::Error
compaction install used thread , but codex turn belongs to
Error message
compaction install {compaction_id} used thread {thread_id}, but codex turn {codex_turn_id} belongs to {} What it means
Cross-reference guard in reduce_compaction_installed_event: the install's thread id exists but the referenced codex turn belongs to a different thread, so ownership is inconsistent. Mismatched thread/turn ids on the install event are the inputs at fault.
Solutions
- Correct the thread id or turn id recorded with the compaction install
- Fix the producer emitting inconsistent thread/turn pairs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/rollout-trace/src/reducer/compaction.rs:135 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/599a2876541847e4.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rollout-trace/src/reducer/compaction.rs:135
pub(super) fn reduce_compaction_installed_event(
&mut self,
wall_time_unix_ms: i64,
thread_id: String,
codex_turn_id: String,
compaction_id: String,
checkpoint_payload: RawPayloadRef,
) -> Result<()> {
if self.rollout.compactions.contains_key(&compaction_id) {
bail!("duplicate compaction install for {compaction_id}");
}
self.thread_mut(&thread_id)?;
let Some(turn) = self.rollout.codex_turns.get(&codex_turn_id) else {
bail!(
"compaction install {compaction_id} referenced unknown codex turn {codex_turn_id}"
);
};
if turn.thread_id != thread_id {
bail!(
"compaction install {compaction_id} used thread {thread_id}, but codex turn {codex_turn_id} belongs to {}",
turn.thread_id
);
}
let checkpoint = self.reduce_compaction_checkpoint(
wall_time_unix_ms,
&thread_id,
codex_turn_id.as_str(),
&compaction_id,
&checkpoint_payload,
)?;
let request_ids = self
.rollout
.compaction_requests
.values()
.filter(|request| request.compaction_id == compaction_id)
.map(|request| request.compaction_request_id.clone())
.collect();View on GitHub (pinned to 339751715c)