{"record":{"id":"b925c07c5f468016","repo":"jlcodes99/cockpit-tools","slug":"codex-batch-delete","errorCode":null,"errorMessage":"[Codex Batch Delete] 查询任务进度失败:","messagePattern":"\\[Codex Batch Delete\\] 查询任务进度失败:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/pages/useCodexAccountsBaseController.tsx","lineNumber":755,"sourceCode":"      if (!jobId || batchDeleteJob.status !== \"running\") return;\n  \n      let disposed = false;\n      let timer: number | null = null;\n      const pollJob = async () => {\n        let shouldContinue = true;\n        try {\n          const nextJob = await codexService.getCodexBatchDelete(jobId);\n          if (disposed) return;\n          setBatchDeleteJob((current) =>\n            current?.jobId === jobId ? nextJob : current,\n          );\n          if (nextJob.completed > batchDeleteRefreshedCompletedRef.current) {\n            await refreshAccountsDuringBatchDelete();\n            batchDeleteRefreshedCompletedRef.current = nextJob.completed;\n          }\n          shouldContinue = nextJob.status === \"running\";\n        } catch (error) {\n          console.warn(\"[Codex Batch Delete] 查询任务进度失败:\", error);\n        }\n        if (!disposed && shouldContinue) {\n          timer = window.setTimeout(pollJob, 250);\n        }\n      };\n  \n      timer = window.setTimeout(pollJob, 100);\n      return () => {\n        disposed = true;\n        if (timer !== null) window.clearTimeout(timer);\n      };\n    }, [\n      batchDeleteJob?.jobId,\n      batchDeleteJob?.status,\n      refreshAccountsDuringBatchDelete,\n    ]);\n  \n    useEffect(() => {","sourceCodeStart":737,"sourceCodeEnd":773,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/pages/useCodexAccountsBaseController.tsx#L737-L773","documentation":"Not a thrown error: a console.warn inside the Codex batch-delete polling loop in useCodexAccountsBaseController. Each 250ms pollJob tick calls the backend job-progress API inside try/catch; if that single query fails (e.g. transient IPC/backend error), the loop logs the warning and simply retries on the next tick. The batch delete continues unless the failure persists.","triggerScenarios":"The pollJob timer fires and the promise resolving job progress (backend invoke / service call returning nextJob) rejects — backend process busy/restarting, IPC channel error, job already finished and cleaned up server-side.","commonSituations":"Deleting many Codex accounts in a batch while the backend is under load; rapid window operations suspending the webview timers; backend task record removed mid-poll so the progress query 404s/errors.","solutions":["No action needed for one-off occurrences — the loop retries automatically in 250ms.","If it fires repeatedly, verify the batch-delete backend task still exists and the progress query command is healthy.","Check backend logs at the same timestamp for the underlying cause (task not found, IPC failure).","Restart the app/backend process if progress queries persistently fail and the batch appears stuck.","Update to a build where progress-poll failures are surfaced in the batch-delete modal instead of only the console."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const nextJob = await queryBatchDeleteJobProgress(jobId);\n  // proceed\n} catch (error) {\n  console.warn('[Codex Batch Delete] 查询任务进度失败:', error);\n  // loop continues; consider a consecutive-failure counter to abort after N failures\n}","preventionTips":["Track consecutive poll failures and surface an error in the UI after a threshold instead of silently retrying forever.","Add a timeout to the job-progress query so a hung backend doesn't stall the loop.","Ensure the backend job record outlives the polling session (don't GC while clients poll)."],"tags":["ipc","polling","transient-failure","codex"],"backgroundTag":"background-task-poll-failure","analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}