@bastani/atomic 0.9.89-alpha.1 → 0.9.89-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +8 -0
  3. package/dist/builtin/intercom/broker/broker-instance.ts +15 -1
  4. package/dist/builtin/intercom/broker/broker.ts +25 -8
  5. package/dist/builtin/intercom/broker/client.ts +29 -14
  6. package/dist/builtin/intercom/broker/multinode-router.ts +193 -52
  7. package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -2
  8. package/dist/builtin/intercom/broker/restoring-recipients.ts +5 -0
  9. package/dist/builtin/intercom/broker/sql-outbox-store.ts +3 -2
  10. package/dist/builtin/intercom/index.bundle.mjs +19 -12
  11. package/dist/builtin/intercom/package.json +1 -1
  12. package/dist/builtin/intercom/types.ts +6 -2
  13. package/dist/builtin/mcp/package.json +1 -1
  14. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  15. package/dist/builtin/subagents/package.json +1 -1
  16. package/dist/builtin/subagents/src/extension/index.bundle.mjs +17 -6
  17. package/dist/builtin/web-access/package.json +1 -1
  18. package/dist/builtin/workflows/CHANGELOG.md +12 -0
  19. package/dist/builtin/workflows/package.json +1 -1
  20. package/dist/builtin/workflows/src/extension/index.bundle.mjs +310 -344
  21. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +99 -17
  22. package/dist/builtin/workflows/src/index.js +99 -17
  23. package/dist/builtin/workflows/src/local-worker-entry.mjs +99 -17
  24. package/dist/cli/storage-command.js +8 -0
  25. package/dist/cli/storage-command.js.map +1 -1
  26. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  27. package/dist/core/auth-storage-backends.js +1 -0
  28. package/dist/core/auth-storage-backends.js.map +1 -1
  29. package/dist/core/keybindings.d.ts +8 -0
  30. package/dist/core/keybindings.d.ts.map +1 -1
  31. package/dist/core/keybindings.js +4 -0
  32. package/dist/core/keybindings.js.map +1 -1
  33. package/dist/core/process-start-token.d.ts.map +1 -1
  34. package/dist/core/process-start-token.js +8 -1
  35. package/dist/core/process-start-token.js.map +1 -1
  36. package/dist/core/resume/blueprint/build-lock.d.ts.map +1 -1
  37. package/dist/core/resume/blueprint/build-lock.js +2 -1
  38. package/dist/core/resume/blueprint/build-lock.js.map +1 -1
  39. package/dist/core/storage/errors.d.ts +4 -2
  40. package/dist/core/storage/errors.d.ts.map +1 -1
  41. package/dist/core/storage/errors.js +6 -1
  42. package/dist/core/storage/errors.js.map +1 -1
  43. package/dist/core/tasks/completion.d.ts +5 -0
  44. package/dist/core/tasks/completion.d.ts.map +1 -1
  45. package/dist/core/tasks/completion.js +13 -0
  46. package/dist/core/tasks/completion.js.map +1 -1
  47. package/dist/core/tools/shell-task-render.d.ts +1 -2
  48. package/dist/core/tools/shell-task-render.d.ts.map +1 -1
  49. package/dist/core/tools/shell-task-render.js +3 -7
  50. package/dist/core/tools/shell-task-render.js.map +1 -1
  51. package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
  52. package/dist/core/tools/windows-directory-security.js +3 -11
  53. package/dist/core/tools/windows-directory-security.js.map +1 -1
  54. package/dist/core/worktree-snapshot/capture.d.ts.map +1 -1
  55. package/dist/core/worktree-snapshot/capture.js +25 -1
  56. package/dist/core/worktree-snapshot/capture.js.map +1 -1
  57. package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
  58. package/dist/core/worktree-snapshot/restore.js +38 -9
  59. package/dist/core/worktree-snapshot/restore.js.map +1 -1
  60. package/dist/index.d.ts +2 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +2 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/modes/interactive/components/agent-panel.d.ts +5 -0
  65. package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
  66. package/dist/modes/interactive/components/agent-panel.js +13 -0
  67. package/dist/modes/interactive/components/agent-panel.js.map +1 -1
  68. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  69. package/dist/modes/interactive/components/chat-transcript.js +5 -2
  70. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  71. package/dist/modes/interactive/components/custom-message.js +1 -1
  72. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  73. package/dist/modes/interactive/components/heartbeat-block.d.ts +34 -0
  74. package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -0
  75. package/dist/modes/interactive/components/heartbeat-block.js +50 -0
  76. package/dist/modes/interactive/components/heartbeat-block.js.map +1 -0
  77. package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
  78. package/dist/modes/interactive/components/input-label.js +8 -3
  79. package/dist/modes/interactive/components/input-label.js.map +1 -1
  80. package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
  81. package/dist/modes/interactive/components/main-composer-keys.js +3 -7
  82. package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
  83. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  84. package/dist/modes/interactive/components/mermaid.js +13 -7
  85. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  86. package/dist/modes/interactive/components/notice-line.d.ts +10 -2
  87. package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
  88. package/dist/modes/interactive/components/notice-line.js +13 -3
  89. package/dist/modes/interactive/components/notice-line.js.map +1 -1
  90. package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -1
  91. package/dist/modes/interactive/components/provider-brand.js +3 -0
  92. package/dist/modes/interactive/components/provider-brand.js.map +1 -1
  93. package/dist/modes/interactive/components/task-heartbeat-message.d.ts +9 -4
  94. package/dist/modes/interactive/components/task-heartbeat-message.d.ts.map +1 -1
  95. package/dist/modes/interactive/components/task-heartbeat-message.js +33 -27
  96. package/dist/modes/interactive/components/task-heartbeat-message.js.map +1 -1
  97. package/dist/modes/interactive/components/task-inspector.d.ts +16 -0
  98. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/task-inspector.js +95 -4
  100. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  101. package/dist/modes/interactive/components/task-list.d.ts +5 -1
  102. package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/task-list.js +20 -3
  104. package/dist/modes/interactive/components/task-list.js.map +1 -1
  105. package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -1
  106. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/task-transcript-page.js +10 -7
  108. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  109. package/dist/modes/interactive/interactive-startup.js +1 -2
  110. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  111. package/dist/modes/interactive/theme/color-utils.d.ts +29 -1
  112. package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
  113. package/dist/modes/interactive/theme/color-utils.js +81 -7
  114. package/dist/modes/interactive/theme/color-utils.js.map +1 -1
  115. package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
  116. package/dist/modes/interactive/theme/global-theme.js +3 -0
  117. package/dist/modes/interactive/theme/global-theme.js.map +1 -1
  118. package/dist/modes/interactive/theme/theme-class.d.ts +22 -2
  119. package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
  120. package/dist/modes/interactive/theme/theme-class.js +64 -18
  121. package/dist/modes/interactive/theme/theme-class.js.map +1 -1
  122. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  123. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  124. package/dist/modes/interactive/theme/theme.js +1 -0
  125. package/dist/modes/interactive/theme/theme.js.map +1 -1
  126. package/dist/utils/clipboard-image.d.ts.map +1 -1
  127. package/dist/utils/clipboard-image.js +2 -0
  128. package/dist/utils/clipboard-image.js.map +1 -1
  129. package/dist/utils/clipboard.d.ts.map +1 -1
  130. package/dist/utils/clipboard.js +2 -1
  131. package/dist/utils/clipboard.js.map +1 -1
  132. package/dist/utils/tools-manager.d.ts +6 -0
  133. package/dist/utils/tools-manager.d.ts.map +1 -1
  134. package/dist/utils/tools-manager.js +170 -15
  135. package/dist/utils/tools-manager.js.map +1 -1
  136. package/dist/utils/windows-powershell.d.ts +9 -0
  137. package/dist/utils/windows-powershell.d.ts.map +1 -0
  138. package/dist/utils/windows-powershell.js +16 -0
  139. package/dist/utils/windows-powershell.js.map +1 -0
  140. package/docs/background-tasks.md +6 -6
  141. package/docs/getting-started/installation.md +4 -2
  142. package/docs/keybindings.md +3 -0
  143. package/docs/storage.md +24 -5
  144. package/docs/subagents.md +1 -1
  145. package/docs/themes/reference.md +7 -0
  146. package/docs/tui/reference.md +1 -1
  147. package/docs/windows.md +1 -1
  148. package/docs/workflows/api-reference.md +9 -1
  149. package/docs/workflows/operations.md +1 -1
  150. package/npm-shrinkwrap.json +49 -49
  151. package/package.json +6 -6
  152. package/schemas/keybindings.schema.json +4 -0
@@ -1 +1 @@
1
- {"version":3,"file":"build-lock.js","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/build-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAA2B,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,E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,CAAC,GAAW,EAAE,OAAgB,EAAE,EAAE,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAChG,IAAI,CAAC;QACJ,OAAO,MAAM,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5F,CAAC;YAAS,CAAC;QACV,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG;gBAAE,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1G,CAAC;AACF,CAAC","sourcesContent":["/**\n * Build locks (#4748): a process that builds the blueprints of a restored worktree records itself and the processes\n * its steps start in `<storeDir>/blueprint-builds/locks/<root key>.json`. A later build of the same worktree in another\n * process waits while that process runs, and stops the step processes a process that died without stopping them (a\n * SIGKILL) left behind, so two builds never run in one worktree at once.\n *\n * One process at a time settles and builds a worktree: it holds the lock's takeover mutex, an advisory lock the kernel\n * releases when its holder dies (#5193), from before it looks at the lock until its build settled. A process that\n * looked while another was between looking and its first step, before that one's lock was written, would otherwise\n * build beside it.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { constants, mkdirSync, renameSync, writeFileSync } from \"node:fs\";\nimport { access, mkdir, readFile, rm } from \"node:fs/promises\";\nimport { hostname } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { killProcessTree } from \"../../../utils/shell.ts\";\nimport { type AsyncTakeoverMutex, takeTakeoverMutexAsync } from \"../../lock-takeover.js\";\nimport { processStartTokenAsync } from \"../../process-start-token.js\";\nimport { readLedger, rootKey } from \"./ledger.ts\";\nimport { stepProcessWatcher, stepStartingWatcher } from \"./process.ts\";\n\ninterface LockedProcess {\n\treadonly pid: number;\n\t/** When it started, where that can be read, so a later process given the same id is told apart. */\n\treadonly start?: string;\n\t/** When this process saw it start, in milliseconds since the epoch. */\n\treadonly at?: number;\n}\n\ninterface BuildLock extends LockedProcess {\n\treadonly host: string;\n\treadonly steps: readonly LockedProcess[];\n}\n\n/** How often a build waiting for another process's build of the same worktree looks again. */\nexport const BUILD_LOCK_POLL_MS = 200;\n\nconst HOST = createHash(\"sha256\").update(hostname()).digest(\"hex\").slice(0, 12);\n\nasync function locked(pid: number): Promise<LockedProcess> {\n\tconst start = await processStartTokenAsync(pid);\n\treturn start === undefined ? { pid } : { pid, start };\n}\n\nexport function buildLockPath(storeDir: string, root: string): string {\n\treturn join(storeDir, \"blueprint-builds\", \"locks\", `${rootKey(root)}.json`);\n}\n\n/** A lock file as read: absent, unreadable or not a lock this version writes, or a lock. */\ntype ReadLock =\n\t| { readonly kind: \"none\" }\n\t| { readonly kind: \"corrupt\" }\n\t| { readonly kind: \"lock\"; readonly lock: BuildLock };\n\nfunction isLockedProcess(value: unknown): value is LockedProcess {\n\tconst candidate = value as Partial<LockedProcess> | null;\n\treturn (\n\t\ttypeof candidate === \"object\" &&\n\t\tcandidate !== null &&\n\t\tNumber.isInteger(candidate.pid) &&\n\t\t(candidate.start === undefined || typeof candidate.start === \"string\")\n\t);\n}\n\nasync function readLockFile(file: string): Promise<ReadLock> {\n\tlet text: string;\n\ttry {\n\t\ttext = await readFile(file, \"utf8\");\n\t} catch (error) {\n\t\treturn (error as NodeJS.ErrnoException).code === \"ENOENT\" ? { kind: \"none\" } : { kind: \"corrupt\" };\n\t}\n\ttry {\n\t\tconst lock = JSON.parse(text) as Partial<BuildLock> | null;\n\t\tconst steps = lock?.steps;\n\t\tconst host = lock?.host;\n\t\tif (isLockedProcess(lock) && typeof host === \"string\" && Array.isArray(steps) && steps.every(isLockedProcess)) {\n\t\t\treturn { kind: \"lock\", lock: lock as BuildLock };\n\t\t}\n\t} catch {}\n\treturn { kind: \"corrupt\" };\n}\n\nasync function readLock(file: string): Promise<BuildLock | undefined> {\n\tconst read = await readLockFile(file);\n\treturn read.kind === \"lock\" ? read.lock : undefined;\n}\n\n/** Removes the lock at `file`; one that cannot be removed is left, since a lock never stops a build. */\nasync function removeLock(file: string): Promise<void> {\n\ttry {\n\t\tawait rm(file, { force: true });\n\t} catch {}\n}\n\ninterface BuildLockWriter {\n\treadonly files: ReadonlyMap<string, string>;\n\treadonly holder: LockedProcess;\n\treadonly steps: Map<number, LockedProcess>;\n\treadonly onUnwritable?: (message: string) => void;\n\tsettled: boolean;\n\ttold: boolean;\n}\n\nfunction recordStepProcessDurably(writer: BuildLockWriter, pid: number, running: boolean): void {\n\tconst { steps } = writer;\n\tif (running) {\n\t\tconst step: LockedProcess = { pid, at: Date.now() };\n\t\tsteps.set(pid, step);\n\t\tvoid processStartTokenAsync(pid).then((start) => {\n\t\t\tif (start === undefined || steps.get(pid) !== step) return;\n\t\t\tsteps.set(pid, { ...step, start });\n\t\t\twriteBuildLocksDurably(writer);\n\t\t});\n\t} else steps.delete(pid);\n\twriteBuildLocksDurably(writer);\n}\n\nfunction writeBuildLocksDurably(writer: BuildLockWriter): void {\n\tif (writer.settled) return;\n\tconst lock: BuildLock = { host: HOST, ...writer.holder, steps: [...writer.steps.values()] };\n\tfor (const [file, root] of writer.files) {\n\t\ttry {\n\t\t\tmkdirSync(dirname(file), { recursive: true });\n\t\t\tconst temporary = `${file}.${process.pid}.tmp`;\n\t\t\twriteFileSync(temporary, JSON.stringify(lock), { mode: 0o600 });\n\t\t\trenameSync(temporary, file);\n\t\t} catch (error) {\n\t\t\tif (writer.told) continue;\n\t\t\twriter.told = true;\n\t\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\t\twriter.onUnwritable?.(\n\t\t\t\t`The blueprint build lock of ${root} could not be written (${reason.slice(0, 200)}); if Atomic is killed during this build, the next resume cannot tell, and may build the worktree again while a step of this build still runs there.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\ntype Identity = \"same\" | \"gone\" | \"unknown\";\n\n/**\n * Whether `recorded` is the process that runs under its id now: proven only by the start it recorded matching the\n * running process's. `\"unknown\"` when either start cannot be read: a process of that id runs, but it may be a later\n * one given the same id.\n */\nasync function identity(recorded: LockedProcess): Promise<Identity> {\n\tconst start = await processStartTokenAsync(recorded.pid);\n\tif (recorded.start !== undefined && start !== undefined) return start === recorded.start ? \"same\" : \"gone\";\n\ttry {\n\t\tprocess.kill(recorded.pid, 0);\n\t\treturn \"unknown\";\n\t} catch (error) {\n\t\treturn (error as NodeJS.ErrnoException).code === \"EPERM\" ? \"unknown\" : \"gone\";\n\t}\n}\n\n/**\n * On Windows, the processes left behind by `steps` whose step process itself has ended: Git for Windows' `bash.exe`\n * starts the shell as a child and may end without it, and nothing then ties that shell to a process tree. They are\n * found as processes whose parent has a step's id, started after the step and before any later process given that id;\n * stopping each stops its own children. Only steps whose start was recorded are followed, and without one the host's\n * processes are not listed. Each is returned with its start, so the wait for it to end follows that process, not a\n * later one given its id.\n */\nasync function orphanedChildren(steps: readonly LockedProcess[]): Promise<LockedProcess[]> {\n\tif (!steps.some((step) => step.start !== undefined && step.at !== undefined)) return [];\n\tconst script =\n\t\t\"Get-CimInstance Win32_Process | ForEach-Object { '{0} {1} {2}' -f $_.ProcessId, $_.ParentProcessId, ([DateTimeOffset]$_.CreationDate).ToUnixTimeMilliseconds() }\";\n\tconst listed = await powershellOutput(script);\n\tif (listed === undefined) return [];\n\tconst processes = listed\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.trim().split(/\\s+/).map(Number))\n\t\t.filter((fields) => fields.length === 3 && fields.every(Number.isFinite))\n\t\t.map(([pid, parent, created]) => ({ pid: pid!, parent: parent!, created: created! }));\n\tconst found: LockedProcess[] = [];\n\t// Only a step's direct children: stopping one stops its tree, and a descendant stopped on its own could already\n\t// have ended, its id given to a process of the build that follows, before its separate stop ran.\n\tfor (const step of steps) {\n\t\tif (step.start === undefined || step.at === undefined) continue;\n\t\tconst after = step.at - 1_000;\n\t\t// A process that holds the id now and started after the step is a later one: only children older than it count.\n\t\tconst before = processes.find((candidate) => candidate.pid === step.pid && candidate.created > after)?.created;\n\t\tfor (const candidate of processes) {\n\t\t\tif (candidate.parent !== step.pid || candidate.created < after) continue;\n\t\t\tif (before !== undefined && candidate.created >= before) continue;\n\t\t\tif (found.some((known) => known.pid === candidate.pid)) continue;\n\t\t\tfound.push(await locked(candidate.pid));\n\t\t}\n\t}\n\treturn found;\n}\n\nfunction powershellOutput(script: string): Promise<string | undefined> {\n\tconst systemRoot = process.env.SystemRoot || \"C:\\\\Windows\";\n\tconst shell = join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\");\n\treturn new Promise((resolve) => {\n\t\texecFile(\n\t\t\tshell,\n\t\t\t[\"-NoProfile\", \"-NonInteractive\", \"-Command\", script],\n\t\t\t{ cwd: systemRoot, encoding: \"utf8\", timeout: 30_000, windowsHide: true },\n\t\t\t(error, stdout) => resolve(error === null ? stdout : undefined),\n\t\t);\n\t});\n}\n\nfunction delay(ms: number, signal: AbortSignal | undefined): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tsignal?.throwIfAborted();\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal?.reason);\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n}\n\nasync function stepsWhose(steps: readonly LockedProcess[], wanted: Identity): Promise<LockedProcess[]> {\n\tconst identities = await Promise.all(steps.map((step) => identity(step)));\n\treturn steps.filter((_, index) => identities[index] === wanted);\n}\n\n/** Stops each of `steps` proven to be the step its lock recorded, and `extra`, and waits briefly until they ended. */\nasync function stopProven(\n\tsteps: readonly LockedProcess[],\n\tsignal: AbortSignal | undefined,\n\textra: readonly LockedProcess[] = [],\n): Promise<void> {\n\tconst proven = [...(await stepsWhose(steps, \"same\")), ...extra];\n\tfor (const step of proven) killProcessTree(step.pid);\n\t// Stopping is asynchronous on Windows: the next build starts only once they have ended, or after a bounded wait.\n\tfor (let waited = 0; waited < 50 && (await stepsWhose(proven, \"same\")).length > 0; waited++) {\n\t\tawait delay(BUILD_LOCK_POLL_MS / 2, signal);\n\t}\n}\n\n/** How long a build waits for another process's build of the same worktree before it builds anyway, with a warning. */\nexport const BUILD_LOCK_WAIT_MS = 5 * 60_000;\n\nexport interface SettleOtherBuildsOptions {\n\treadonly signal?: AbortSignal;\n\t/** How long to wait for another process's build. Default {@link BUILD_LOCK_WAIT_MS}. */\n\treadonly waitMs?: number;\n\t/** Told once per worktree, with that worktree, when it starts waiting for another process's build. */\n\treadonly onWait?: (root: string, message: string) => void;\n\treadonly keepCancelledLocks?: boolean;\n}\n\n/**\n * Waits until no other process of this host builds the worktree whose lock is `file`, for at most `options.waitMs`.\n * A process proven to be the build's holder is waited for. The step processes of a holder that died are stopped, with\n * their process trees, only when each is proven to be the step the lock recorded (its recorded start matches);\n * a process whose identity cannot be proven is never stopped, and while one may still run the wait goes on. First the\n * worktree's build mutex is taken ({@link takeBuildMutex}), waited for while another process holds it. Returns the\n * warnings for the user: the wait timed out, a step may still run, or the lock could not be read; and the mutex, which\n * the caller holds until its build settled.\n */\nasync function settleOtherBuild(file: string, root: string, options: SettleOtherBuildsOptions): Promise<SettledBuild> {\n\tconst deadline = Date.now() + (options.waitMs ?? BUILD_LOCK_WAIT_MS);\n\tlet told = false;\n\tconst wait = async (why: string): Promise<boolean> => {\n\t\tif (!told) options.onWait?.(root, `Waiting for ${why} of ${root} to end`);\n\t\ttold = true;\n\t\tif (Date.now() >= deadline) return false;\n\t\tawait delay(BUILD_LOCK_POLL_MS, options.signal);\n\t\treturn true;\n\t};\n\tlet mutex = await takeBuildMutex(file);\n\twhile (mutex === undefined && (await wait(\"another Atomic process's blueprint build\")))\n\t\tmutex = await takeBuildMutex(file);\n\ttry {\n\t\tconst { warnings, cancelled } = await settleLock(file, root, options, wait);\n\t\t// Without the mutex, the process that holds it builds, though it may not have written its lock yet.\n\t\tif (mutex !== undefined || warnings.length > 0) return { warnings, mutex, cancelled };\n\t\tconst waited = Math.round((options.waitMs ?? BUILD_LOCK_WAIT_MS) / 1000);\n\t\treturn {\n\t\t\twarnings: [`Another process still seemed to build ${root} after ${waited} s; building it anyway.`],\n\t\t\tmutex,\n\t\t\tcancelled: true,\n\t\t};\n\t} catch (error) {\n\t\tawait mutex?.release();\n\t\tthrow error;\n\t}\n}\n\n/** {@link settleOtherBuild} of the lock at `file`, waiting with `wait`: the warnings for the user. */\nasync function settleLock(\n\tfile: string,\n\troot: string,\n\toptions: SettleOtherBuildsOptions,\n\twait: (why: string) => Promise<boolean>,\n): Promise<{ warnings: string[]; cancelled: boolean }> {\n\tconst settled = (warnings: string[]) => ({ warnings, cancelled: true });\n\tconst remove = async () => {\n\t\tif (!options.keepCancelledLocks) await removeLock(file);\n\t};\n\tlet stopped = false;\n\tfor (;;) {\n\t\tconst read = await readLockFile(file);\n\t\tif (read.kind === \"none\") return { warnings: [], cancelled: false };\n\t\tif (read.kind === \"corrupt\") {\n\t\t\tawait remove();\n\t\t\treturn settled([\n\t\t\t\t`The build lock of ${root} could not be read; building it anyway. An earlier build may still be running there.`,\n\t\t\t]);\n\t\t}\n\t\tconst { lock } = read;\n\t\tif (lock.host !== HOST || lock.pid === process.pid) return { warnings: [], cancelled: false };\n\t\tconst steps = lock.steps ?? [];\n\t\tconst holder = await identity(lock);\n\t\tif (holder !== \"gone\") {\n\t\t\tif (await wait(\"another Atomic process's blueprint build\")) continue;\n\t\t\t// Building anyway: the steps proven to be that build's stop first, so two builds never run in the worktree.\n\t\t\tawait stopProven(steps, options.signal);\n\t\t\treturn settled([\n\t\t\t\t`Another process (pid ${lock.pid}) still seemed to build ${root} after ${Math.round((options.waitMs ?? BUILD_LOCK_WAIT_MS) / 1000)} s; building it anyway.`,\n\t\t\t]);\n\t\t}\n\t\tif (!stopped) {\n\t\t\tstopped = true;\n\t\t\t// Stopped once: the Windows scan lists every process, and a later look only waits on what could not be proven.\n\t\t\tawait stopProven(steps, options.signal, process.platform === \"win32\" ? await orphanedChildren(steps) : []);\n\t\t}\n\t\tconst unproven = await stepsWhose(steps, \"unknown\");\n\t\tif (unproven.length > 0) {\n\t\t\tif (await wait(\"an earlier blueprint build\")) continue;\n\t\t\tawait remove();\n\t\t\tconst pids = unproven.map((step) => step.pid).join(\", \");\n\t\t\treturn settled([\n\t\t\t\t`An earlier blueprint build of ${root} may still be running (process ${pids}), but it could not be confirmed as that build, so it was not stopped; building the worktree anyway.`,\n\t\t\t]);\n\t\t}\n\t\tawait remove();\n\t\t// A step recorded without its start cannot be told from what it left running (on Windows, Git's bash.exe ends\n\t\t// before the shell it started), so the user hears that the earlier build may still run.\n\t\tconst unidentified = steps.filter((step) => step.start === undefined);\n\t\tif (unidentified.length > 0) {\n\t\t\treturn settled([\n\t\t\t\t`An earlier blueprint build of ${root} was interrupted, and processes it started could not be identified to stop them; they may still be running while the worktree is built again.`,\n\t\t\t]);\n\t\t}\n\t\treturn settled([]);\n\t}\n}\n\n/** What settling another process's build of one worktree left: the warnings, and the mutex held for this build. */\ninterface SettledBuild {\n\treadonly warnings: string[];\n\treadonly cancelled: boolean;\n\t/** Undefined when another process kept it past the wait, and this one builds anyway. */\n\treadonly mutex: AsyncTakeoverMutex | undefined;\n}\n\n/** Holds nothing: where the lock's directory cannot be made or written to, there is nothing to lock either. */\nconst UNLOCKABLE: AsyncTakeoverMutex = { owned: async () => true, release: async () => {} };\n\n/**\n * Takes the takeover mutex of the build lock at `file` without waiting (#5193), held from before another process's\n * build is settled until this process's build settled: undefined while another process holds it. A lock whose\n * directory cannot be made or written to could not be written either, and a lock that cannot be written never stops a\n * build.\n */\nasync function takeBuildMutex(file: string): Promise<AsyncTakeoverMutex | undefined> {\n\ttry {\n\t\tawait mkdir(dirname(file), { recursive: true });\n\t\tawait access(dirname(file), constants.W_OK);\n\t} catch {\n\t\treturn UNLOCKABLE;\n\t}\n\treturn takeTakeoverMutexAsync(file, 0);\n}\n\n/** Other processes' builds of a set of worktrees, settled ({@link settleOtherBuilds}). */\nexport interface SettledBuilds {\n\t/** The warnings for the user: a wait timed out, a step may still run, or a lock could not be read. */\n\treadonly warnings: string[];\n\treadonly cancelled: ReadonlySet<string>;\n\t/** Lets other processes build the worktrees again: called once this process's build of them settled. */\n\trelease(): Promise<void>;\n}\n\n/**\n * Waits until no other process of this host builds any of the worktrees at `roots`, stopping what the builds of\n * processes that died left running where that is proven to be theirs, and keeps other processes from building them\n * until {@link SettledBuilds.release}: the caller builds them, under {@link withBuildLocks}, and then releases them.\n * The kernel releases them too if this process dies. Resolves the warnings for the user; only `options.signal`\n * aborting rejects.\n */\nexport async function settleOtherBuilds(\n\tstoreDir: string,\n\troots: readonly string[],\n\toptions: SettleOtherBuildsOptions = {},\n): Promise<SettledBuilds> {\n\tconst warnings: string[] = [];\n\tconst cancelled = new Set<string>();\n\tconst held: AsyncTakeoverMutex[] = [];\n\tconst release = async () => {\n\t\tfor (const mutex of held.splice(0)) await mutex.release().catch(() => {});\n\t};\n\tconst files = new Map<string, string>();\n\tfor (const root of roots) {\n\t\tconst file = buildLockPath(storeDir, root);\n\t\tif (!files.has(file)) files.set(file, root);\n\t}\n\ttry {\n\t\t// In one order in every process, so two processes building overlapping worktrees never wait on each other.\n\t\tfor (const file of [...files.keys()].sort()) {\n\t\t\tconst settled = await settleOtherBuild(file, files.get(file)!, options);\n\t\t\tif (settled.mutex !== undefined) held.push(settled.mutex);\n\t\t\tif (settled.cancelled) cancelled.add(files.get(file)!);\n\t\t\twarnings.push(...settled.warnings);\n\t\t}\n\t} catch (error) {\n\t\tawait release();\n\t\tthrow error;\n\t}\n\treturn { warnings, cancelled, release };\n}\n\nexport interface CancelledBuild {\n\treadonly root: string;\n\treadonly startedAt: string;\n\treadonly logs: string;\n}\n\nexport async function cancelledBuilds(\n\tstoreDir: string,\n\troots: readonly string[],\n\toptions: SettleOtherBuildsOptions,\n\tsetAside: (build: CancelledBuild) => Promise<boolean>,\n): Promise<string[]> {\n\tconst unfinished = async () => {\n\t\tconst ledger = await readLedger(storeDir).catch(() => undefined);\n\t\treturn roots.flatMap((root) => {\n\t\t\tconst entry = ledger?.roots[rootKey(root)];\n\t\t\tif (entry?.state !== \"running\") return [];\n\t\t\tconst logs = join(storeDir, \"blueprint-logs\");\n\t\t\treturn [\n\t\t\t\t{ root, startedAt: entry.at, logs: entry.build === undefined ? logs : join(logs, `${entry.build}-*.log`) },\n\t\t\t];\n\t\t});\n\t};\n\tconst candidates = await unfinished();\n\tif (candidates.length === 0) return [];\n\tconst settled = await settleOtherBuilds(\n\t\tstoreDir,\n\t\tcandidates.map((candidate) => candidate.root),\n\t\t{ ...options, keepCancelledLocks: true },\n\t);\n\ttry {\n\t\tfor (const build of await unfinished()) {\n\t\t\tif (!settled.cancelled.has(build.root)) continue;\n\t\t\tif (await setAside(build)) await removeLock(buildLockPath(storeDir, build.root));\n\t\t}\n\t\treturn settled.warnings;\n\t} finally {\n\t\tawait settled.release();\n\t}\n}\n\n/**\n * Runs `build` of the worktrees at `roots` under their build locks: from the first step process `build` starts until it\n * settles, records this process and the step processes that run. Callers settle other processes' builds of them first\n * ({@link settleOtherBuilds}), and release them once this resolves.\n * A lock that cannot be written never stops the build.\n */\nexport async function withBuildLocks<T>(\n\tstoreDir: string,\n\troots: readonly string[],\n\tbuild: () => Promise<T>,\n\tonUnwritable?: (message: string) => void,\n): Promise<T> {\n\tconst files = new Map(roots.map((root) => [buildLockPath(storeDir, root), root]));\n\tconst steps = new Map<number, LockedProcess>();\n\tconst writer: BuildLockWriter = {\n\t\tfiles,\n\t\tholder: await locked(process.pid),\n\t\tsteps,\n\t\t...(onUnwritable === undefined ? {} : { onUnwritable }),\n\t\tsettled: false,\n\t\ttold: false,\n\t};\n\t// Written once a step starts a process, so a build that runs nothing, as for an untrusted worktree, writes nothing.\n\tlet started = false;\n\tconst starting = () => {\n\t\tif (started) return;\n\t\tstarted = true;\n\t\twriteBuildLocksDurably(writer);\n\t};\n\tconst watch = (pid: number, running: boolean) => recordStepProcessDurably(writer, pid, running);\n\ttry {\n\t\treturn await stepStartingWatcher.run(starting, () => stepProcessWatcher.run(watch, build));\n\t} finally {\n\t\twriter.settled = true;\n\t\tsteps.clear();\n\t\tfor (const file of files.keys()) if ((await readLock(file))?.pid === process.pid) await removeLock(file);\n\t}\n}\n"]}
1
+ {"version":3,"file":"build-lock.js","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/build-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAA2B,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAevE,8FAA8F;AAC9F,MAAM,CAAC,MAAM,kBAAkB,GAAG,GA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M,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5F,CAAC;YAAS,CAAC;QACV,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG;gBAAE,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1G,CAAC;AACF,CAAC","sourcesContent":["/**\n * Build locks (#4748): a process that builds the blueprints of a restored worktree records itself and the processes\n * its steps start in `<storeDir>/blueprint-builds/locks/<root key>.json`. A later build of the same worktree in another\n * process waits while that process runs, and stops the step processes a process that died without stopping them (a\n * SIGKILL) left behind, so two builds never run in one worktree at once.\n *\n * One process at a time settles and builds a worktree: it holds the lock's takeover mutex, an advisory lock the kernel\n * releases when its holder dies (#5193), from before it looks at the lock until its build settled. A process that\n * looked while another was between looking and its first step, before that one's lock was written, would otherwise\n * build beside it.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { constants, mkdirSync, renameSync, writeFileSync } from \"node:fs\";\nimport { access, mkdir, readFile, rm } from \"node:fs/promises\";\nimport { hostname } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { killProcessTree } from \"../../../utils/shell.ts\";\nimport { windowsPowerShellEnvironment } from \"../../../utils/windows-powershell.ts\";\nimport { type AsyncTakeoverMutex, takeTakeoverMutexAsync } from \"../../lock-takeover.js\";\nimport { processStartTokenAsync } from \"../../process-start-token.js\";\nimport { readLedger, rootKey } from \"./ledger.ts\";\nimport { stepProcessWatcher, stepStartingWatcher } from \"./process.ts\";\n\ninterface LockedProcess {\n\treadonly pid: number;\n\t/** When it started, where that can be read, so a later process given the same id is told apart. */\n\treadonly start?: string;\n\t/** When this process saw it start, in milliseconds since the epoch. */\n\treadonly at?: number;\n}\n\ninterface BuildLock extends LockedProcess {\n\treadonly host: string;\n\treadonly steps: readonly LockedProcess[];\n}\n\n/** How often a build waiting for another process's build of the same worktree looks again. */\nexport const BUILD_LOCK_POLL_MS = 200;\n\nconst HOST = createHash(\"sha256\").update(hostname()).digest(\"hex\").slice(0, 12);\n\nasync function locked(pid: number): Promise<LockedProcess> {\n\tconst start = await processStartTokenAsync(pid);\n\treturn start === undefined ? { pid } : { pid, start };\n}\n\nexport function buildLockPath(storeDir: string, root: string): string {\n\treturn join(storeDir, \"blueprint-builds\", \"locks\", `${rootKey(root)}.json`);\n}\n\n/** A lock file as read: absent, unreadable or not a lock this version writes, or a lock. */\ntype ReadLock =\n\t| { readonly kind: \"none\" }\n\t| { readonly kind: \"corrupt\" }\n\t| { readonly kind: \"lock\"; readonly lock: BuildLock };\n\nfunction isLockedProcess(value: unknown): value is LockedProcess {\n\tconst candidate = value as Partial<LockedProcess> | null;\n\treturn (\n\t\ttypeof candidate === \"object\" &&\n\t\tcandidate !== null &&\n\t\tNumber.isInteger(candidate.pid) &&\n\t\t(candidate.start === undefined || typeof candidate.start === \"string\")\n\t);\n}\n\nasync function readLockFile(file: string): Promise<ReadLock> {\n\tlet text: string;\n\ttry {\n\t\ttext = await readFile(file, \"utf8\");\n\t} catch (error) {\n\t\treturn (error as NodeJS.ErrnoException).code === \"ENOENT\" ? { kind: \"none\" } : { kind: \"corrupt\" };\n\t}\n\ttry {\n\t\tconst lock = JSON.parse(text) as Partial<BuildLock> | null;\n\t\tconst steps = lock?.steps;\n\t\tconst host = lock?.host;\n\t\tif (isLockedProcess(lock) && typeof host === \"string\" && Array.isArray(steps) && steps.every(isLockedProcess)) {\n\t\t\treturn { kind: \"lock\", lock: lock as BuildLock };\n\t\t}\n\t} catch {}\n\treturn { kind: \"corrupt\" };\n}\n\nasync function readLock(file: string): Promise<BuildLock | undefined> {\n\tconst read = await readLockFile(file);\n\treturn read.kind === \"lock\" ? read.lock : undefined;\n}\n\n/** Removes the lock at `file`; one that cannot be removed is left, since a lock never stops a build. */\nasync function removeLock(file: string): Promise<void> {\n\ttry {\n\t\tawait rm(file, { force: true });\n\t} catch {}\n}\n\ninterface BuildLockWriter {\n\treadonly files: ReadonlyMap<string, string>;\n\treadonly holder: LockedProcess;\n\treadonly steps: Map<number, LockedProcess>;\n\treadonly onUnwritable?: (message: string) => void;\n\tsettled: boolean;\n\ttold: boolean;\n}\n\nfunction recordStepProcessDurably(writer: BuildLockWriter, pid: number, running: boolean): void {\n\tconst { steps } = writer;\n\tif (running) {\n\t\tconst step: LockedProcess = { pid, at: Date.now() };\n\t\tsteps.set(pid, step);\n\t\tvoid processStartTokenAsync(pid).then((start) => {\n\t\t\tif (start === undefined || steps.get(pid) !== step) return;\n\t\t\tsteps.set(pid, { ...step, start });\n\t\t\twriteBuildLocksDurably(writer);\n\t\t});\n\t} else steps.delete(pid);\n\twriteBuildLocksDurably(writer);\n}\n\nfunction writeBuildLocksDurably(writer: BuildLockWriter): void {\n\tif (writer.settled) return;\n\tconst lock: BuildLock = { host: HOST, ...writer.holder, steps: [...writer.steps.values()] };\n\tfor (const [file, root] of writer.files) {\n\t\ttry {\n\t\t\tmkdirSync(dirname(file), { recursive: true });\n\t\t\tconst temporary = `${file}.${process.pid}.tmp`;\n\t\t\twriteFileSync(temporary, JSON.stringify(lock), { mode: 0o600 });\n\t\t\trenameSync(temporary, file);\n\t\t} catch (error) {\n\t\t\tif (writer.told) continue;\n\t\t\twriter.told = true;\n\t\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\t\twriter.onUnwritable?.(\n\t\t\t\t`The blueprint build lock of ${root} could not be written (${reason.slice(0, 200)}); if Atomic is killed during this build, the next resume cannot tell, and may build the worktree again while a step of this build still runs there.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\ntype Identity = \"same\" | \"gone\" | \"unknown\";\n\n/**\n * Whether `recorded` is the process that runs under its id now: proven only by the start it recorded matching the\n * running process's. `\"unknown\"` when either start cannot be read: a process of that id runs, but it may be a later\n * one given the same id.\n */\nasync function identity(recorded: LockedProcess): Promise<Identity> {\n\tconst start = await processStartTokenAsync(recorded.pid);\n\tif (recorded.start !== undefined && start !== undefined) return start === recorded.start ? \"same\" : \"gone\";\n\ttry {\n\t\tprocess.kill(recorded.pid, 0);\n\t\treturn \"unknown\";\n\t} catch (error) {\n\t\treturn (error as NodeJS.ErrnoException).code === \"EPERM\" ? \"unknown\" : \"gone\";\n\t}\n}\n\n/**\n * On Windows, the processes left behind by `steps` whose step process itself has ended: Git for Windows' `bash.exe`\n * starts the shell as a child and may end without it, and nothing then ties that shell to a process tree. They are\n * found as processes whose parent has a step's id, started after the step and before any later process given that id;\n * stopping each stops its own children. Only steps whose start was recorded are followed, and without one the host's\n * processes are not listed. Each is returned with its start, so the wait for it to end follows that process, not a\n * later one given its id.\n */\nasync function orphanedChildren(steps: readonly LockedProcess[]): Promise<LockedProcess[]> {\n\tif (!steps.some((step) => step.start !== undefined && step.at !== undefined)) return [];\n\tconst script =\n\t\t\"Get-CimInstance Win32_Process | ForEach-Object { '{0} {1} {2}' -f $_.ProcessId, $_.ParentProcessId, ([DateTimeOffset]$_.CreationDate).ToUnixTimeMilliseconds() }\";\n\tconst listed = await powershellOutput(script);\n\tif (listed === undefined) return [];\n\tconst processes = listed\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.trim().split(/\\s+/).map(Number))\n\t\t.filter((fields) => fields.length === 3 && fields.every(Number.isFinite))\n\t\t.map(([pid, parent, created]) => ({ pid: pid!, parent: parent!, created: created! }));\n\tconst found: LockedProcess[] = [];\n\t// Only a step's direct children: stopping one stops its tree, and a descendant stopped on its own could already\n\t// have ended, its id given to a process of the build that follows, before its separate stop ran.\n\tfor (const step of steps) {\n\t\tif (step.start === undefined || step.at === undefined) continue;\n\t\tconst after = step.at - 1_000;\n\t\t// A process that holds the id now and started after the step is a later one: only children older than it count.\n\t\tconst before = processes.find((candidate) => candidate.pid === step.pid && candidate.created > after)?.created;\n\t\tfor (const candidate of processes) {\n\t\t\tif (candidate.parent !== step.pid || candidate.created < after) continue;\n\t\t\tif (before !== undefined && candidate.created >= before) continue;\n\t\t\tif (found.some((known) => known.pid === candidate.pid)) continue;\n\t\t\tfound.push(await locked(candidate.pid));\n\t\t}\n\t}\n\treturn found;\n}\n\nfunction powershellOutput(script: string): Promise<string | undefined> {\n\tconst systemRoot = process.env.SystemRoot || \"C:\\\\Windows\";\n\tconst shell = join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\");\n\treturn new Promise((resolve) => {\n\t\texecFile(\n\t\t\tshell,\n\t\t\t[\"-NoProfile\", \"-NonInteractive\", \"-Command\", script],\n\t\t\t{ cwd: systemRoot, encoding: \"utf8\", env: windowsPowerShellEnvironment(), timeout: 30_000, windowsHide: true },\n\t\t\t(error, stdout) => resolve(error === null ? stdout : undefined),\n\t\t);\n\t});\n}\n\nfunction delay(ms: number, signal: AbortSignal | undefined): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tsignal?.throwIfAborted();\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal?.reason);\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n}\n\nasync function stepsWhose(steps: readonly LockedProcess[], wanted: Identity): Promise<LockedProcess[]> {\n\tconst identities = await Promise.all(steps.map((step) => identity(step)));\n\treturn steps.filter((_, index) => identities[index] === wanted);\n}\n\n/** Stops each of `steps` proven to be the step its lock recorded, and `extra`, and waits briefly until they ended. */\nasync function stopProven(\n\tsteps: readonly LockedProcess[],\n\tsignal: AbortSignal | undefined,\n\textra: readonly LockedProcess[] = [],\n): Promise<void> {\n\tconst proven = [...(await stepsWhose(steps, \"same\")), ...extra];\n\tfor (const step of proven) killProcessTree(step.pid);\n\t// Stopping is asynchronous on Windows: the next build starts only once they have ended, or after a bounded wait.\n\tfor (let waited = 0; waited < 50 && (await stepsWhose(proven, \"same\")).length > 0; waited++) {\n\t\tawait delay(BUILD_LOCK_POLL_MS / 2, signal);\n\t}\n}\n\n/** How long a build waits for another process's build of the same worktree before it builds anyway, with a warning. */\nexport const BUILD_LOCK_WAIT_MS = 5 * 60_000;\n\nexport interface SettleOtherBuildsOptions {\n\treadonly signal?: AbortSignal;\n\t/** How long to wait for another process's build. Default {@link BUILD_LOCK_WAIT_MS}. */\n\treadonly waitMs?: number;\n\t/** Told once per worktree, with that worktree, when it starts waiting for another process's build. */\n\treadonly onWait?: (root: string, message: string) => void;\n\treadonly keepCancelledLocks?: boolean;\n}\n\n/**\n * Waits until no other process of this host builds the worktree whose lock is `file`, for at most `options.waitMs`.\n * A process proven to be the build's holder is waited for. The step processes of a holder that died are stopped, with\n * their process trees, only when each is proven to be the step the lock recorded (its recorded start matches);\n * a process whose identity cannot be proven is never stopped, and while one may still run the wait goes on. First the\n * worktree's build mutex is taken ({@link takeBuildMutex}), waited for while another process holds it. Returns the\n * warnings for the user: the wait timed out, a step may still run, or the lock could not be read; and the mutex, which\n * the caller holds until its build settled.\n */\nasync function settleOtherBuild(file: string, root: string, options: SettleOtherBuildsOptions): Promise<SettledBuild> {\n\tconst deadline = Date.now() + (options.waitMs ?? BUILD_LOCK_WAIT_MS);\n\tlet told = false;\n\tconst wait = async (why: string): Promise<boolean> => {\n\t\tif (!told) options.onWait?.(root, `Waiting for ${why} of ${root} to end`);\n\t\ttold = true;\n\t\tif (Date.now() >= deadline) return false;\n\t\tawait delay(BUILD_LOCK_POLL_MS, options.signal);\n\t\treturn true;\n\t};\n\tlet mutex = await takeBuildMutex(file);\n\twhile (mutex === undefined && (await wait(\"another Atomic process's blueprint build\")))\n\t\tmutex = await takeBuildMutex(file);\n\ttry {\n\t\tconst { warnings, cancelled } = await settleLock(file, root, options, wait);\n\t\t// Without the mutex, the process that holds it builds, though it may not have written its lock yet.\n\t\tif (mutex !== undefined || warnings.length > 0) return { warnings, mutex, cancelled };\n\t\tconst waited = Math.round((options.waitMs ?? BUILD_LOCK_WAIT_MS) / 1000);\n\t\treturn {\n\t\t\twarnings: [`Another process still seemed to build ${root} after ${waited} s; building it anyway.`],\n\t\t\tmutex,\n\t\t\tcancelled: true,\n\t\t};\n\t} catch (error) {\n\t\tawait mutex?.release();\n\t\tthrow error;\n\t}\n}\n\n/** {@link settleOtherBuild} of the lock at `file`, waiting with `wait`: the warnings for the user. */\nasync function settleLock(\n\tfile: string,\n\troot: string,\n\toptions: SettleOtherBuildsOptions,\n\twait: (why: string) => Promise<boolean>,\n): Promise<{ warnings: string[]; cancelled: boolean }> {\n\tconst settled = (warnings: string[]) => ({ warnings, cancelled: true });\n\tconst remove = async () => {\n\t\tif (!options.keepCancelledLocks) await removeLock(file);\n\t};\n\tlet stopped = false;\n\tfor (;;) {\n\t\tconst read = await readLockFile(file);\n\t\tif (read.kind === \"none\") return { warnings: [], cancelled: false };\n\t\tif (read.kind === \"corrupt\") {\n\t\t\tawait remove();\n\t\t\treturn settled([\n\t\t\t\t`The build lock of ${root} could not be read; building it anyway. An earlier build may still be running there.`,\n\t\t\t]);\n\t\t}\n\t\tconst { lock } = read;\n\t\tif (lock.host !== HOST || lock.pid === process.pid) return { warnings: [], cancelled: false };\n\t\tconst steps = lock.steps ?? [];\n\t\tconst holder = await identity(lock);\n\t\tif (holder !== \"gone\") {\n\t\t\tif (await wait(\"another Atomic process's blueprint build\")) continue;\n\t\t\t// Building anyway: the steps proven to be that build's stop first, so two builds never run in the worktree.\n\t\t\tawait stopProven(steps, options.signal);\n\t\t\treturn settled([\n\t\t\t\t`Another process (pid ${lock.pid}) still seemed to build ${root} after ${Math.round((options.waitMs ?? BUILD_LOCK_WAIT_MS) / 1000)} s; building it anyway.`,\n\t\t\t]);\n\t\t}\n\t\tif (!stopped) {\n\t\t\tstopped = true;\n\t\t\t// Stopped once: the Windows scan lists every process, and a later look only waits on what could not be proven.\n\t\t\tawait stopProven(steps, options.signal, process.platform === \"win32\" ? await orphanedChildren(steps) : []);\n\t\t}\n\t\tconst unproven = await stepsWhose(steps, \"unknown\");\n\t\tif (unproven.length > 0) {\n\t\t\tif (await wait(\"an earlier blueprint build\")) continue;\n\t\t\tawait remove();\n\t\t\tconst pids = unproven.map((step) => step.pid).join(\", \");\n\t\t\treturn settled([\n\t\t\t\t`An earlier blueprint build of ${root} may still be running (process ${pids}), but it could not be confirmed as that build, so it was not stopped; building the worktree anyway.`,\n\t\t\t]);\n\t\t}\n\t\tawait remove();\n\t\t// A step recorded without its start cannot be told from what it left running (on Windows, Git's bash.exe ends\n\t\t// before the shell it started), so the user hears that the earlier build may still run.\n\t\tconst unidentified = steps.filter((step) => step.start === undefined);\n\t\tif (unidentified.length > 0) {\n\t\t\treturn settled([\n\t\t\t\t`An earlier blueprint build of ${root} was interrupted, and processes it started could not be identified to stop them; they may still be running while the worktree is built again.`,\n\t\t\t]);\n\t\t}\n\t\treturn settled([]);\n\t}\n}\n\n/** What settling another process's build of one worktree left: the warnings, and the mutex held for this build. */\ninterface SettledBuild {\n\treadonly warnings: string[];\n\treadonly cancelled: boolean;\n\t/** Undefined when another process kept it past the wait, and this one builds anyway. */\n\treadonly mutex: AsyncTakeoverMutex | undefined;\n}\n\n/** Holds nothing: where the lock's directory cannot be made or written to, there is nothing to lock either. */\nconst UNLOCKABLE: AsyncTakeoverMutex = { owned: async () => true, release: async () => {} };\n\n/**\n * Takes the takeover mutex of the build lock at `file` without waiting (#5193), held from before another process's\n * build is settled until this process's build settled: undefined while another process holds it. A lock whose\n * directory cannot be made or written to could not be written either, and a lock that cannot be written never stops a\n * build.\n */\nasync function takeBuildMutex(file: string): Promise<AsyncTakeoverMutex | undefined> {\n\ttry {\n\t\tawait mkdir(dirname(file), { recursive: true });\n\t\tawait access(dirname(file), constants.W_OK);\n\t} catch {\n\t\treturn UNLOCKABLE;\n\t}\n\treturn takeTakeoverMutexAsync(file, 0);\n}\n\n/** Other processes' builds of a set of worktrees, settled ({@link settleOtherBuilds}). */\nexport interface SettledBuilds {\n\t/** The warnings for the user: a wait timed out, a step may still run, or a lock could not be read. */\n\treadonly warnings: string[];\n\treadonly cancelled: ReadonlySet<string>;\n\t/** Lets other processes build the worktrees again: called once this process's build of them settled. */\n\trelease(): Promise<void>;\n}\n\n/**\n * Waits until no other process of this host builds any of the worktrees at `roots`, stopping what the builds of\n * processes that died left running where that is proven to be theirs, and keeps other processes from building them\n * until {@link SettledBuilds.release}: the caller builds them, under {@link withBuildLocks}, and then releases them.\n * The kernel releases them too if this process dies. Resolves the warnings for the user; only `options.signal`\n * aborting rejects.\n */\nexport async function settleOtherBuilds(\n\tstoreDir: string,\n\troots: readonly string[],\n\toptions: SettleOtherBuildsOptions = {},\n): Promise<SettledBuilds> {\n\tconst warnings: string[] = [];\n\tconst cancelled = new Set<string>();\n\tconst held: AsyncTakeoverMutex[] = [];\n\tconst release = async () => {\n\t\tfor (const mutex of held.splice(0)) await mutex.release().catch(() => {});\n\t};\n\tconst files = new Map<string, string>();\n\tfor (const root of roots) {\n\t\tconst file = buildLockPath(storeDir, root);\n\t\tif (!files.has(file)) files.set(file, root);\n\t}\n\ttry {\n\t\t// In one order in every process, so two processes building overlapping worktrees never wait on each other.\n\t\tfor (const file of [...files.keys()].sort()) {\n\t\t\tconst settled = await settleOtherBuild(file, files.get(file)!, options);\n\t\t\tif (settled.mutex !== undefined) held.push(settled.mutex);\n\t\t\tif (settled.cancelled) cancelled.add(files.get(file)!);\n\t\t\twarnings.push(...settled.warnings);\n\t\t}\n\t} catch (error) {\n\t\tawait release();\n\t\tthrow error;\n\t}\n\treturn { warnings, cancelled, release };\n}\n\nexport interface CancelledBuild {\n\treadonly root: string;\n\treadonly startedAt: string;\n\treadonly logs: string;\n}\n\nexport async function cancelledBuilds(\n\tstoreDir: string,\n\troots: readonly string[],\n\toptions: SettleOtherBuildsOptions,\n\tsetAside: (build: CancelledBuild) => Promise<boolean>,\n): Promise<string[]> {\n\tconst unfinished = async () => {\n\t\tconst ledger = await readLedger(storeDir).catch(() => undefined);\n\t\treturn roots.flatMap((root) => {\n\t\t\tconst entry = ledger?.roots[rootKey(root)];\n\t\t\tif (entry?.state !== \"running\") return [];\n\t\t\tconst logs = join(storeDir, \"blueprint-logs\");\n\t\t\treturn [\n\t\t\t\t{ root, startedAt: entry.at, logs: entry.build === undefined ? logs : join(logs, `${entry.build}-*.log`) },\n\t\t\t];\n\t\t});\n\t};\n\tconst candidates = await unfinished();\n\tif (candidates.length === 0) return [];\n\tconst settled = await settleOtherBuilds(\n\t\tstoreDir,\n\t\tcandidates.map((candidate) => candidate.root),\n\t\t{ ...options, keepCancelledLocks: true },\n\t);\n\ttry {\n\t\tfor (const build of await unfinished()) {\n\t\t\tif (!settled.cancelled.has(build.root)) continue;\n\t\t\tif (await setAside(build)) await removeLock(buildLockPath(storeDir, build.root));\n\t\t}\n\t\treturn settled.warnings;\n\t} finally {\n\t\tawait settled.release();\n\t}\n}\n\n/**\n * Runs `build` of the worktrees at `roots` under their build locks: from the first step process `build` starts until it\n * settles, records this process and the step processes that run. Callers settle other processes' builds of them first\n * ({@link settleOtherBuilds}), and release them once this resolves.\n * A lock that cannot be written never stops the build.\n */\nexport async function withBuildLocks<T>(\n\tstoreDir: string,\n\troots: readonly string[],\n\tbuild: () => Promise<T>,\n\tonUnwritable?: (message: string) => void,\n): Promise<T> {\n\tconst files = new Map(roots.map((root) => [buildLockPath(storeDir, root), root]));\n\tconst steps = new Map<number, LockedProcess>();\n\tconst writer: BuildLockWriter = {\n\t\tfiles,\n\t\tholder: await locked(process.pid),\n\t\tsteps,\n\t\t...(onUnwritable === undefined ? {} : { onUnwritable }),\n\t\tsettled: false,\n\t\ttold: false,\n\t};\n\t// Written once a step starts a process, so a build that runs nothing, as for an untrusted worktree, writes nothing.\n\tlet started = false;\n\tconst starting = () => {\n\t\tif (started) return;\n\t\tstarted = true;\n\t\twriteBuildLocksDurably(writer);\n\t};\n\tconst watch = (pid: number, running: boolean) => recordStepProcessDurably(writer, pid, running);\n\ttry {\n\t\treturn await stepStartingWatcher.run(starting, () => stepProcessWatcher.run(watch, build));\n\t} finally {\n\t\twriter.settled = true;\n\t\tsteps.clear();\n\t\tfor (const file of files.keys()) if ((await readLock(file))?.pid === process.pid) await removeLock(file);\n\t}\n}\n"]}
@@ -219,14 +219,16 @@ export declare class StorageWriterQueueUnusableError extends StorageUnavailableE
219
219
  readonly errno?: string;
220
220
  constructor(descriptor: StorageDescriptor, cause: StorageFailureCause);
221
221
  }
222
- export declare const STORAGE_TRANSIENT_ERROR_CODES: readonly ["stream-expired", "transaction-timeout", "connection-refused", "connection-lost", "lock-conflict"];
222
+ export declare const STORAGE_TRANSIENT_ERROR_CODES: readonly ["stream-expired", "transaction-timeout", "connection-refused", "connection-lost", "lock-conflict", "read-only-server"];
223
223
  /**
224
224
  * Why a call to a database server failed for a while: `"stream-expired"`, the server ended a stream that stayed idle
225
225
  * too long, as a stream does whose process was stopped in the middle of a transaction; `"transaction-timeout"`, the
226
226
  * server rolled back a transaction that kept the write lock while another writer waited; `"connection-refused"`, no
227
227
  * connection to the server could be made; `"connection-lost"`, the connection broke while a request was on its way or
228
228
  * being answered; `"lock-conflict"`, the server aborted the transaction to resolve a lock conflict (a serialization
229
- * failure, a deadlock, or a lock wait that timed out).
229
+ * failure, a deadlock, or a lock wait that timed out); `"read-only-server"`, the server refused a write because it
230
+ * accepts reads only, as a read replica does, or a primary for a while during a failover or when its storage is
231
+ * nearly full.
230
232
  */
231
233
  export type StorageTransientErrorCode = (typeof STORAGE_TRANSIENT_ERROR_CODES)[number];
232
234
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/storage/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CA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C,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,2BAA2B,CAAC;CAC7C;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,2BAA2B,CAAC;CAC7C;AAeD,4FAA4F;AAC5F,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,iBAAiB,GAAG,2BAA2B,CAWhG;AA0BD,6HAA6H;AAC7H,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,2BAA2B,GAAG,iBAAiB,CAKrG"}
@@ -331,11 +331,16 @@ export const STORAGE_TRANSIENT_ERROR_CODES = [
331
331
  "connection-refused",
332
332
  "connection-lost",
333
333
  "lock-conflict",
334
+ "read-only-server",
334
335
  ];
335
336
  const TRANSIENT_HINTS = {
336
337
  "not-applied": "Check that the database server is reachable and that this process is not stopped or starved of CPU, then retry; nothing was written",
337
338
  unknown: "Check that the database server is reachable; the write may have been applied, so read it back before retrying a write that is not idempotent",
338
339
  };
340
+ /** What a failure of one of these codes asks of the reader, in place of the hint its outcome gives. */
341
+ const TRANSIENT_CODE_HINTS = {
342
+ "read-only-server": "The server accepts reads only (SQLSTATE 25006): either the URL names a read replica or read-only endpoint (use the primary or the read/write endpoint), or the server is read-only right now (storage nearly full, or a failover in progress); nothing was written",
343
+ };
339
344
  /**
340
345
  * A call to a database server failed for a reason that passes: the server ended an idle stream or a transaction that
341
346
  * kept the write lock, or the connection could not be made or broke. `outcome` says whether the call may have written
@@ -350,7 +355,7 @@ export class StorageTransientError extends StorageUnavailableError {
350
355
  retryable = true;
351
356
  hint;
352
357
  constructor(descriptor, details, cause) {
353
- const hint = TRANSIENT_HINTS[details.outcome];
358
+ const hint = TRANSIENT_CODE_HINTS[details.code] ?? TRANSIENT_HINTS[details.outcome];
354
359
  super(descriptor, cause, `the database server call failed on attempt ${details.attempts} (${details.code}). ${hint}`);
355
360
  this.code = details.code;
356
361
  this.outcome = details.outcome;