#5363·PraisonAI

`praisonai gateway status` is not machine-consumable: no `--json`, a hardcoded `1.0.0` version, and no single unified snapshot

Author: MervinPraisonCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbugclaude

Summary

The gateway already computes almost everything an operator or monitoring system needs — uptime, active session/client counts, per-channel supervision state, degraded owners, applied-vs-on-disk config revision and drift, and back-pressure telemetry. But the top-level operator command that exposes it, praisonai gateway status, has no --json flag, so its output cannot be parsed by scripts, health checks, or dashboards. This is inconsistent with sibling commands: gateway doctor and gateway test both support --json.

Two further rough edges compound it:

  1. The lightweight GET /info endpoint reports a hardcoded version string "1.0.0" (and the MCP serverInfo version is likewise hardcoded), rather than the installed package version — so automated version/upgrade checks are actively misled.
  2. There is no single snapshot an operator can fetch in one call: the rich data (applied_config_revision, config_drift, degraded owners, delivery backlog) lives only on GET /health, while GET /info returns a different, thinner set. Answering "is my gateway healthy, on the right config, and what version" requires combining /info, /health, and gateway status --deep.

For a gateway that aims to be world-class and easy to operate, "what is the state of my gateway" should be answerable in one machine-readable call.

Current behaviour

gateway status has no --json (unlike gateway doctor/gateway test) — src/praisonai-bot/praisonai_bot/cli/commands/gateway.py:553:

python
def status(
    deep: bool = typer.Option(False, "--deep"),
    probe: bool = typer.Option(False, "--probe"),
    daemon_only: bool = typer.Option(False, "--daemon-only"),
    # no --json flag; output is human-only text
): ...

GET /info returns a hardcoded version (src/praisonai-bot/praisonai_bot/gateway/server.py:1628):

python
# GET /info  (server.py:1621)
return {"name": ..., "version": "1.0.0", "agents": ..., "sessions": ..., "clients": ..., "api": ...}

The MCP server info is hardcoded the same way (src/praisonai-bot/praisonai_bot/gateway/api_endpoints.py:873):

python
"serverInfo": {"name": ..., "version": "1.0.0"}

The genuinely rich data exists but only on /health (src/praisonai-bot/praisonai_bot/gateway/server.py:6374), not on /info:

python
def health(self):
    return {
        "status": ..., "uptime": ...,
        "channels": ...,               # per-channel health + supervision state
        "degraded": ...,               # degraded channels/owners
        "applied_config_revision": ..., "on_disk_config_revision": ..., "config_drift": ...,
        "pressure": ...,               # back-pressure telemetry
        ...
    }

So the CLI cannot emit JSON, /info misreports the version, and no one endpoint returns health + sessions + degraded + delivery + config-revision together.

Desired behaviour

  • praisonai gateway status [--json] emits a single, stable, machine-readable JSON payload covering: version, uptime, daemon/service state, active sessions and clients, per-channel health/supervision, degraded owners, delivery backlog (outbox depth / DLQ / dead targets), applied_config_revision + config_drift, and protocol version.
  • /info (and the MCP serverInfo) report the installed package version from _version.py, not a hardcoded constant.
  • The unified snapshot is built once from the existing GatewayStatusProtocol.snapshot() / GatewayStatus core dataclass and reused by the CLI --json, the HTTP surface, and the agent-callable gateway_status tool, so all three stay consistent.

Layer placement

  • Primary layer: wrapper (praisonai / praisonai-bot)
  • Why not core: the introspection data contract already lives in core — GatewayStatusProtocol.snapshot() returns a GatewayStatus dataclass (run/queued/active_sessions/sessions_by_channel/delivery/degraded). The missing capability is the wrapper surfacing it as --json and fixing the version source; the core contract does not need to change (only reuse).
  • Why not wrapper: — (this is the wrapper) the CLI command, the HTTP /info//health handlers, and the version wiring all live in praisonai-bot.
  • Why not tools: this is operator/CLI/HTTP introspection, not an agent-callable integration (the agent-facing gateway_status tool already exists and should reuse the same snapshot).
  • Why not plugins: it is not a lifecycle hook, guardrail, or policy — it is first-party operator observability.
  • Secondary touch (optional): core — source a single version constant from praisonaiagents/_version.py / praisonai_bot/_version.py and (optionally) let the unified payload be assembled from the existing GatewayStatus dataclass so CLI/HTTP/tool agree.
  • 3-way surface (CLI + YAML + Python): no — this is operator introspection (CLI + HTTP), with the Python path already provided by GatewayStatusProtocol.snapshot().

Proposed approach

  • Extension point: CLI (--json on gateway status) + config/version source (real package version) + reuse of the existing core GatewayStatus snapshot for the HTTP payload.
  • Minimal API sketch:
    python
    # gateway status --json  -> prints json.dumps(snapshot)
    @gateway_app.command()
    def status(json_output: bool = typer.Option(False, "--json"), deep=..., probe=...):
        snap = handler.status(deep=deep, probe=probe)   # already builds the data
        if json_output:
            typer.echo(json.dumps(snap.to_dict(), default=str))
            return
        _render_status_text(snap)
    
    # server.py /info
    from praisonai_bot._version import __version__
    return {"name": ..., "version": __version__, "protocol_version": GATEWAY_PROTOCOL_VERSION, ...}

Resolution sketch

bash
# Before (today)
$ praisonai gateway status
Gateway: running (pid 4123)   # human-only text, not parseable
$ curl localhost:8000/info
{"name": "...", "version": "1.0.0", ...}   # hardcoded version, no config revision / degraded

# After (proposed)
$ praisonai gateway status --json
{"version": "2.x.y", "protocol_version": 1, "uptime_s": 3600,
 "active_sessions": 3, "clients": 2,
 "channels": {"telegram": {"state": "healthy"}},
 "degraded": [], "delivery": {"outbox_depth": 0, "dlq": 0, "dead_targets": 0},
 "applied_config_revision": "a1b2c3d4e5f6", "config_drift": false}
$ curl localhost:8000/info   # reports the installed package version
{"name": "...", "version": "2.x.y", "protocol_version": 1, ...}

Severity

Medium — the gateway is production-capable, but the absence of --json blocks monitoring, alerting, and CI health gates from consuming its state, and the hardcoded 1.0.0 version actively misleads upgrade/debug workflows. It is an ease-of-use and operability gap rather than a correctness bug.

Validation

  • src/praisonai-bot/praisonai_bot/cli/commands/gateway.py:553 — gateway status declares --deep/--probe/--daemon-only but no --json; confirmed gateway doctor and gateway test (same file) do accept --json.
  • src/praisonai-bot/praisonai_bot/gateway/server.py:1621 (/info handler) and :1628 — version returned as the literal "1.0.0".
  • src/praisonai-bot/praisonai_bot/gateway/api_endpoints.py:873 — MCP serverInfo version also hardcoded "1.0.0".
  • src/praisonai-bot/praisonai_bot/gateway/server.py:6374 (health()) — confirmed applied_config_revision, on_disk_config_revision, config_drift, degraded owners and back-pressure telemetry are present on /health but absent from /info.
  • src/praisonai-agents/praisonaiagents/gateway/protocols.py — GatewayStatusProtocol.snapshot() / GatewayStatus dataclass already exists in core and can back a unified payload; compute_config_revision (~line 1417) and GATEWAY_PROTOCOL_VERSION are available to include.
  • Searched open/closed issues for gateway status --json/machine-readable/version — none found; this is not a duplicate.