fix(agents): prevent unhandled promise rejection in bootstrap initialization#1933
Merged
fix(agents): prevent unhandled promise rejection in bootstrap initialization#1933
Conversation
…ization Add .catch() to bootstrap promises in OpenClawAgentManager, NanoBotAgentManager, and RemoteAgentManager to prevent unhandled rejection when agent initialization fails (e.g. gateway binary not found). The error still propagates when sendMessage() awaits bootstrap. Follows the same pattern already used in GeminiAgentManager. Fixes ELECTRON-E0
Contributor
Code Review #1933变更概述在 OpenClawAgentManager、NanoBotAgentManager、RemoteAgentManager 三个构造函数中各追加了 this.bootstrap.catch(() => {}) 一行,防止 agent 初始化失败时产生 unhandledRejection 事件(Sentry ELECTRON-E0)。同时新增 OpenClawAgentManagerBootstrap.test.ts 验证该行为。 方案评估结论:方案合理 这是 Node.js 处理存储型 Promise unhandledRejection 的标准做法:通过 .catch(() => {}) 挂起 rejection 观察者,使引擎不将其视为未处理,同时错误仍可通过 await this.bootstrap 正常传播。该 pattern 与 GeminiAgentManager:138 完全一致,本 PR 只是补齐了另外三个 manager。 问题清单无阻塞性问题。 结论批准合并 — 修复精准,与项目已有模式完全一致,测试覆盖充分,无阻塞性问题。 本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。 |
Contributor
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
wuhao1477
added a commit
to wuhao1477/AionUi
that referenced
this pull request
Mar 30, 2026
* 'main' of github.com:wuhao1477/AionUi: (40 commits) fix(agents): prevent unhandled promise rejection in bootstrap initialization (iOfficeAI#1933) fix(gemini): restore context after stopping a reply (iOfficeAI#1932) fix(codex): reject start promise immediately on process exit during startup (iOfficeAI#1929) fix(conversation): sync renamed titles with detail view (iOfficeAI#1927) fix(paste): deduplicate filenames when pasting multiple images simultaneously fix(mobile): add SafeArea support and update app icon (iOfficeAI#1926) fix(database): guard against undefined params in databaseBridge providers (iOfficeAI#1924) fix(conversation): validate type field before creating conversation (iOfficeAI#1921) fix(docs): restore wechat_group_5.png reference to wx-5.png in readme fix(snapshot): add maxBuffer to git add/commit exec calls (iOfficeAI#1914) refactor(acp): consolidate AGENT_SKILLS_DIRS into ACP_BACKENDS_ALL (iOfficeAI#1913) fix(gemini): guard against EACCES in workspace realpath during init (ELECTRON-BM) (iOfficeAI#1912) fix(channels): send raw QR ticket instead of page URL in WeChat WebUI login SSE (iOfficeAI#1910) .md format chore(pr-automation): fix missed sleep 5 in comment to sleep 10 chore(pr-automation): increase auto-merge retry delay to 10s chore(pr-automation): add 5s retry for transient GitHub mergeStateStatus UNKNOWN fix(docs): remove trailing whitespace in OfficeCLI readmes chore(pr-automation): verify auto-merge success before labeling bot:done fix(snapshot): guard against non-existent workspace in WorkspaceSnapshotService.init (iOfficeAI#1906) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.catch(() => {})tobootstrappromises inOpenClawAgentManager,NanoBotAgentManager, andRemoteAgentManagerto prevent Node.jsunhandledRejectionevents when agent initialization fails (e.g. gateway binary not found on PATH)sendMessage()awaitsthis.bootstrap, so callers get proper error handlingGeminiAgentManager(line 138)Sentry issue: ELECTRON-E0 — 6 occurrences, last seen 4 hours ago. Error:
Failed to start OpenClaw Gateway: Gateway exited with code 1causingunhandledPromiseRejectionon Windows whenopenclawbinary is not in PATH.Test plan
OpenClawAgentManagerBootstrap.test.tsverify:sendMessage()RemoteAgentManager.test.tsstill passes (23/23)bunx tsc --noEmitpassesbun run lint— 0 errors