{"record":{"id":"6b49c02308eb16c2","repo":"Hmbown/CodeWhale","slug":"user-input-request-has-an-indeterminate-termi","errorCode":null,"errorMessage":"User-input request '{}' has an indeterminate terminal receipt; inspect Runtime storage before completing turn '{turn_id}'","messagePattern":"User-input request '(.+?)' has an indeterminate terminal receipt; inspect Runtime storage before completing turn '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":5366,"sourceCode":"        let key = (thread_id.to_string(), input_id.to_string());\n        let mut pending = self.pending_user_inputs.lock();\n        if pending.get(&key).is_some_and(|entry| !entry.settling) {\n            pending.remove(&key);\n        }\n    }\n\n    fn claim_pending_user_inputs_for_turn(\n        &self,\n        thread_id: &str,\n        turn_id: &str,\n    ) -> Result<(Vec<PendingUserInputRequest>, Vec<watch::Receiver<u64>>)> {\n        let mut pending = self.pending_user_inputs.lock();\n        if let Some((_, entry)) = pending.iter().find(|((pending_thread_id, _), entry)| {\n            pending_thread_id == thread_id\n                && entry.request.turn_id == turn_id\n                && entry.indeterminate\n        }) {\n            bail!(\n                \"User-input request '{}' has an indeterminate terminal receipt; inspect Runtime storage before completing turn '{turn_id}'\",\n                entry.request.id\n            );\n        }\n        let mut claims = Vec::new();\n        let mut settling = Vec::new();\n        for ((pending_thread_id, _), entry) in pending.iter_mut() {\n            if pending_thread_id != thread_id || entry.request.turn_id != turn_id {\n                continue;\n            }\n            if entry.settling {\n                settling.push(entry.settlement_tx.subscribe());\n                continue;\n            }\n            entry.settling = true;\n            claims.push(entry.request.clone());\n        }\n        Ok((claims, settling))","sourceCodeStart":5348,"sourceCodeEnd":5384,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L5348-L5384","documentation":"When completing a turn that awaits user input, the Runtime checks pending_user_inputs for an entry marked indeterminate for this thread/turn. An indeterminate entry means the terminal receipt (whether the input request was actually answered/persisted) is unknown, so completing the turn is refused until storage is inspected.","triggerScenarios":"Calling the turn-completion path while a pending user-input request for the same thread_id and turn_id has entry.indeterminate == true (e.g. after a crash-recovery or uncertain write to Runtime storage).","commonSituations":"Recovering from a process crash mid user-input prompt; replaying turns after storage ambiguity; automation resuming turns without reconciling pending input records.","solutions":["Inspect Runtime storage to determine the actual terminal state of the named request ID from the message","Resolve or clear the indeterminate pending entry (confirm/cancel it) before retrying completion","Resume the turn through the documented recovery flow instead of the normal completion call"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before completing, check for indeterminate pending inputs for this thread/turn\nlet indeterminate = runtime.pending_user_inputs_indeterminate(thread_id, turn_id);","typeGuard":null,"tryCatchPattern":"match complete_turn(thread_id, turn_id) {\n    Err(e) if e.to_string().contains(\"indeterminate terminal receipt\") => {\n        let req_id = parse_request_id(&e);\n        reconcile_in_runtime_storage(req_id)?;\n        complete_turn(thread_id, turn_id)?;\n    }\n    other => other?,\n}","preventionTips":["After crash recovery, reconcile pending user-input records before resuming turns","Never bypass the documented recovery flow for ambiguous inputs","Log request IDs from error messages for storage inspection"],"tags":["user-input","recovery","state"],"backgroundTag":"invalid-state-transition","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}