Hmbown/CodeWhale · error

User-input request ' ' has an indeterminate terminal…

Error message

User-input request '{}' has an indeterminate terminal receipt; inspect Runtime storage before completing turn '{turn_id}'

What it means

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.

Solutions

  1. Inspect Runtime storage to determine the actual terminal state of the named request ID from the message
  2. Resolve or clear the indeterminate pending entry (confirm/cancel it) before retrying completion
  3. Resume the turn through the documented recovery flow instead of the normal completion call
Defensive patterns

Strategy: try-catch

Validate before calling

// before completing, check for indeterminate pending inputs for this thread/turn
let indeterminate = runtime.pending_user_inputs_indeterminate(thread_id, turn_id);

Try / catch

match complete_turn(thread_id, turn_id) {
    Err(e) if e.to_string().contains("indeterminate terminal receipt") => {
        let req_id = parse_request_id(&e);
        reconcile_in_runtime_storage(req_id)?;
        complete_turn(thread_id, turn_id)?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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).

Common situations: Recovering from a process crash mid user-input prompt; replaying turns after storage ambiguity; automation resuming turns without reconciling pending input records.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/6b49c02308eb16c2. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/runtime_threads.rs:5366

        let key = (thread_id.to_string(), input_id.to_string());
        let mut pending = self.pending_user_inputs.lock();
        if pending.get(&key).is_some_and(|entry| !entry.settling) {
            pending.remove(&key);
        }
    }

    fn claim_pending_user_inputs_for_turn(
        &self,
        thread_id: &str,
        turn_id: &str,
    ) -> Result<(Vec<PendingUserInputRequest>, Vec<watch::Receiver<u64>>)> {
        let mut pending = self.pending_user_inputs.lock();
        if let Some((_, entry)) = pending.iter().find(|((pending_thread_id, _), entry)| {
            pending_thread_id == thread_id
                && entry.request.turn_id == turn_id
                && entry.indeterminate
        }) {
            bail!(
                "User-input request '{}' has an indeterminate terminal receipt; inspect Runtime storage before completing turn '{turn_id}'",
                entry.request.id
            );
        }
        let mut claims = Vec::new();
        let mut settling = Vec::new();
        for ((pending_thread_id, _), entry) in pending.iter_mut() {
            if pending_thread_id != thread_id || entry.request.turn_id != turn_id {
                continue;
            }
            if entry.settling {
                settling.push(entry.settlement_tx.subscribe());
                continue;
            }
            entry.settling = true;
            claims.push(entry.request.clone());
        }
        Ok((claims, settling))

View on GitHub (pinned to 73e0f67d83)