@bastani/atomic 0.9.72-alpha.1 → 0.9.73-alpha.1
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.
- package/CHANGELOG.md +199 -0
- package/dist/builtin/intercom/CHANGELOG.md +61 -0
- package/dist/builtin/intercom/broker/client.ts +8 -5
- package/dist/builtin/intercom/broker/spawn.ts +24 -30
- package/dist/builtin/intercom/index.bundle.mjs +31 -36
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/CHANGELOG.md +8 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +31 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +110 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +25 -30
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +25 -30
- package/dist/builtin/workflows/src/index.js +25 -30
- package/dist/builtin/workflows/src/local-worker-entry.mjs +25 -30
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
|
@@ -6,6 +6,116 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.9.72] - 2026-11-08
|
|
10
|
+
|
|
11
|
+
Waiting stages free their resources, and pooled work runs across machines.
|
|
12
|
+
|
|
13
|
+
- **Stages that only wait release their session.** A stage waiting on a detachable tool call, a question, a shell `wait` or an idle hold gives up its session and slot and reopens when its input arrives, and `evictWhenWaiting` takes a whole waiting run out of memory ([#4309](https://github.com/bastani-inc/atomic/issues/4309), [#4373](https://github.com/bastani-inc/atomic/issues/4373), [#4374](https://github.com/bastani-inc/atomic/issues/4374)).
|
|
14
|
+
- **Worker pools across machines.** `workers: { placement: "shared" }` and `startWorkflowWorkerHost()` run pooled children on other machines, restore their bound worktrees from snapshots, and deliver chat, questions and Intercom messages to remote stages ([#4310](https://github.com/bastani-inc/atomic/issues/4310), [#4391](https://github.com/bastani-inc/atomic/issues/4391), [#4416](https://github.com/bastani-inc/atomic/issues/4416), [#4492](https://github.com/bastani-inc/atomic/issues/4492), [#4503](https://github.com/bastani-inc/atomic/issues/4503), [#4505](https://github.com/bastani-inc/atomic/issues/4505), [#4513](https://github.com/bastani-inc/atomic/issues/4513)).
|
|
15
|
+
- **Workspaces and resume anywhere.** `workspace()` binds children to a repository, branch and worktree, and runs resume on another machine from recorded snapshots and setup hooks ([#3109](https://github.com/bastani-inc/atomic/issues/3109), [#4245](https://github.com/bastani-inc/atomic/issues/4245), [#4329](https://github.com/bastani-inc/atomic/issues/4329), [#4382](https://github.com/bastani-inc/atomic/issues/4382)).
|
|
16
|
+
- **Run time travel.** `forkRun` and `/workflow fork` retry a run from any stage in a new run, leaving the source unchanged ([#4321](https://github.com/bastani-inc/atomic/issues/4321)).
|
|
17
|
+
- **Smarter stage flow.** The decision model judges whether a stage is done after you steer it, predicts stage names for Intercom, and `ctx.subscribe` and `ctx.events` follow event streams without flooding context ([#4358](https://github.com/bastani-inc/atomic/issues/4358), [#4359](https://github.com/bastani-inc/atomic/issues/4359), [#4311](https://github.com/bastani-inc/atomic/issues/4311)).
|
|
18
|
+
- **Typed failures across processes.** Pool, placement, storage, workspace and other error families keep their class, code and hint when they cross from a worker to its parent ([#4327](https://github.com/bastani-inc/atomic/issues/4327), [#4338](https://github.com/bastani-inc/atomic/issues/4338), [#4378](https://github.com/bastani-inc/atomic/issues/4378)).
|
|
19
|
+
- **Large pools stay responsive.** Fewer heartbeat writes, read-only pool queries, incremental publications, checkpoints read on demand and shared route publications keep thousands of stages moving ([#4313](https://github.com/bastani-inc/atomic/issues/4313), [#4314](https://github.com/bastani-inc/atomic/issues/4314), [#4315](https://github.com/bastani-inc/atomic/issues/4315), [#4317](https://github.com/bastani-inc/atomic/issues/4317), [#4318](https://github.com/bastani-inc/atomic/issues/4318), [#4376](https://github.com/bastani-inc/atomic/issues/4376)).
|
|
20
|
+
|
|
21
|
+
**Breaking change:** Read a released stage's transcript with `await stage.readMessages()` (or call `stage.rehydrate()` first, or set `releaseWhenWaiting: false`) instead of `stage.messages`; build `WorkflowInfrastructureError` as `new WorkflowInfrastructureError(code, { hint, runId, stageId, cause })` and match pool faults by class or `code` instead of message.
|
|
22
|
+
|
|
23
|
+
### Breaking Changes
|
|
24
|
+
|
|
25
|
+
- While a workflow stage's session is released, including a stage the workflow holds idle past its `releaseWhenWaiting` threshold (60 seconds by default) and a stage whose tool wait ended without reopening its session, `stage.messages` and `stage.agent` throw `StageReleasedError` (code `stage-released`, a `StageWaitError` with the guard `isStageReleasedError`) naming the stage, its session and the member read; after a failed reopen, `fields.reopenFailed` is `true` and `cause` is the failure. Migration: replace `stage.messages` after a long hold with `await stage.readMessages()`, which reads the transcript from the session store without reopening the session. Alternatively call `await stage.rehydrate()` before reading, or set `releaseWhenWaiting: false` on a stage the workflow must read synchronously. `stage.model` and `stage.thinkingLevel` return the session's last values while it is released, and `stage.isStreaming` is `false` ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
26
|
+
- `WorkflowInfrastructureError`'s constructor is now `new WorkflowInfrastructureError(code, { hint?, runId?, stageId?, cause? })`, and its message is built from its code and fields. Pool faults are concrete subclasses (`WorkerLostError`, `WorkerStartupError`, `WorkerStartupTimeoutError`, `WorkerRetryLimitError`, `WorkerCleanupUnconfirmedError`, `QuarantinedCapacityError`, `AdmissionHolderStoppedError`) with their own names; the fault codes are unchanged. Code that matched pool error messages must branch on the class or `code` instead ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
27
|
+
- A child result recorded by an earlier version, whose failure names a pool fault only in its error text, is no longer recognized as a pool fault when its root resumes ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- After you steer a stage that asked you a question, the decision model decides its readiness instead of always asking "Are you ready to move on to the next stage?". It asks an advance/stay Choice and the yes/no companion "does the reply fully address the user's message". The stage completes at P(advance) ≥ 0.85 with the companion ≥ 0.8, and stays open without asking at P(stay) ≥ 0.7; otherwise, or when the decision model is unavailable, times out or fails, the question is asked as before. A chat decision model gives no probabilities, so with one, or none configured, the question is always asked and no decision is recorded. Only a message sent after the stage's question is judged, and a message sent while the decision model is answering makes it decide again on that message once the stage replies. The thresholds are exported as `READINESS_DECISION_THRESHOLDS`, with `readinessVerdict`. Each decision is recorded on the stage as `readinessDecision` in workflow stage status, and as a notice in the stage transcript and `/workflow connect`. Turn it off with `workflows.autoAdvanceAfterSteer: false` ([#4358](https://github.com/bastani-inc/atomic/issues/4358))
|
|
32
|
+
- `@bastani/atomic/workflows` re-exports `decide()` and the `DecisionError` family, so workflows can make their own decisions with the user's decision model ([#4358](https://github.com/bastani-inc/atomic/issues/4358))
|
|
33
|
+
- `ctx.workflow(child, { workspace })`, and `workspace` on `ctx.task`, `ctx.stage`, `ctx.chain` and `ctx.parallel`, bind work to a repository, branch and worktree from `workspace({ … })` in `@bastani/atomic/workflows`. A parent can run builtin Goal or Ralph in several unrelated repositories at once: each child's `ctx.cwd` and stages use its own worktree, the binding is recorded at the child boundary and restored on resume (failing closed on repository, branch, remote or history drift, and when a commit a completed step recorded is gone), concurrent writer children on one worktree are refused, read-only reviewers cannot use file-writing tools, and results carry a `changeSet` for `publishPullRequest()` ([#3109](https://github.com/bastani-inc/atomic/issues/3109))
|
|
34
|
+
- Run time travel: `forkRun(runId, { fromStage, inputs, cwd, carryMessages })` forks a durable run from a stage, named by a dot path into nested workflows, into a new run that replays earlier tool calls, prompt answers and stages and runs the rest again; the source run is never changed. It returns the new run with the same event stream `run()` reports and records `forkedFrom` in status. `listForkPoints(runId)` lists the stages a run can be forked from. The `workflow` tool gains a `fork` action and `/workflow fork <run> [--from <stage>]` does the same from chat ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
35
|
+
- `forkFromEntryId` beside `forkFromSessionId` on stage, task, chain and parallel options starts a stage session at an exact entry of an earlier session ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
36
|
+
- Fork failures are typed `ForkError`s with stable codes, a hint and an explicit retry flag: `ForkTargetNotFoundError` lists up to 10 stages you can fork from, and `ForkDefinitionMismatchError`, `ForkSourceBusyError`, `ForkEntryNotFoundError`, `ForkSessionNotFoundError`, `ForkConfigError`, `ForkSourceNotFoundError`, `ForkJournalUnsupportedError`, `ForkJournalUnavailableError`, `ForkCopyFailedError`, `ForkClaimReleaseError` and `ForkSessionUnavailableError` cover the other cases. A storage failure while reading or claiming the source is a retryable `ForkJournalUnavailableError`, not a raw storage error. A fork checks everything before it writes, so a failure leaves nothing behind. If the write rejects, the fork run is read back: one that exists goes on, and on a shared journal an unconfirmed write keeps the copied sessions and rejects with a non-retryable `ForkJournalUnavailableError` (`phase: "commit"`) naming the fork run to inspect, or with the abort reason when the caller cancelled. A fork renews its claim on the source every 30 s and checks it before it reads the source's sessions and before it writes, so a source taken over by a resume mid-fork stops the fork with a retryable `ForkSourceBusyError` instead of mixing old checkpoints with newer conversations. A failed cleanup step (`ForkCleanupError`, `ForkClaimReleaseError`) never replaces the fork's result or error: it is attached as `cleanupCause` or logged once ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
37
|
+
- Run journals can implement `createRunWithEvents` to create a run with its first events in one transaction; the SQLite and memory journals do ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
38
|
+
- Fork errors include `ForkSourceOwnershipError` (`source-not-owned`) for model-facing requests from another session and `ForkSessionClaimError` (`session-claim-refused`) when a copied worker conversation cannot be safely resumed. Hosts can handle either by class or code instead of parsing messages ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
39
|
+
- `localWorkers.heartbeatMs` sets how often each local worker sends its heartbeat, from `100` ms to half of `localWorkers.leaseMs`. It defaults to a quarter of the lease, and is available in `RunOpts.localWorkers` and in `workflows.localWorkers` settings. An out-of-range `leaseMs` or `heartbeatMs` now refuses the run or resume before it starts with the exported `LocalWorkerOptionsError` (family `LocalWorkerPoolError`, codes `invalid-lease` and `invalid-heartbeat`). The error names the setting's `source` and `field` and carries a `hint`. Use `isLocalWorkerOptionsError`, `isLocalWorkerPoolError` or `findLocalWorkerPoolError` to recognize it ([#4313](https://github.com/bastani-inc/atomic/issues/4313))
|
|
40
|
+
- Stage status from `workflow stages` and `workflow stage` includes `compaction`, the stage session's background compaction state (`idle`, `running`, `ready` or `failed`, with the typed error when it failed), kept current after the stage finishes or its session is replaced ([#4330](https://github.com/bastani-inc/atomic/issues/4330))
|
|
41
|
+
- A root that runs a local worker pool records its coordinator's requests and journal writes per second, by kind, in the root run's `pool.coordination` snapshot. In debug mode, `workflow` status and `/workflow status` also show them as a `pool:` line ([#4313](https://github.com/bastani-inc/atomic/issues/4313), [#4360](https://github.com/bastani-inc/atomic/issues/4360))
|
|
42
|
+
- Workflows that create git worktrees work on a machine without git: worktree commands run the git Atomic resolves, including a portable git it downloads when none is installed. A run whose inputs select a worktree (`worktreeFromInputs`, as in the builtin goal and ralph workflows) fails before its body with `WorkflowGitRequiredError` (code `git-required`, naming the workflow input and carrying the `GitUnavailableError` with its install command) when git cannot be provided, and a task that creates its own worktree fails the same way, naming the task. Runs that never create a worktree never wait for or download git. Tasks that reuse a saved result do not provision git just to replay it ([#4322](https://github.com/bastani-inc/atomic/issues/4322))
|
|
43
|
+
- `ProcessCleanupUnconfirmedError`, `isProcessCleanupUnconfirmedError`, `serializeWorkflowInfrastructureError` and `rehydrateWorkflowInfrastructureError` are exported from `@bastani/atomic/workflows`, so a stage's cleanup failure keeps its class and fields when it is passed to another process ([#4338](https://github.com/bastani-inc/atomic/issues/4338)).
|
|
44
|
+
- Debug mode covers workflows: failed workflow notices and background discovery, `model: "auto"` stage fallbacks, pooled stage watch traces and pool coordination counts go to the debug log. A running pool passes a debug mode change on to the workers it starts next ([#4360](https://github.com/bastani-inc/atomic/issues/4360))
|
|
45
|
+
- When possible-stage discovery cannot read some stage names (names built by helpers, step factories imported from other modules, loops over lists, or child workflows chosen at run time), the decision model ranks candidate names taken from the workflow's source in the background, and a send to a path outside the known set gets a yes/no judgment. Launch and delivery never wait for it. Accepted names appear in `intercom list` and in `workflow` status as `predicted`, then `confirmed` or `unused`. The policy lives in the exported `POSSIBLE_STAGE_PREDICTION_THRESHOLDS`, and failures fall back to the static scan with one typed `PossibleStagePredictionError` reason (`decision-unavailable`, `decision-failed`, `decision-timeout`, `invalid-answer`) ([#4359](https://github.com/bastani-inc/atomic/issues/4359))
|
|
46
|
+
- Workflow checkpoints record repository snapshots so resumed runs can restore their latest recorded Git content into a fresh worktree, including on another host that shares the journal and snapshot blobs ([#4245](https://github.com/bastani-inc/atomic/issues/4245))
|
|
47
|
+
- Finishing a root workflow run starts a background collection of worktree snapshot content that no resumable run or session needs, without delaying the run's result; a failed collection becomes a warning notice on the run. `WorkspaceCollectionError`, `isWorkspaceCollectionError` and `isRetryableWorkspaceError` are exported ([#4355](https://github.com/bastani-inc/atomic/issues/4355))
|
|
48
|
+
- Pooled children can run on workers on other machines. A root started with `workers: { placement: "shared" }` on a journal every machine opens through a storage adapter, such as libSQL or Turso, keeps its pool's work queue, leases, admission state and stage inputs in that journal, under its prefix. `startWorkflowWorkerHost({ journal, maxWorkers, labels })` runs workers for it on any machine. Session and process limits count across every host. The root can resume on any machine that opens the journal, and its children finish from their checkpoints. Children can be bound to a repository state with `workers.workspace`, a binding or a `workspace({ … })` value; a bound child runs only on a host that has that tree or can restore it, and fails with `WorkspaceRestoreUnavailableError` when no such host is live. A host that restores runs the git `resolveGit()` resolves, downloading a portable git when the machine has none. Typed `WorkerPlacementError` errors report invalid options and missing setup before anything starts, and `/workflow status` shows a shared pool's queue, hosts and leases ([#4310](https://github.com/bastani-inc/atomic/issues/4310))
|
|
49
|
+
- A worker host started without `restore` restores bound children by default from the worktree snapshots recorded in the shared journal, uncommitted content included, with `restoreWorktree` and the git the machine already has; it never downloads git for this. `restore: false` turns restoring off. A binding whose restore fails waits before the host tries it again (one second, doubling up to a minute), its failed restore does not count as one of the child's attempts, and while every host waits, the child fails with `WorkspaceRestoreUnavailableError` once its claim window passes, with the last restore failure as its `cause`. Workspace and git errors, such as that cause, now keep their class, code, fields and hint when they cross between a pool's processes ([#4416](https://github.com/bastani-inc/atomic/issues/4416))
|
|
50
|
+
- A child started with `ctx.workflow(child, { workspace })` under a root with shared placement runs only on a host that has its workspace's tree or can restore it, with its workspace bound to that host's worktree ([#4416](https://github.com/bastani-inc/atomic/issues/4416))
|
|
51
|
+
- `RunOpts.evictWhenWaiting` (`true`, or `{ afterMs }`) evicts a root run from memory once its stages only wait on detached tool calls: each waiting stage is then only a small index entry, and the calls keep running. The run is rebuilt in the same process by replaying its journal when a stage's calls all have results, a waiting stage is sent a message, or the run is paused, quit or killed; finished calls are answered from the record, and waiting stages wait on the same calls again without reopening their sessions or running the calls again. Invalid values and runs that cannot be rebuilt are refused before anything is written with `RunEvictionConfigError`, and a rebuilt body that no longer waits on its stages' calls fails the run with `RunReplayError`; both are in the exported `RunEvictionError` family with guards, `findRunEvictionError` and `deserializeRunEvictionError` ([#4373](https://github.com/bastani-inc/atomic/issues/4373))
|
|
52
|
+
- The stage sessions `forkRun` copies, and a stage session started with `forkFromSessionId`, keep the oversized tool outputs that released stages stored with the sessions they copy; a session store that cannot hold them fails the copy with `SessionBlobError` (`blobs-unsupported`) before anything is written ([#4379](https://github.com/bastani-inc/atomic/issues/4379))
|
|
53
|
+
- A stage on a pooled worker, local or shared, that is released while it waits stores its oversized tool outputs in the pool's session tables like any other session, readable through `tool-output://` from the root and from other hosts. The worker writes the bytes straight to those tables, and the reference entry still commits through the pool, which refuses it from a fenced attempt ([#4379](https://github.com/bastani-inc/atomic/issues/4379))
|
|
54
|
+
- A stage also releases its session and slot while its model waits in a `bash` or `powershell` `wait` on a background task without `budgetMs`, or in `ask_user_question`. The task keeps running on the stage's task host; a stage waiting on its question stays `awaiting_input`, and your answer, or the task's end, reopens the session and continues the same turn. After a restart, `/workflow resume` starts the wait again or asks the question again, and a wait whose task ended with the old process gets an error result naming the task instead of hanging ([#4374](https://github.com/bastani-inc/atomic/issues/4374))
|
|
55
|
+
- A pooled child whose live stages all wait released, on a tool call's result or an answer, gives up its place among `localWorkers.count` so the next child runs meanwhile: the pool starts another worker for it, at most `count` more, and keeps the waiting child where it runs. At most `count` children still run at once: a child whose result or answer arrives takes a place back before it opens a session or starts a process, ahead of children that have not started. The pool ends an extra worker once it is idle and `count` other workers are ready. A worker host keeps to its `maxWorkers` and starts no extra workers ([#4374](https://github.com/bastani-inc/atomic/issues/4374))
|
|
56
|
+
- A child that failed because no Intercom broker took over from a retiring one reaches its parent as `IntercomBrokerSuccessorTimeoutError`, in the new `intercom-broker` error family ([#4496](https://github.com/bastani-inc/atomic/issues/4496))
|
|
57
|
+
- A worker host without a bound tree restores it with its uncommitted, untracked and unpushed content even when no checkpoint recorded it. A root with shared placement snapshots its own bound worktree when it starts, and the worktree of a child started with `ctx.workflow(child, { workspace })` when it dispatches the child, following its `snapshots` settings. The work carries the snapshot, which the default restore uses and a custom `restore` receives as `options.snapshot`, and snapshot garbage collection keeps the root's own snapshot while its worker pool runs and a child's for as long as the root run's queued work exists, at any `snapshots.graceSeconds`, `0` included ([#4503](https://github.com/bastani-inc/atomic/issues/4503)). Without a snapshot, a child still fails with `WorkspaceRestoreUnavailableError` once no host can restore it ([#4492](https://github.com/bastani-inc/atomic/issues/4492))
|
|
58
|
+
- A pooled stage on another machine takes stage chat messages, steers and follow-ups, shows its `ask_user_question` form at the root, and receives Intercom messages sent to it. Each goes through the stage's input queue in the shared journal, one at a time and in order, with a receipt, and reaches the stage's session once, including when another host takes the stage over. Its stage chat shows no live transcript, and pausing that stage, `/compact` and `!` commands fail with `RemoteStageCommandUnsupportedError`. An Intercom ask to such a stage is refused, since its replies cannot reach the sender, and so is a send to such a stage without Intercom access. Stage inputs are typed `PooledStageInputKind`s: a malformed one is refused with `StageInputInvalidError` before it is written, a receipt that does not come in time fails with the retryable `StageInputTimeoutError`, and an input the stage did not take fails with `StageInputRefusedError`. An Intercom message the stage's session fails to take is reported to its sender as undeliverable, and later messages go on; `isRetryableWorkerPlacementError` tells which placement errors may be retried ([#4391](https://github.com/bastani-inc/atomic/issues/4391))
|
|
59
|
+
- A run resumed on another machine continues where it stopped: each checkout it recorded is restored once from its snapshots before it continues, the setup hook (`.atomic/setup` in a trusted project, or `resume.setupCommand`) runs in each checkout the run restores, and a worker host's default restore runs it, from the host's own agent directory, in each worktree it restores for a pooled child (a host given its own `restore` runs none), and the earlier machine's absolute paths resolve in the restored worktrees for its tools. A child bound with `workspace()` whose worktree, branch or commits exist only on the machine that recorded it continues in its restored worktree, and a run bound to an input worktree continues in the worktree restored for it. Missing Git or setup hooks are reported as `ResumePreconditionError` before the run is claimed or anything is restored, and a hook that fails stops the run and removes the worktrees restored for it ([#4329](https://github.com/bastani-inc/atomic/issues/4329))
|
|
60
|
+
- `run()` with the id of a run in shared storage fails with a retryable `ResumeCatalogTimeoutError` (`subject: "run"`) when the storage does not answer within 15 seconds, instead of waiting for the network to give up. The deadline ends once the storage answers, so listing the runs of a large journal is not bounded by it, and a retry in the same process opens the journal again. A `run()` of a run that another machine still holds is refused before anything is restored or set up ([#4329](https://github.com/bastani-inc/atomic/issues/4329))
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- The interactive cross-project `/workflow resume` fork now uses `forkRun`, so its copy is written in one step and an interrupted fork leaves no partial run ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
65
|
+
- Resuming a pooled root, whose pool database is on another machine, now fails with a typed `SharedPoolSetupError` (code `pool-on-another-host`) that names both machines and says where to resume, instead of a plain error ([#4310](https://github.com/bastani-inc/atomic/issues/4310))
|
|
66
|
+
- Starting a root with `localWorkers` on Windows, or on a host without Atomic's native process identity, now fails with a typed `SharedPoolSetupError` (code `process-containment-unavailable`, operation `local-pool`) whose hint says what to do, instead of a plain error ([#4310](https://github.com/bastani-inc/atomic/issues/4310))
|
|
67
|
+
- Stages that only wait no longer hold a session. A stage releases its session and admission slot, shows as `waiting`, and reopens the same session from the session store when its input arrives, continuing without a new prompt, in four cases: a call of a `detachable` tool runs longer than the stage's `releaseWhenWaiting` threshold (60 seconds by default, `DEFAULT_RELEASE_WHEN_WAITING_AFTER_MS`, at most `MAX_RELEASE_WHEN_WAITING_AFTER_MS`); the workflow calls `stage.release()` (the stage reopens on `rehydrate()` or its next `sendUserMessage`, `steer` or `followUp`; a `ctx.stage` still runs a single `prompt()`); the workflow holds a finished stage unused past the threshold, for example while it awaits a child workflow or a prompt; or the stage's readiness question waits on a person past the threshold. Steering, messages and Intercom sends to a waiting stage queue until it reopens, pause holds it, and quit or a crash followed by `/workflow resume` continues every stage without prompting it again. Set `releaseWhenWaiting` on a task, stage, chain, parallel step or run; `false` keeps a stage resident, and an invalid value is refused before anything runs ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
68
|
+
- A waiting stage whose session store is briefly unreachable when its tool results arrive saves the results, retries reopening its session and saving the results into it three times with backoff (an unreachable store and a store write-lock timeout alike), and then blocks the run resumably instead of failing it; `/workflow resume` continues the turn from the saved results without running the tool again, and a stage never completes on a turn whose tool results its session did not save. A message, `rehydrate()` or prompt sent while a stage is releasing its session waits for the release, so a stage is never shown `waiting` with a live session ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
69
|
+
- `stage.release()` and `stage.rehydrate()` give up and reopen a held stage's session explicitly, and `stage.readMessages()` reads a stage's transcript, from the session store while its session is released, without reopening it ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
70
|
+
- A completed stage replayed from its checkpoint exposes the same released-stage getters: `messages` and `agent` throw `StageReleasedError`, and `readMessages()` reads its stored transcript. `release()` succeeds without opening a session; `rehydrate()` throws the non-retryable `StageRehydrationError` code `replayed-stage`, with a hint to read the transcript or fork the run to execute the stage again ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
71
|
+
- `RunOpts.onStageLifecycleEvent` reports `stage_waiting` and `stage_rehydrated`, and a waiting stage's snapshot says what it waits on in `wait`. Workflow status filters on `waiting`, reports `waitingCount` and lists the waiting stages with what each waits on, `stages` gives each waiting stage a `wait` and reads `waiting (tool: wait_ci)`, `waiting (released)` or `waiting (idle)`, a waiting stage shows `◷` in node cards, status rows and the background strip as in the graph header, a stage still released when its run ends leaves `waiting`, and a run whose stages wait reports activity `waiting` ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
72
|
+
- Each stage has a mailbox for the messages that wake it. `registerStageWakeKind()` adds a message kind declared on the `StageWakeKinds` interface, and `deliverStageWake()` delivers one and reports whether it was delivered, handled or queued ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
73
|
+
- The `StageWaitError` family (`StageWaitConfigError`, `StageReleaseError`, `StageRehydrationError`, `StageWakeError`) reports invalid settings, refused releases, sessions that cannot be reopened, invalid or unknown wake kinds (`registerStageWakeKind` misuse included) with stable codes and remediation hints. `StageWaitRecordError` (`wait-record-unavailable`) appears in a stage snapshot's `waitRecordFailure` when a record of its wait could not be saved. A woken stage whose reopened session returns without saving its tool results fails with `StageRehydrationError` code `results-not-saved`, and `/workflow resume` continues the turn from the results saved with its wait. Missing waiting-stage sessions in the run's store fail resume preflight with `StageRehydrationError` code `session-not-found`, listing every missing session. A stage with its own `sessionStore` or `sessionManager` is checked when the resumed workflow calls it again, before it opens or reads its session; pass the same store again, or the stage fails with the same typed error rather than falling back to the run's store or starting a fresh session ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
74
|
+
- A `StageWaitError` or `ToolDetachmentError` that fails a child workflow, in process or on a pooled worker, reaches the parent as the same class in its error chain, and `RunResult` and stage snapshots carry it as `failureDetail` ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
75
|
+
- Typed worker pool errors in `@bastani/atomic/workflows`. `StaleWorkLeaseError`, `PublicationRejectedError`, `PoolNotInitializedError`, `WorkAttemptFencedError` and `PoolProtocolError` join the `LocalWorkerPoolError` family, so `isLocalWorkerPoolError` and `findLocalWorkerPoolError` recognize them, and the pool's faults are concrete `WorkflowInfrastructureError` classes. Each has a stable `code`, structured fields, a `hint`, `retryable`, and a guard such as `isStaleWorkLeaseError`. `LocalWorkerOptionsError` also carries `omitted`, what leaving the setting out means. `StaleLeaseError` now has `code: "stale_lease"`, a `hint` and `isStaleLeaseError`; `PoolAppendRefusedError` is exported with `code: "pool_append_refused"` ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
76
|
+
- Local worker pool errors keep their class, code, fields and causes across the worker, coordinator and root processes instead of arriving as text, so `ctx.workflow(child)` reports, for example, a `WorkerRetryLimitError` whose `cause` is the fault that ended the child's last attempt, and whose `cleanupCause` names process groups its last worker left running. A group of errors, such as a fork's several cleanup failures, crosses with its members in order ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
77
|
+
- Pool errors name the worker's log file instead of copying the worker's or coordinator's stderr into the message ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
78
|
+
- A storage error in a pool error's cause chain, such as `StorageWriteLockTimeoutError`, crosses the worker, coordinator and root processes as its own class through `rehydrateStorageError`, and the errors under it cross without their text. A journal store error, such as `JournalShardUnavailableError`, crosses the same way through `rehydrateJournalStoreError`, and a fork error, such as `ForkSessionClaimError`, through `rehydrateForkError` with its cleanup cause, on the same envelope as every other pool error ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
79
|
+
- `ProcessCleanupUnconfirmedError` has its own `name`, `"ProcessCleanupUnconfirmedError"`, and its message reads like the other infrastructure errors'. `serializeWorkflowInfrastructureError` and `rehydrateWorkflowInfrastructureError` now send and rebuild the local worker pool's own error envelope, so any `WorkflowInfrastructureError` round-trips as its class with its fields and causes, and a stage cleanup failure in a pooled child reaches the root as `ProcessCleanupUnconfirmedError` caused by its `TaskCleanupError`. A value whose fields or cause are malformed now throws `PoolProtocolError` instead of falling back to the base class; a copy that only lost its cause is still rebuilt from its `phase` and `resources` ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
80
|
+
- `ctx.subscribe(source, handler, options?)` lets a long-lived stage follow an event stream (CI checks, pull request reviews, log lines, webhooks) without every event entering its context. Each event runs in its own short-lived, tracked child stage seeded with the event and your handling instructions; the child reports to the subscriber stage only when the event matters. The journal records the subscription and every processed event id, so repeated ids, including ones delivered again after a resume, are handled once. `maxConcurrent` and `maxRate` cap concurrent event children and their start rate per subscription ([#4311](https://github.com/bastani-inc/atomic/issues/4311))
|
|
81
|
+
- `for await (const event of ctx.events(source))` reads a stream inline in the run body, for events that belong in a stage's own history, with the same deduplication and rate cap ([#4311](https://github.com/bastani-inc/atomic/issues/4311))
|
|
82
|
+
- Every error family with its own JSON form reaches the parent as the same class when it fails a child workflow, in process or on a pooled worker of this or another host, not only `StageWaitError` and `ToolDetachmentError`: workspace, git provisioning, `WorkflowGitRequiredError`, session start, decision, task eviction, idle agent release and rehydration, background compaction, GitHub Copilot, debug, file and shell tool, llama-server, startup benchmark and event subscription errors, and the worker pool, placement, storage, journal and fork errors the pool already carried. `failureDetail` on `RunResult` and stage snapshots is now the pool's `SerializedError` envelope, which `rehydrateError` from `@bastani/atomic/workflows` rebuilds, and replaces both the `SerializedTypedError` union and `RunResult.workspaceError`. URL credentials are removed from the text of causes outside these families when they cross ([#4378](https://github.com/bastani-inc/atomic/issues/4378))
|
|
83
|
+
- Attached stage chats scroll like the main transcript, following `fullscreenWheelScrollLines` and `fullscreenScrollbar`, with Alt+wheel, prompt jumps and half-page bindings; a `/tasks` transcript opened from a stage chat is a chat of its own that follows the stage's Ctrl+T and Ctrl+O ([#4521](https://github.com/bastani-inc/atomic/issues/4521))
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- The `/workflow connect` picker no longer shows a completed/total stage count on each run row. The count wasn't kept up to date and often didn't match the run; rows now show the run's name and elapsed time
|
|
88
|
+
- The `session-not-found` hint of `StageRehydrationError` now names `atomic team join <url> --token-file <path>` for a machine that uses local-only storage and is not joined to shared storage, and says that joining keeps sessions in a local store, so the session storage that holds the waiting stage's session must still be selected ([#4377](https://github.com/bastani-inc/atomic/issues/4377))
|
|
89
|
+
- Large local worker pools no longer spend most of their journal's write lock on worker heartbeats. Each worker used to send a lease renewal, a control poll and a usage report every second, as three journal transactions. It now sends one heartbeat every quarter of its lease that does all three in one transaction. With 450 workers and a 60 s lease, that is 30 heartbeat writes per second instead of 1,350, and leases are renewed well before they expire. Pause, resume and quit are pushed to workers as soon as they are committed, so they reach running children no later than before ([#4313](https://github.com/bastani-inc/atomic/issues/4313))
|
|
90
|
+
- A root hosting large local-worker pools no longer pins its main thread applying worker activity, which delayed its lease renewals and new stages' routing. Each publication now carries only the stages, tool nodes and run fields that changed since the attempt's previous one, and the root updates its copy of the run in place instead of copying and comparing every stage it holds: a batch that changes one stage costs the same whether the run has 250 or 4,000 stages. A large batch is applied over several turns of the event loop, so timers such as lease renewal run while it applies ([#4317](https://github.com/bastani-inc/atomic/issues/4317))
|
|
91
|
+
- A workflow root whose children run on local workers no longer keeps every child's checkpoints in the parent process. Each pooled stage session records a checkpoint in the root's journal, and a long-running root held 250,000 to 400,000 of them in memory, which grew the parent's memory and slowed each checkpoint lookup of the root. The parent now keeps the root's own checkpoints and reads a child's from the journal when it needs them: when a resumed root replays or checks that child, when the child's nested runs settle, and when a post-mortem chat or `/workflow status` inspects the root. Resuming a pooled root replays its completed children as before ([#4318](https://github.com/bastani-inc/atomic/issues/4318))
|
|
92
|
+
- One bash call whose process cleanup is confirmed late no longer fails its workflow stage, the child workflow and the parent run. The stage keeps going and records a `cleanup` stage notice instead. Cleanup that is still unconfirmed when the stage closes fails the stage with a retryable `ProcessCleanupUnconfirmedError` (a `WorkflowInfrastructureError` with code `process_cleanup_unconfirmed`, fields `hint`, `phase` and `resources`, caused by a `TaskCleanupError`) that resume handles: the stage's saved session already holds the command's result, so the resumed stage continues after it ([#4338](https://github.com/bastani-inc/atomic/issues/4338)).
|
|
93
|
+
- Local workers' budget checks, control polls and pool reads no longer wait for the journal's write lock. The pool coordinator answered these requests, which only read, inside write transactions, so each one queued behind the pool's own writes and every other process writing the journal, and a tool's reported duration included that wait. These requests now run as read transactions on a read-only connection to the journal, which reads the last commit while another connection holds the lock. Fencing is unchanged: a stale or replaced attempt is still refused ([#4314](https://github.com/bastani-inc/atomic/issues/4314))
|
|
94
|
+
- An agent step on a pooled local worker no longer waits behind the worker's own heartbeat. Session writes and admission checks run alongside heartbeat traffic, while each worker's journal writes still apply one at a time in send order. Attempt transitions wait for earlier requests to finish, and concurrent heartbeat and lease-extension replies cannot move the held lease backwards ([#4315](https://github.com/bastani-inc/atomic/issues/4315))
|
|
95
|
+
- Fork event readers now receive run and stage snapshots as they were when each event fired, even when reading after the run finishes. Later execution updates and callback mutations no longer change queued lifecycle events ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
96
|
+
- Forking a paused local-worker run preserves and resumes its unfinished conversations instead of failing when a new worker opens or saves the copied session, including when the workflow journal uses a storage adapter ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
97
|
+
- Forking with incompatible saved worker or admission settings now fails with `ForkConfigError` before conversations are copied or a new run is saved, while supported pool-size and local-limit overrides remain available ([#4321](https://github.com/bastani-inc/atomic/issues/4321))
|
|
98
|
+
- A resumed `ctx.workflow` child bound with `workspace(...)` now checks only the commit its latest completed step recorded, so a child that amends, squashes or rebases its own earlier commits can resume. This includes builtin Goal and Ralph, which record the branch's head after every turn. Earlier commits a step replaced no longer need to exist or have been pushed. The resume still fails closed when the latest step's commit is gone from the branch (`drift`) or found nowhere (`commits-unavailable`). When steps on the branch run in parallel, the resume checks the commits of the step that started last and of every step still running when it started, so a step that saved an older head after another step's commit cannot hide that commit's loss ([#4382](https://github.com/bastani-inc/atomic/issues/4382))
|
|
99
|
+
- A finished stage keeps its completed or failed status when a follow-up message waits on a detached tool and then reopens, instead of appearing as running after its run ends ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
100
|
+
- A waiting stage keeps tool results and wait-state changes recorded in the same millisecond instead of silently discarding them as duplicate checkpoints, so resume does not dispatch already-finished tool calls again ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
101
|
+
- `stage.setThinkingLevel()` can set a resumed, released stage's level even when its previous level is unknown, without reopening the session. The next reopen applies the saved level, and unrelated getter failures still propagate unchanged ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
102
|
+
- Concurrent messages to one idle stage share its concurrency slot until the last call ends instead of leaking a slot and blocking later stages ([#4309](https://github.com/bastani-inc/atomic/issues/4309))
|
|
103
|
+
- A child that ran out of attempts on a quarantined process permit is reported as `worker_retry_limit` with the quarantine refusal as its cause, instead of as `worker_cleanup_unconfirmed` because its message quoted the refusal ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
104
|
+
- An error that merely reads like a pool fault ("Stale work lease", "Storage unavailable", "Agent is already processing") no longer ends a pooled child's attempt or queues a stage message; only the typed errors do ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
105
|
+
- A pooled child that writes a checkpoint or session change while its root is not running is refused with `StaleWorkLeaseError` (`reason: "root-not-running"`), as its completion already was, so its attempt ends and the child replays instead of the write failing with an untyped error ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
106
|
+
- A local worker pool asked to run a child, start its workers or take a stage command for a root it was not prepared for refuses with `PoolNotInitializedError` instead of an untyped error. Its `root` names the root it was asked about, and is absent when the pool was never prepared for any root ([#4327](https://github.com/bastani-inc/atomic/issues/4327))
|
|
107
|
+
- On a machine that runs roots with `workers: { placement: "shared" }` and roots without it on one journal, post-mortem chat reopens the finished pooled stages of both kinds. Forking a shared root copies its child workflows' stage conversations into the journal, where its workers take them over, instead of this machine's pool database. A fork whose pool tables are missing now fails before copying anything with `ForkPoolSessionsUnavailableError` (`pool-sessions-unavailable`), which names the placement and how to fork instead, rather than a retryable `ForkCopyFailedError` ([#4357](https://github.com/bastani-inc/atomic/issues/4357))
|
|
108
|
+
- A resumed child workflow, including one a local or shared worker pool runs, now checks that the session store it reopens its stages from still holds the sessions of every stage it left waiting before it does any work. A missing session fails the child at once with `StageRehydrationError` (`session-not-found`), listing every missing session and naming the root run to resume in its new `rootRunId` field, instead of failing only when the stage reopens after the child has started other work. The failure reaches the parent as the child's typed failure; the pool does not treat it as a lost worker and does not retry the child, and resuming the root runs the child again so it checks its sessions again. Results the stage's detached calls recorded stay saved for a later resume ([#4440](https://github.com/bastani-inc/atomic/issues/4440))
|
|
109
|
+
- Overlapping `sendUserMessage()`, `prompt()` or `complete()` calls on one stage each settle with their own result. A call that finishes first no longer ends the stage and makes a call still running reject with `skipped after parallel fail-fast`. The stage ends once, after the last of them, and fails with the first error among them, so a failed message is no longer recorded as completed. A real parallel fail-fast or workflow exit still rejects every call; a call whose turn already finished when the workflow exits rejects with the exit rather than a fail-fast error. A workflow that fails with one of those errors while another call still runs, for example through `Promise.all`, fails or blocks for resume on that stage, and the run keeps the stage until that call ends, so a resume in between is refused rather than sending the stage another message ([#4450](https://github.com/bastani-inc/atomic/issues/4450))
|
|
110
|
+
- A run that starts thousands of stages no longer fails them with `Pending-stage route registration timeout`. Every starting stage used to publish its run's whole stage roster to Intercom, so a 2,500-stage run published it 1,478 times; stages that start while the run's last publication is unacknowledged now share the next one, and the same run publishes it five times ([#4376](https://github.com/bastani-inc/atomic/issues/4376))
|
|
111
|
+
- Resuming a run that stopped after a stage's model gave its final answer to the stage's prompt, but before the stage was recorded as finished, no longer sends that stage a "continue" prompt. The stage or task finishes with that answer, including the `output` file it writes, so the resumed run makes no extra model request and the stage's result is the answer the model gave before the stop. Only an answer to the same prompt text counts: a forked stage whose inherited conversation ends on another stage's answer, a stage with a `schema`, or one whose last turn asked the user a question still gets the "continue" prompt ([#4375](https://github.com/bastani-inc/atomic/issues/4375))
|
|
112
|
+
- A workflow run on a libSQL journal no longer fails with `storage_unavailable` when its process is stopped mid-write past the server's stream expiry (about 10 seconds for sqld) and continues: the journal write runs again and each event is recorded once. Journal writes ended by a server timeout or a refused connection run again the same way. A `StorageTransientError` from another process or realm counts as a storage outage too ([#4383](https://github.com/bastani-inc/atomic/issues/4383))
|
|
113
|
+
- A resumed stage that was waiting on a tool call after earlier prompts or messages had finished answers those calls from the run's record and continues its waiting turn, instead of failing on its next message ([#4373](https://github.com/bastani-inc/atomic/issues/4373))
|
|
114
|
+
- A worker host that loses its root's lease while restoring a child's workspace now detaches so it can reattach to the current root, instead of remaining idle indefinitely after refusing the stale claim ([#4391](https://github.com/bastani-inc/atomic/issues/4391))
|
|
115
|
+
- A pooled stage on another machine (`workers: { placement: "shared" }`) that takes its queued Intercom messages before its first turn and ends before the root's drain reaches it no longer has those messages reported to their senders as undeliverable: the root records each as delivered to the stage, once. A message sent to several stages, such as a broadcast, that one such stage's session fails to take stays queued for its other stages and now shows in the root run's `Intercom delivery:` status line, and a stage session that closes is no longer kept in memory until its child finishes ([#4505](https://github.com/bastani-inc/atomic/issues/4505))
|
|
116
|
+
- A stage of a nested workflow inside a pooled child on another machine (`workers: { placement: "shared" }`) that takes its queued Intercom messages before its first turn keeps them delivered when the update showing it ended never reached the root, for example after a root restart: the root records them as delivered once as the child completes, so their senders are not told they were undeliverable, and a broadcast the stage took is recorded as delivered to it ([#4513](https://github.com/bastani-inc/atomic/issues/4513))
|
|
117
|
+
- A `/tasks` transcript of a stage on a local worker shows the streaming reply's thinking, and messages typed into it reach the agent on the worker ([#4521](https://github.com/bastani-inc/atomic/issues/4521))
|
|
118
|
+
|
|
9
119
|
## [0.9.72-alpha.1] - 2026-11-08
|
|
10
120
|
|
|
11
121
|
Waiting stages free their resources, and pooled work runs across machines.
|
|
@@ -75206,8 +75206,8 @@ function isLostBrokerSignature(error) {
|
|
|
75206
75206
|
const code = error.code;
|
|
75207
75207
|
return code === "ENOENT" || code === "ECONNRESET" || code === "EPIPE";
|
|
75208
75208
|
}
|
|
75209
|
-
async function classifyRegistrationFailure(error) {
|
|
75210
|
-
if (!isLostBrokerSignature(error) || await isSocketAnswering(
|
|
75209
|
+
async function classifyRegistrationFailure(error, socketPath) {
|
|
75210
|
+
if (!isLostBrokerSignature(error) || await isSocketAnswering(socketPath))
|
|
75211
75211
|
return error;
|
|
75212
75212
|
return new IntercomBrokerRetiringError(`Intercom broker went away before it registered this session: ${error.message}`, {
|
|
75213
75213
|
cause: error
|
|
@@ -75232,7 +75232,7 @@ function isWorkflowFutureStageRosterEntries(value2) {
|
|
|
75232
75232
|
function isWorkflowStageRosterEntries(value2) {
|
|
75233
75233
|
return Array.isArray(value2) && value2.every((entry) => typeof entry === "object" && entry !== null && entry.kind === "workflow-stage" && typeof entry.runId === "string" && typeof entry.stageId === "string" && typeof entry.stageName === "string" && typeof entry.target === "string" && (entry.lifecycle === "pending" || entry.lifecycle === "running") && typeof entry.group === "string" && (entry.sessionId === undefined || typeof entry.sessionId === "string"));
|
|
75234
75234
|
}
|
|
75235
|
-
var
|
|
75235
|
+
var BROKER_CONNECT_TIMEOUT_MS = 1e4, PENDING_STAGE_ROUTE_ACK_TIMEOUT_MS = 1e4, GROUP_REQUEST_TIMEOUT_MS = 5000, PRESENCE_ACK_TIMEOUT_MS = 5000, RESTORING_RECIPIENT_REQUEST_TIMEOUT_MS = 5000, BROKER_BACKLOG_RETRIES = 6, BROKER_BACKLOG_RETRY_BASE_MS = 25, ConnectionClosedBeforeRegistrationError, HELD_SEND_GRACE_MS = 5000, IntercomPendingStageRouteRefusedError, PENDING_STAGE_ROUTE_REFUSAL_CODES, IntercomClient;
|
|
75236
75236
|
var init_client = __esm(() => {
|
|
75237
75237
|
init_broker_status();
|
|
75238
75238
|
init_paths();
|
|
@@ -75251,7 +75251,6 @@ var init_client = __esm(() => {
|
|
|
75251
75251
|
init_workflow_prediction_fields();
|
|
75252
75252
|
init_released_child_errors();
|
|
75253
75253
|
init_released_reply_errors();
|
|
75254
|
-
BROKER_SOCKET = getBrokerSocketPath();
|
|
75255
75254
|
ConnectionClosedBeforeRegistrationError = class ConnectionClosedBeforeRegistrationError extends Error {
|
|
75256
75255
|
constructor() {
|
|
75257
75256
|
super("Connection closed before registration");
|
|
@@ -75278,6 +75277,7 @@ var init_client = __esm(() => {
|
|
|
75278
75277
|
preferredSessionId;
|
|
75279
75278
|
acknowledgesReceipt;
|
|
75280
75279
|
connectTimeoutMs;
|
|
75280
|
+
brokerSocketPath;
|
|
75281
75281
|
brokerAcknowledgesReceipt = false;
|
|
75282
75282
|
brokerAcknowledgesPendingStageRoutes = false;
|
|
75283
75283
|
multiplexesPendingStageRoutes;
|
|
@@ -75354,6 +75354,7 @@ var init_client = __esm(() => {
|
|
|
75354
75354
|
this.acknowledgesReceipt = options.acknowledgesReceipt === true;
|
|
75355
75355
|
this.connectTimeoutMs = options.connectTimeoutMs ?? BROKER_CONNECT_TIMEOUT_MS;
|
|
75356
75356
|
this.multiplexesPendingStageRoutes = options.multiplexesPendingStageRoutes === true;
|
|
75357
|
+
this.brokerSocketPath = options.brokerSocketPath ?? getBrokerSocketPath();
|
|
75357
75358
|
}
|
|
75358
75359
|
failPending(error) {
|
|
75359
75360
|
this.pendingSends.rejectAll(error);
|
|
@@ -75436,7 +75437,7 @@ var init_client = __esm(() => {
|
|
|
75436
75437
|
if (!(error instanceof Error))
|
|
75437
75438
|
throw error;
|
|
75438
75439
|
if (!isBacklogRefusal(error) || retry >= BROKER_BACKLOG_RETRIES) {
|
|
75439
|
-
const classified = await classifyRegistrationFailure(error);
|
|
75440
|
+
const classified = await classifyRegistrationFailure(error, this.brokerSocketPath);
|
|
75440
75441
|
if (attempt.signal.aborted)
|
|
75441
75442
|
throw connectAborted();
|
|
75442
75443
|
if (expectedRouting?.verify === true && classified instanceof ConnectionClosedBeforeRegistrationError) {
|
|
@@ -75461,7 +75462,7 @@ var init_client = __esm(() => {
|
|
|
75461
75462
|
this._groups = normalizeGroups(session.groups, session.group);
|
|
75462
75463
|
this.registrationExpectedRouting = expectedRouting;
|
|
75463
75464
|
return new Promise((resolve, reject) => {
|
|
75464
|
-
const socket = net2.connect(
|
|
75465
|
+
const socket = net2.connect(this.brokerSocketPath);
|
|
75465
75466
|
this.socket = socket;
|
|
75466
75467
|
this.disconnectError = null;
|
|
75467
75468
|
let settled = false;
|
|
@@ -76748,7 +76749,7 @@ function getDefaultBrokerCommandParts(brokerPath, extensionDir, runtimePath, run
|
|
|
76748
76749
|
function quoteWindowsArg(value2) {
|
|
76749
76750
|
return `"${value2.replace(/"/g, '""')}"`;
|
|
76750
76751
|
}
|
|
76751
|
-
function getWindowsHiddenLauncherPath(intercomDir =
|
|
76752
|
+
function getWindowsHiddenLauncherPath(intercomDir = getIntercomDirPath()) {
|
|
76752
76753
|
return join31(intercomDir, "broker-launch.vbs");
|
|
76753
76754
|
}
|
|
76754
76755
|
function usesDefaultBrokerCommand(brokerCommand, brokerArgs) {
|
|
@@ -76780,7 +76781,7 @@ function writeWindowsHiddenLauncher(commandLine, launcherPath = getWindowsHidden
|
|
|
76780
76781
|
writeFileSync6(launcherPath, getWindowsHiddenLauncherScript(commandLine), "utf-8");
|
|
76781
76782
|
return launcherPath;
|
|
76782
76783
|
}
|
|
76783
|
-
function getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir = EXTENSION_DIR, platform = process.platform, intercomDir =
|
|
76784
|
+
function getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir = EXTENSION_DIR, platform = process.platform, intercomDir = getIntercomDirPath(), nodePath = process.execPath, runtime = getCurrentBrokerRuntime(), logPath = getBrokerLogPath()) {
|
|
76784
76785
|
if (platform === "win32") {
|
|
76785
76786
|
const launcherPath = getWindowsHiddenLauncherPath(intercomDir);
|
|
76786
76787
|
return {
|
|
@@ -76819,7 +76820,7 @@ function getBrokerSpawnOptions(extensionDir = EXTENSION_DIR, stderr = "ignore",
|
|
|
76819
76820
|
windowsHide: true
|
|
76820
76821
|
};
|
|
76821
76822
|
}
|
|
76822
|
-
function resetBrokerLog(logPath =
|
|
76823
|
+
function resetBrokerLog(logPath = getBrokerLogPath()) {
|
|
76823
76824
|
ensurePrivateDirectory(dirname14(logPath));
|
|
76824
76825
|
try {
|
|
76825
76826
|
const previous = readBrokerLogTail(logPath);
|
|
@@ -76849,7 +76850,7 @@ async function resetBrokerLogOnceReleased() {
|
|
|
76849
76850
|
}
|
|
76850
76851
|
return true;
|
|
76851
76852
|
}
|
|
76852
|
-
function readBrokerLogTail(logPath =
|
|
76853
|
+
function readBrokerLogTail(logPath = getBrokerLogPath(), maxBytes = BROKER_LOG_TAIL_BYTES) {
|
|
76853
76854
|
let fd;
|
|
76854
76855
|
try {
|
|
76855
76856
|
fd = openSync4(logPath, "r");
|
|
@@ -76870,7 +76871,7 @@ function readBrokerLogTail(logPath = BROKER_LOG, maxBytes = BROKER_LOG_TAIL_BYTE
|
|
|
76870
76871
|
}
|
|
76871
76872
|
}
|
|
76872
76873
|
}
|
|
76873
|
-
function describeBrokerLog(logPath =
|
|
76874
|
+
function describeBrokerLog(logPath = getBrokerLogPath()) {
|
|
76874
76875
|
const tail = readBrokerLogTail(logPath);
|
|
76875
76876
|
if (tail.length === 0)
|
|
76876
76877
|
return `Broker log: ${logPath} (empty)`;
|
|
@@ -76882,7 +76883,7 @@ function toError2(error) {
|
|
|
76882
76883
|
return error instanceof Error ? error : new Error(String(error));
|
|
76883
76884
|
}
|
|
76884
76885
|
async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR) {
|
|
76885
|
-
ensurePrivateDirectory(
|
|
76886
|
+
ensurePrivateDirectory(getIntercomDirPath());
|
|
76886
76887
|
if (await isBrokerRunning()) {
|
|
76887
76888
|
return;
|
|
76888
76889
|
}
|
|
@@ -76901,7 +76902,7 @@ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, read
|
|
|
76901
76902
|
}
|
|
76902
76903
|
const brokerPath = resolveBrokerEntrypoint(extensionDir);
|
|
76903
76904
|
const launch = getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir);
|
|
76904
|
-
const announcement = launch.kind === "windows-launcher" ? { path:
|
|
76905
|
+
const announcement = launch.kind === "windows-launcher" ? { path: getBrokerStartAnnouncementPath(), token: randomUUID16() } : undefined;
|
|
76905
76906
|
if (announcement !== undefined) {
|
|
76906
76907
|
try {
|
|
76907
76908
|
unlinkSync4(announcement.path);
|
|
@@ -76914,7 +76915,7 @@ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, read
|
|
|
76914
76915
|
await waitForBroker(readyTimeoutMs);
|
|
76915
76916
|
return;
|
|
76916
76917
|
}
|
|
76917
|
-
const logFd = launch.kind === "direct" ? openSync4(
|
|
76918
|
+
const logFd = launch.kind === "direct" ? openSync4(getBrokerLogPath(), "a") : undefined;
|
|
76918
76919
|
let child;
|
|
76919
76920
|
try {
|
|
76920
76921
|
child = spawn(launch.command, launch.args, getBrokerSpawnOptions(extensionDir, logFd ?? "ignore", announcement));
|
|
@@ -76971,10 +76972,10 @@ async function isBrokerRunning() {
|
|
|
76971
76972
|
if (await checkSocketConnectable()) {
|
|
76972
76973
|
return true;
|
|
76973
76974
|
}
|
|
76974
|
-
if (!existsSync9(
|
|
76975
|
+
if (!existsSync9(getBrokerPidPath()))
|
|
76975
76976
|
return false;
|
|
76976
76977
|
try {
|
|
76977
|
-
const pid = parseInt(readFileSync7(
|
|
76978
|
+
const pid = parseInt(readFileSync7(getBrokerPidPath(), "utf-8").trim(), 10);
|
|
76978
76979
|
if (!Number.isFinite(pid))
|
|
76979
76980
|
return false;
|
|
76980
76981
|
process.kill(pid, 0);
|
|
@@ -76984,20 +76985,20 @@ async function isBrokerRunning() {
|
|
|
76984
76985
|
}
|
|
76985
76986
|
}
|
|
76986
76987
|
function checkSocketConnectable() {
|
|
76987
|
-
return isSocketAnswering(
|
|
76988
|
+
return isSocketAnswering(getBrokerSocketPath());
|
|
76988
76989
|
}
|
|
76989
76990
|
function handSpawnLockToBroker(pid, owner) {
|
|
76990
76991
|
if (pid === undefined || !ownsSpawnLock(owner))
|
|
76991
76992
|
return false;
|
|
76992
76993
|
try {
|
|
76993
|
-
appendFileSync(
|
|
76994
|
+
appendFileSync(getBrokerSpawnLockPath(), `${pid}
|
|
76994
76995
|
`);
|
|
76995
76996
|
return true;
|
|
76996
76997
|
} catch {
|
|
76997
76998
|
return false;
|
|
76998
76999
|
}
|
|
76999
77000
|
}
|
|
77000
|
-
function ownsSpawnLock(owner, lockPath =
|
|
77001
|
+
function ownsSpawnLock(owner, lockPath = getBrokerSpawnLockPath()) {
|
|
77001
77002
|
try {
|
|
77002
77003
|
return readFileSync7(lockPath, "utf-8").startsWith(owner);
|
|
77003
77004
|
} catch {
|
|
@@ -77011,7 +77012,7 @@ function acquireSpawnLock() {
|
|
|
77011
77012
|
${Date.now()}
|
|
77012
77013
|
`;
|
|
77013
77014
|
try {
|
|
77014
|
-
writeFileSync6(
|
|
77015
|
+
writeFileSync6(getBrokerSpawnLockPath(), owner, { flag: "wx" });
|
|
77015
77016
|
return owner;
|
|
77016
77017
|
} catch (error) {
|
|
77017
77018
|
if (!(error instanceof Error) || error.code !== "EEXIST") {
|
|
@@ -77019,7 +77020,7 @@ ${Date.now()}
|
|
|
77019
77020
|
}
|
|
77020
77021
|
if (isSpawnLockStale()) {
|
|
77021
77022
|
try {
|
|
77022
|
-
unlinkSync4(
|
|
77023
|
+
unlinkSync4(getBrokerSpawnLockPath());
|
|
77023
77024
|
} catch {}
|
|
77024
77025
|
continue;
|
|
77025
77026
|
}
|
|
@@ -77036,7 +77037,7 @@ function isProcessAlive(pid) {
|
|
|
77036
77037
|
return error.code === "EPERM";
|
|
77037
77038
|
}
|
|
77038
77039
|
}
|
|
77039
|
-
function isSpawnLockStale(lockPath =
|
|
77040
|
+
function isSpawnLockStale(lockPath = getBrokerSpawnLockPath(), nowMs = Date.now()) {
|
|
77040
77041
|
if (!existsSync9(lockPath)) {
|
|
77041
77042
|
return false;
|
|
77042
77043
|
}
|
|
@@ -77055,7 +77056,7 @@ function isSpawnLockStale(lockPath = BROKER_SPAWN_LOCK, nowMs = Date.now()) {
|
|
|
77055
77056
|
return true;
|
|
77056
77057
|
}
|
|
77057
77058
|
}
|
|
77058
|
-
function releaseSpawnLock(owner, lockPath =
|
|
77059
|
+
function releaseSpawnLock(owner, lockPath = getBrokerSpawnLockPath()) {
|
|
77059
77060
|
if (!ownsSpawnLock(owner, lockPath))
|
|
77060
77061
|
return;
|
|
77061
77062
|
try {
|
|
@@ -77083,7 +77084,7 @@ ${describeBrokerLog()}`);
|
|
|
77083
77084
|
` + "The broker did not answer on its socket in time; it may still be starting, which a busy machine or an empty jiti " + "cache slows. Try again, or raise `brokerStartupTimeoutMs` in the Intercom config.json (default " + `${BROKER_READY_TIMEOUT_MS} ms).
|
|
77084
77085
|
${describeBrokerLog()}`);
|
|
77085
77086
|
}
|
|
77086
|
-
var
|
|
77087
|
+
var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000;
|
|
77087
77088
|
var init_spawn = __esm(() => {
|
|
77088
77089
|
init_socket_liveness();
|
|
77089
77090
|
init_start_announcement();
|
|
@@ -77093,13 +77094,7 @@ var init_spawn = __esm(() => {
|
|
|
77093
77094
|
init_protocol_version();
|
|
77094
77095
|
init_shared_storage_setting();
|
|
77095
77096
|
init_paths();
|
|
77096
|
-
INTERCOM_DIR = getIntercomDirPath();
|
|
77097
77097
|
EXTENSION_DIR = resolveIntercomPackageRoot(import.meta.url);
|
|
77098
|
-
BROKER_SOCKET2 = getBrokerSocketPath();
|
|
77099
|
-
BROKER_PID = getBrokerPidPath();
|
|
77100
|
-
BROKER_SPAWN_LOCK = getBrokerSpawnLockPath();
|
|
77101
|
-
BROKER_LOG = getBrokerLogPath();
|
|
77102
|
-
BROKER_START_ANNOUNCEMENT = getBrokerStartAnnouncementPath();
|
|
77103
77098
|
BROKER_LOG_TAIL_BYTES = 8 * 1024;
|
|
77104
77099
|
});
|
|
77105
77100
|
|