openclaw/PR_UNHANDLED_REJECTIONS.md

1.3 KiB
Raw Blame History

Proposal: Configurable gateway unhandled promise rejection policy

Motivation

Running Clawdbot Gateway in production-like environments can encounter transient network errors (undici fetch failed, DNS hiccups, Telegram API blips). Today, any unhandled promise rejection can terminate the gateway process (process.exit(1)), causing user-visible downtime and missed replies.

Diegos deployment uses systemd with Restart=always, but the restart still interrupts message handling.

Desired behavior

Add a JSON config knob to control what happens on unhandled promise rejections:

{
  gateway: {
    unhandledRejections: "warn" // or "exit"
  }
}
  • exit (default): keep current behavior for safety; exit 1 so supervisors restart.
  • warn: never exit the gateway for unhandled rejections; log as error/warn and continue.

Notes

  • Existing suppression for AbortError / transient network errors should remain regardless of mode.
  • In warn mode, non-network/unexpected unhandled rejections should still be logged loudly.

Acceptance criteria

  • With gateway.unhandledRejections="warn", a forced Telegram DNS failure should result in a logged error but the gateway process should remain running.
  • With exit (default), behavior remains unchanged.