You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stopping during the workspace's initial scan ends the process with "Queue is closed" (exit 1) #323
If the framework is stopped while a workspace mount's initial scan is still running, the process ends with an unhandled error and exit code 1 instead of a clean stop:
17 | throw new Error('Queue is closed');
^
error: Queue is closed
at push (agent-framework/src/queue.ts:17:17)
at pushEvent (agent-framework/src/framework.ts:2711:16)
at pushEvent (agent-framework/src/module-registry.ts:750:10)
at initialScan (agent-framework/src/modules/workspace/index.ts:1010:17)
Seen on 0.22.0 (bfcfa9d) with connectome-host 0.10.0. It happened every time on hosts whose files mount takes more than a few seconds to scan: about 1,000 files and 1.5 GB in one case. In each case a host was started headless and told to shut down a few seconds after it reported ready, which is how provider-free rehearsals run.
Why
The scan isn't awaited.initialScan starts fire-and-forget: void this.initialScan(name), in modules/workspace/index.ts at lines 972 and 988.
A stop mid-scan throws twice. The scan's pass fails as the stop proceeds. Its catch then reports workspace:initial-scan-failed through this.ctx?.pushEvent(...) (line 1010), and that throws "Queue is closed" too.
Nothing catches it. The async function was started with void, so its rejection is unhandled and the runtime exits non-zero.
The workspace's own stop() drains mountTurns, but the queue it would report into is already closed by then.
Impact
A deliberate stop during the boot window reads as a crash: exit code 1 and an error stack in stderr.
Under Restart=on-failure (systemd) or launchd KeepAlive, a stop issued right after a start can become a restart.
The workspace event itself is harmless to lose. The exit code and the alarm are the problem.
Make the workspace module stop-aware. Keep the initialScan promise and await it (or abort it) in stop(), and skip pushEvent once this.stopped is set or the context is gone. The catch path also needs to stop throwing, since it runs exactly when a stop has interrupted the pass.
Related: #263 (late tool results after stop), #315 (start after stop).
#316 fixes this, and it merged into main as da01e800 at 01:40Z on Oct 14. After stop() closes the queue, a module's event is now dropped with a log line naming the module, instead of reaching queue.push. The workspace's initial scan pushes through its module context (pushEvent in src/module-registry.ts), which now goes to pushModuleEvent in src/framework.ts. So the scan's events and its workspace:initial-scan-failed report are both dropped that way, and neither throws. 0.22.0 doesn't have it, so hosts get it in the next release. I'm closing this as fixed by #316, and it can be reopened if a stop mid-scan still exits with an error on a build that has it.
Activity
nissa-seru commentedon Oct 14, 2026
#316 fixes this, and it merged into
mainasda01e800at 01:40Z on Oct 14. Afterstop()closes the queue, a module's event is now dropped with a log line naming the module, instead of reachingqueue.push. The workspace's initial scan pushes through its module context (pushEventinsrc/module-registry.ts), which now goes topushModuleEventinsrc/framework.ts. So the scan's events and itsworkspace:initial-scan-failedreport are both dropped that way, and neither throws. 0.22.0 doesn't have it, so hosts get it in the next release. I'm closing this as fixed by #316, and it can be reopened if a stop mid-scan still exits with an error on a build that has it.— Ada-1017
fix(calibration): the sample carries the request's system prompt and …
Merge pull request #763 from Anarchid/fix/calibration-request-overhead