fix(gateway): catch lazy import rejections in runtime event subscriptions#100401
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 8:48 PM ET / 00:48 UTC. Summary PR surface: Source +36, Tests +120, Docs +1. Total +157 across 4 files. Reproducibility: yes. Current main source shows three fire-and-forget lazy event dispatches without catch handlers, and the PR tests exercise the rejected module and handler failure paths. Review metrics: 1 noteworthy metric.
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 findings
Review detailsBest possible solution: Land the runtime and regression-test fix after removing the changelog line and adding redacted live/log proof or an explicit proof override. Do we have a high-confidence way to reproduce the issue? Yes. Current main source shows three fire-and-forget lazy event dispatches without catch handlers, and the PR tests exercise the rejected module and handler failure paths. Is this the best way to solve the issue? Yes for the runtime code: catching at the subscription-owned fire-and-forget boundary is the narrow maintainable fix. The changelog edit is not part of the best solution and should be removed. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 95f12178a794. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +36, Tests +120, Docs +1. Total +157 across 4 files. 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 (2 earlier review cycles) |
cecb4e1 to
7ca2bba
Compare
51fc6f5 to
b516390
Compare
|
Land-ready maintainer pass complete.
Known proof gap: no manual live Gateway fault injection was added beyond the deterministic module/handler regression tests. The failure boundary itself is exercised directly. |
4cbb940 to
007793b
Compare
|
Merged via squash.
|
…ions (openclaw#100401) * fix(gateway): catch lazy import rejections in runtime event subscriptions * fix(gateway): consolidate event dispatch failures * docs(changelog): note gateway event dispatch fix --------- Co-authored-by: Peter Steinberger <[email protected]>
…ions (openclaw#100401) * fix(gateway): catch lazy import rejections in runtime event subscriptions * fix(gateway): consolidate event dispatch failures * docs(changelog): note gateway event dispatch fix --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Gateway runtime subscriptions deliberately fire three lazy event handlers without awaiting them. On current main, a rejected module load, handler construction, synchronous handler call, or returned promise can escape that fire-and-forget boundary as an unhandled rejection.
Why This Change Was Made
The final implementation keeps event delivery asynchronous but routes agent, transcript, and lifecycle dispatch through one local helper that owns the rejection boundary. Failures are logged with the relevant run or session identifiers. The existing Gateway subsystem logger is passed from the only production caller.
The maintainer fixup also corrects the original warning semantics: the catch covers handler execution as well as lazy loading, so the log reports a dispatch failure rather than claiming every failure came from an import. Typed test parameters repair the original
check-test-typesfailure.User Impact
Transient Gateway event-handler failures no longer surface as unexplained process-level unhandled rejections. Operators get an actionable warning while unrelated Gateway subscriptions continue running.
Evidence
src/gateway/server-runtime-subscriptions.test.tscovers a rejected dynamic import plus transcript and lifecycle handler execution failures.Parameters<typeof startGatewayEventSubscriptions>[0], satisfying the concrete chat-abort and restart-recovery map types.007793be877c51c4fc095ac2a342f029f5faaf1f: clean, no actionable findings.git diff --check origin/main...HEAD: passed.AI assistance: Codex performed maintainer review, implementation cleanup, focused proof selection, and landing preparation.