Skip to main content

classify_exit_reason

Function
This function is defined in the protocols module.
Map an exit cause to a supervisor-friendly exit code (pure). The single source of truth shared by the wrapper CLI and runtime entry point. Side-effect free so it is provable in isolation.

Signature

Parameters

'BaseException \| None'
required
The exception that terminated the process, or None for a clean shutdown.

Returns

int
data:GATEWAY_OK_EXIT_CODE (0) when exc is None or a KeyboardInterrupt/SystemExit(0) (clean stop).
  • :data:GATEWAY_FATAL_CONFIG_EXIT_CODE (78) for :class:FatalConfigError (do not restart — fix config).
  • :data:GATEWAY_RESTART_EXIT_CODE (75) for any other exception (transient — ask supervisor to restart).

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 4366