Gateway Safe Mode

Boot the gateway core-only to isolate whether a fault is in the core or an extension

Safe mode boots the gateway with external plugins and inbound YAML hooks disabled so an operator can tell whether a fault is in the core or an extension in one restart.

Diagram

No

Yes

🖥️ gateway start

🚦 –safe-mode?

🔌 Load plugins + hooks

⏭️ Skip plugins + hooks

✅ Core agent + channels serve traffic

Quick Start

  1. One restart
    bash
    praisonai gateway start --config gateway.yaml --safe-mode
    # → logs: SAFE MODE: N inbound hook(s) disabled; external plugins skipped (PRAISONAI_NO_PLUGINS)
  2. Via env var (crash loops / supervisors)
    bash
    PRAISONAI_NO_PLUGINS=1 praisonai gateway start --config gateway.yaml

How It Works

The CLI flag sets PRAISONAI_NO_PLUGINS=1 for the gateway process and forwards safe_mode=True to the handler; the server then skips inbound hook registration and logs the SAFE MODE: line before it listens.

Diagram
PluginManagerWebSocketGatewayGatewayHandlergateway start –safe-modeOperatorPluginManagerWebSocketGatewayGatewayHandlergateway start –safe-modeOperator–safe-mode / –pure / –no-pluginsset PRAISONAI_NO_PLUGINS=1start(safe_mode=True)_apply_hooks_from_config(cfg)SAFE MODE: N inbound hook(s) disableddiscover_entry_points()0 (plugins skipped)core agent + channels listening

The flag has three equivalent names — --safe-mode, --pure, --no-plugins — matching the aliases already used by praisonai run / chat / code. The env var PRAISONAI_NO_PLUGINS=1 is equivalent and useful where editing CLI args is awkward.


What Is Suppressed vs. Kept

Safe mode suppresses only extensions — the core agent and your configured channels keep serving traffic.

ComponentNormal modeSafe mode
Core agentOnOn
Configured channels (incl. entry-point channels)OnOn
External plugins (entry-point discovery)LoadedSkipped
Inbound YAML hooks: blockRegisteredSkipped (logged)
Forensics / scale-to-zero / crash-loop guard / config reloadOnOn (own toggles)
.praisonai/config.yamlUnchangedUnchanged

When To Use It

Reach for safe mode first when you cannot tell whether a fault lives in the gateway core or in an extension.

Diagram

Gateway misbehaving?

Not sure: core or extension?

One channel acting up

Want a plugin inventory first

gateway start –safe-mode

pause that channel

gateway doctor, then –safe-mode


Common Patterns

Bisect a fault — if a safe-mode boot is green, the problem is a plugin or hook; if it is still red, it is the gateway core:

bash
praisonai gateway start --config gateway.yaml --safe-mode

Supervised crash loop — set the env var in the service unit so the next crash-looped restart boots core-only:

bash
PRAISONAI_NO_PLUGINS=1 praisonai gateway start --config gateway.yaml

Pair with the gateway doctor — confirm which plugins would load, then boot safe mode to compare:

bash
praisonai gateway doctor --config gateway.yaml
praisonai gateway start --config gateway.yaml --safe-mode

Exit safe mode with a fresh start (not restart):

bash
praisonai gateway start --config gateway.yaml

Best Practices

Prefer the CLI flag over the env var in bug reports

The flag’s intent is explicit in the command line, so a reproduction is unambiguous.

Watch for the SAFE MODE: log line

That WARNING line is the single source of truth that safe mode is active and names how many inbound hooks were disabled.

Remember restart stays in safe mode

praisonai gateway restart replays the persisted safe-mode posture — exit with a fresh gateway start without the flag.

Safe mode is not a security posture

It is a triage switch, not authorization — use proper channel and token controls to secure the gateway.


Related