-
-
Notifications
You must be signed in to change notification settings - Fork 57.1k
Closed
Description
Bug
The gateway crashes with an unhandled promise rejection when an embedded agent run times out after timeoutMs (default 600s):
02:29:59 [agent/embedded] embedded run timeout: runId=e3beb470-d7e8-4875-b96f-d922db3b0ffb sessionId=1cf5fc39-e717-4d2e-8047-c828f228f515 timeoutMs=600000
02:29:59 [clawdbot] Unhandled promise rejection: AbortError: This operation was aborted
at node:internal/deps/undici/undici:14902:13
at processTicksAndRejections (node:internal/process/task_queues:105:5)
The process then exits via process.exit(1) in infra/unhandled-rejections.js:27.
Root Cause
In agents/pi-embedded-runner/run/attempt.js, the abortRun function (line ~472-483) calls:
void activeSession.abort();When the timeout fires, abortRun(true) is invoked, which:
- Calls
runAbortController.abort(makeTimeoutAbortReason())— this correctly propagates through theabortable()wrapper and is caught at line ~658-660. - Calls
void activeSession.abort()— this internally cancels in-flight HTTP requests (fetch calls to the AI provider via Node's undici). Those fetch requests reject withAbortError: This operation was aborted. Since the promise fromactiveSession.abort()is discarded withvoid, the rejection is unhandled.
The unhandled rejection handler at infra/unhandled-rejections.js:22-28 does not filter AbortErrors, so it crashes the process.
Suggested Fix
Replace:
void activeSession.abort();With:
activeSession.abort().catch(() => { /* intentional: abort errors during timeout are expected */ });Alternatively, the registerUnhandledRejectionHandler API could be used to register a handler that suppresses AbortError rejections originating from timeout aborts, but catching at the call site is more precise.
Environment
- clawdbot 2026.1.24-3 (885167d)
- Node v22.22.0 (undici built-in fetch)
- macOS
Steps to Reproduce
- Start
clawdbot gateway - Trigger an embedded agent run (e.g. via webchat)
- Let it run until the timeout fires (600s by default, or configure a shorter
timeoutMs) - The process crashes with the AbortError shown above
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels