BigPizzaV3/CodexPlusPlus · error

Remote Control session recovery task failed

Error message

Remote Control session recovery task failed: {error}

What it means

run_remote_control_session_recovery collects recovery outcomes inside a spawned blocking/futures task; if that surrounding task itself fails to complete (panics or the JoinHandle errors), the launcher maps the JoinError to this error instead of returning per-request outcomes. It means the recovery batch never produced results to finalize.

Solutions

  1. Inspect the JoinError/panic payload for the root cause inside the recovery loop.
  2. Move per-request failures into outcomes (the loop already collects completion_error) instead of letting them panic the whole task.
  3. Run recovery before shutdown-sensitive teardown or make it cancel-tolerant.
  4. Check pending recovery files under the pending_remote_control_recovery path for malformed content that trips the panic.

Example fix

// before
let result = process(request).expect("recovery must succeed");
// after
let result = process(request).map_err(|e| tracing::warn!("recovery failed: {e}"));
Defensive patterns

Strategy: try-catch

Validate before calling

for (const req of pendingRecoveryRequests()) {
  if (!isValidRecoveryRequest(req)) { log.warn('dropping malformed recovery request', req); continue; }
}

Type guard

function isValidRecoveryRequest(r: unknown): r is RecoveryRequest {
  return typeof r === 'object' && r !== null && 'session_id' in r;
}

Try / catch

match run_remote_control_session_recovery().await {
    Err(e) if e.to_string().contains("recovery task failed") => { log::error!("batch failed: {e:#}"); /* fall back to per-request sequential recovery */ }
    other => other?,
}

Prevention

When it happens

Trigger: The spawned task that iterates Remote Control recovery requests panics or is dropped before returning outcomes — e.g. a panic while building/processing a request, or task cancellation during shutdown.

Common situations: A malformed recovery request causing an unwrap panic inside the loop; launcher shutdown racing recovery; dependency (DB/paths) in a state that makes the task panic rather than return Err per item.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/9a452ad04bc4095a. Report an issue: GitHub.

Appendix: source

Thrown at apps/codex-plus-launcher/src/main.rs:493

                    &request.target_provider,
                );
                let completed = result.status == codex_plus_data::ProviderSyncStatus::Synced;
                let completion_error = if completed {
                    codex_plus_core::remote_control_recovery::complete_pending_remote_control_recovery(
                        None,
                        &request.thread_id,
                    )
                    .err()
                    .map(|error| error.to_string())
                } else {
                    None
                };
                outcomes.push((request, result, completion_error));
            }
            Ok::<_, anyhow::Error>(outcomes)
        })
        .await
        .map_err(|error| anyhow::anyhow!("Remote Control session recovery task failed: {error}"))?;
        match outcomes {
            Ok(outcomes) => {
                for (request, result, completion_error) in outcomes {
                    let _ = codex_plus_core::diagnostic_log::append_diagnostic_log(
                        "launcher.remote_control_session_finalization",
                        json!({
                            "thread_id": request.thread_id,
                            "profile_id": request.profile_id,
                            "target_provider": request.target_provider,
                            "config_generation": request.config_generation,
                            "status": result.status,
                            "message": result.message,
                            "completion_error": completion_error
                        }),
                    );
                }
            }
            Err(error) => {

View on GitHub (pinned to b1ed92e5e4)