jlcodes99/cockpit-tools · warning
[Codex Batch Delete] 查询任务进度失败:
Error message
[Codex Batch Delete] 查询任务进度失败:
What it means
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.
Source
Thrown at src/pages/useCodexAccountsBaseController.tsx:755
if (!jobId || batchDeleteJob.status !== "running") return;
let disposed = false;
let timer: number | null = null;
const pollJob = async () => {
let shouldContinue = true;
try {
const nextJob = await codexService.getCodexBatchDelete(jobId);
if (disposed) return;
setBatchDeleteJob((current) =>
current?.jobId === jobId ? nextJob : current,
);
if (nextJob.completed > batchDeleteRefreshedCompletedRef.current) {
await refreshAccountsDuringBatchDelete();
batchDeleteRefreshedCompletedRef.current = nextJob.completed;
}
shouldContinue = nextJob.status === "running";
} catch (error) {
console.warn("[Codex Batch Delete] 查询任务进度失败:", error);
}
if (!disposed && shouldContinue) {
timer = window.setTimeout(pollJob, 250);
}
};
timer = window.setTimeout(pollJob, 100);
return () => {
disposed = true;
if (timer !== null) window.clearTimeout(timer);
};
}, [
batchDeleteJob?.jobId,
batchDeleteJob?.status,
refreshAccountsDuringBatchDelete,
]);
useEffect(() => {View on GitHub (pinned to 1ed8b77992)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const nextJob = await queryBatchDeleteJobProgress(jobId);
// proceed
} catch (error) {
console.warn('[Codex Batch Delete] 查询任务进度失败:', error);
// loop continues; consider a consecutive-failure counter to abort after N failures
} Prevention
- 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).
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to resolve Codex API service current marker:
- 加载 Codex API 服务速度失败:
- [Codex Store] 自动恢复接管失败:
- messages.rawLineNoRefreshToken(item.lineNumber)
- messages.rawLineMultipleRefreshTokens(item.lineNumber)
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/b925c07c5f468016.
Report an issue: GitHub.