{"record":{"id":"a98f7fce4bf68f02","repo":"openai/codex","slug":"compaction-request-referenced-unknown-codex-tur","errorCode":null,"errorMessage":"compaction request {} referenced unknown codex turn {}","messagePattern":"compaction request (.+?) referenced unknown codex turn (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rollout-trace/src/reducer/compaction.rs","lineNumber":39,"sourceCode":"    pub(super) fn start_compaction_request(\n        &mut self,\n        seq: RawEventSeq,\n        wall_time_unix_ms: i64,\n        started: StartedCompactionRequest,\n    ) -> Result<()> {\n        if self\n            .rollout\n            .compaction_requests\n            .contains_key(&started.compaction_request_id)\n        {\n            bail!(\n                \"duplicate compaction request start for {}\",\n                started.compaction_request_id\n            );\n        }\n        self.thread_mut(&started.thread_id)?;\n        let Some(turn) = self.rollout.codex_turns.get(&started.codex_turn_id) else {\n            bail!(\n                \"compaction request {} referenced unknown codex turn {}\",\n                started.compaction_request_id,\n                started.codex_turn_id\n            );\n        };\n        if turn.thread_id != started.thread_id {\n            bail!(\n                \"compaction request {} used thread {}, but codex turn {} belongs to {}\",\n                started.compaction_request_id,\n                started.thread_id,\n                started.codex_turn_id,\n                turn.thread_id\n            );\n        }\n\n        self.rollout.compaction_requests.insert(\n            started.compaction_request_id.clone(),\n            CompactionRequest {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rollout-trace/src/reducer/compaction.rs#L21-L57","documentation":"Referential guard in start_compaction_request: the compaction request references a codex turn id that is not present in the reduced rollout graph. The unknown codex_turn_id on the start event is the input at fault.","triggerScenarios":"Thrown at codex-rs/rollout-trace/src/reducer/compaction.rs:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the rollout for a missing turn record before the compaction request","Fix event ordering so turns precede compaction requests referencing them"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}