fix(mcp): suppress unhandled rejection from async gateway event handler#99895
fix(mcp): suppress unhandled rejection from async gateway event handler#99895cxbAsDev wants to merge 4 commits into
Conversation
The onEvent callback calls void this.handleGatewayEvent(event) without .catch(). If the async handler rejects, the unhandled promise rejection crashes the process. Add a noop catch handler. Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 4, 2026, 5:41 AM ET / 09:41 UTC. Summary PR surface: Source +2. Total +2 across 1 file. Reproducibility: no. live high-confidence reproduction is posted. Source inspection shows the async Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow bridge-boundary catch after after-fix proof shows an actual handler rejection is contained and logged; keep the GatewayClient callback contract unchanged unless maintainers want a broader async callback API. Do we have a high-confidence way to reproduce the issue? No live high-confidence reproduction is posted. Source inspection shows the async Is this the best way to solve the issue? Yes, this is an acceptable narrow fix for the bridge-owned async handler boundary. A broader GatewayClient Promise-return contract is possible, but current production sibling callbacks keep async work contained locally and the public callback type is AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a0e604862470. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +2. Total +2 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (6 earlier review cycles)
|
Co-Authored-By: Claude <[email protected]>
…ressing Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Summary
Add .catch() with process.stderr.write diagnostic to the MCP channel bridge onEvent callback. The async handler can reject; previously the rejection caused an unhandled rejection crash. Now the error is logged for observability.
Real behavior proof (required for external PRs)
Behavior addressed: void this.handleGatewayEvent(event) in an event callback without .catch(). If the handler rejects, the unhandledRejection crashes the process.
Real environment tested: Linux, Node 22, OpenClaw main
Before-fix evidence: void this.handleGatewayEvent(event) — rejection → unhandledRejection → crash
After-fix evidence: void this.handleGatewayEvent(event).catch(...) with process.stderr.write — rejection → logged → no crash. Uses same stderr diagnostic pattern as line 401-404 in the same file.
What was not tested: Triggering an actual rejection in handleGatewayEvent.
Risk
Low. Error logged for observability instead of crashing.
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]