{"record":{"id":"e9dd9a780fce39e8","repo":"stablyai/orca","slug":"codex-trust-grant-entry-killed-by-spawned-signal","errorCode":null,"errorMessage":"codex trust-grant entry killed by ${spawned.signal} after ${request.invocation.timeoutMs}ms deadline","messagePattern":"codex trust-grant entry killed by (.+?) after (.+?)ms deadline","errorType":"exception","errorClass":"CodexAppServerTimeoutError","httpStatus":null,"severity":"error","filePath":"src/main/codex/codex-app-server-grant-bridge.ts","lineNumber":113,"sourceCode":"    timeout:\n      request.invocation.timeoutMs + (options.timeoutMarginMs ?? GRANT_ENTRY_TIMEOUT_MARGIN_MS),\n    killSignal: 'SIGKILL',\n    maxBuffer: GRANT_ENTRY_MAX_BUFFER_BYTES,\n    windowsHide: true,\n    env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' }\n  })\n  if ((spawned.error as NodeJS.ErrnoException | undefined)?.code === 'ETIMEDOUT') {\n    // Why: spawnSync reports its own deadline through error.code before the\n    // signal field; preserve the typed timeout so cooldown diagnostics work.\n    throw new CodexAppServerTimeoutError(\n      `codex trust-grant entry exceeded ${request.invocation.timeoutMs}ms session deadline`\n    )\n  }\n  if (spawned.error) {\n    throw spawned.error\n  }\n  if (spawned.signal) {\n    throw new CodexAppServerTimeoutError(\n      `codex trust-grant entry killed by ${spawned.signal} after ${request.invocation.timeoutMs}ms deadline`\n    )\n  }\n  const lines = (spawned.stdout ?? '').split('\\n').filter((line) => line.trim().length > 0)\n  const lastLine = lines.at(-1)\n  let envelope: GrantEntryEnvelope | null = null\n  if (lastLine) {\n    try {\n      envelope = JSON.parse(lastLine) as GrantEntryEnvelope\n    } catch {\n      envelope = null\n    }\n  }\n  if (!envelope) {\n    throw new Error(\n      `codex trust-grant entry produced no result (exit ${spawned.status ?? 'unknown'})${\n        spawned.stderr ? `: ${spawned.stderr.trim().slice(0, 400)}` : ''\n      }`","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/codex/codex-app-server-grant-bridge.ts#L95-L131","documentation":"Thrown as CodexAppServerTimeoutError when spawnSync's child was killed by a signal (spawned.signal is set) but the error code was not ETIMEDOUT. The message includes the signal name and the session deadline. This covers cases like SIGKILL from external pressure (OOM killer) or manual signal delivery.","triggerScenarios":"The grant entry child process was killed by a signal other than the spawnSync timeout path. Possible sources: OS OOM killer, task manager, antivirus, or the parent process receiving a signal that propagates.","commonSituations":"System out of memory triggers the OOM killer targeting the node child. Antivirus software kills the ELECTRON_RUN_AS_NODE child. A user or admin task-kill on Windows. Signal propagation from Orca's main process restart.","solutions":["Check system memory: if low, close other applications and retry.","Check antivirus logs for process termination of Orca or its children.","On Windows, check Event Viewer for process termination events.","Retry the trust-grant operation after addressing the resource issue."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"import { CodexAppServerTimeoutError } from '@orca/main/codex/codex-app-server-client'\n\nfunction isGrantKilled(error: unknown): error is CodexAppServerTimeoutError {\n  return error instanceof CodexAppServerTimeoutError &&\n         error.message.includes('killed by')\n}","tryCatchPattern":"try {\n  runCodexHookTrustGrantSessionSync(request)\n} catch (error) {\n  if (error instanceof CodexAppServerTimeoutError &&\n      error.message.includes('killed by')) {\n    // Process was killed (OOM, AV, signal); check resources before retry\n    logSignalKill(error.message)\n  } else { throw error }\n}","preventionTips":["Monitor system memory; the OOM killer targets ELECTRON_RUN_AS_NODE children.","Add antivirus exclusions for Orca's node processes.","Log the signal name for post-mortem analysis of resource-pressure kills."],"tags":["codex","grant-bridge","timeout","signal","process-kill","resource-pressure"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}