{"record":{"id":"9a452ad04bc4095a","repo":"BigPizzaV3/CodexPlusPlus","slug":"remote-control-session-recovery-task-failed-erro","errorCode":null,"errorMessage":"Remote Control session recovery task failed: {error}","messagePattern":"Remote Control session recovery task failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/codex-plus-launcher/src/main.rs","lineNumber":493,"sourceCode":"                    &request.target_provider,\n                );\n                let completed = result.status == codex_plus_data::ProviderSyncStatus::Synced;\n                let completion_error = if completed {\n                    codex_plus_core::remote_control_recovery::complete_pending_remote_control_recovery(\n                        None,\n                        &request.thread_id,\n                    )\n                    .err()\n                    .map(|error| error.to_string())\n                } else {\n                    None\n                };\n                outcomes.push((request, result, completion_error));\n            }\n            Ok::<_, anyhow::Error>(outcomes)\n        })\n        .await\n        .map_err(|error| anyhow::anyhow!(\"Remote Control session recovery task failed: {error}\"))?;\n        match outcomes {\n            Ok(outcomes) => {\n                for (request, result, completion_error) in outcomes {\n                    let _ = codex_plus_core::diagnostic_log::append_diagnostic_log(\n                        \"launcher.remote_control_session_finalization\",\n                        json!({\n                            \"thread_id\": request.thread_id,\n                            \"profile_id\": request.profile_id,\n                            \"target_provider\": request.target_provider,\n                            \"config_generation\": request.config_generation,\n                            \"status\": result.status,\n                            \"message\": result.message,\n                            \"completion_error\": completion_error\n                        }),\n                    );\n                }\n            }\n            Err(error) => {","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/apps/codex-plus-launcher/src/main.rs#L475-L511","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the JoinError/panic payload for the root cause inside the recovery loop.","Move per-request failures into outcomes (the loop already collects completion_error) instead of letting them panic the whole task.","Run recovery before shutdown-sensitive teardown or make it cancel-tolerant.","Check pending recovery files under the pending_remote_control_recovery path for malformed content that trips the panic."],"exampleFix":"// before\nlet result = process(request).expect(\"recovery must succeed\");\n// after\nlet result = process(request).map_err(|e| tracing::warn!(\"recovery failed: {e}\"));\n","handlingStrategy":"try-catch","validationCode":"for (const req of pendingRecoveryRequests()) {\n  if (!isValidRecoveryRequest(req)) { log.warn('dropping malformed recovery request', req); continue; }\n}","typeGuard":"function isValidRecoveryRequest(r: unknown): r is RecoveryRequest {\n  return typeof r === 'object' && r !== null && 'session_id' in r;\n}","tryCatchPattern":"match run_remote_control_session_recovery().await {\n    Err(e) if e.to_string().contains(\"recovery task failed\") => { log::error!(\"batch failed: {e:#}\"); /* fall back to per-request sequential recovery */ }\n    other => other?,\n}","preventionTips":["Validate recovery request files before processing; skip malformed ones per-item.","Collect per-request errors in outcomes instead of panicking the batch task.","Validate payloads written to the pending recovery directory at write time."],"tags":["tokio","panic","recovery","task"],"backgroundTag":"internal-invariant-violation","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}