{"record":{"id":"9bddbb48b583002c","repo":"coleam00/Archon","slug":"detached-workflow-owner-string-pid-released-it","errorCode":null,"errorMessage":"Detached workflow owner ${String(pid)} released its termination lease","messagePattern":"Detached workflow owner (.+?) released its termination lease","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils/detached-run-control.ts","lineNumber":509,"sourceCode":" * command and must never tolerate an interrupted one, and that decision cannot be\n * exercised from a platform where the path does not run.\n */\nexport function commandTerminatedBySignal(error: unknown): boolean {\n  if (typeof error !== 'object' || error === null) return false;\n  const { killed, signal } = error as { killed?: unknown; signal?: unknown };\n  return killed === true || typeof signal === 'string';\n}\n\n/** Terminate the process tree while its exact-run owner holds the IPC lease open. */\nasync function terminateDetachedProcessTree(\n  pid: number,\n  ownsLiveLease: () => boolean\n): Promise<void> {\n  if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) {\n    throw new Error(`Refusing to terminate invalid detached owner PID ${String(pid)}`);\n  }\n  if (!ownsLiveLease()) {\n    throw new Error(`Detached workflow owner ${String(pid)} released its termination lease`);\n  }\n\n  if (process.platform === 'win32') {\n    // `taskkill /T` walks the tree PID by PID and exits non-zero when any of them is\n    // already gone — the outcome this function wants, reached early. Nothing in that\n    // exit code separates it from a kill that genuinely failed, so it is not the\n    // proof: the confirmation below is, the same way the POSIX branch tolerates ESRCH\n    // and then re-checks. A tree that is still running throws there, carrying the\n    // command's own error as the evidence.\n    //\n    // A walk that never finished is a different case and is rethrown here. The root\n    // check can only stand in for the whole tree when every descendant was visited,\n    // and a `timeout` kill leaves taskkill part-way through: the root can be gone\n    // while a descendant the walk never reached is still alive. `/T` is what takes\n    // the descendants with the root, and that they actually die is proved by the\n    // descendant-leak case in the integration spec, not by any exit code.\n    let killFailure: Error | undefined;\n    try {","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/utils/detached-run-control.ts#L491-L527","documentation":"Error \"Detached workflow owner ${String(pid)} released its termination lease\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/cli/src/utils/detached-run-control.ts:509 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}