fix: clarify daemon status probe target

This commit is contained in:
Peter Steinberger
2026-01-08 08:45:25 +01:00
parent 742850adae
commit 44441dd5d8
4 changed files with 17 additions and 8 deletions

View File

@@ -424,12 +424,12 @@ Subcommands:
- `daemon restart` - `daemon restart`
Notes: Notes:
- `daemon status` uses the same URL/token defaults as `gateway status` unless you pass `--url/--token/--password`. - `daemon status` probes the Gateway RPC by default using the daemons resolved port/config (override with `--url/--token/--password`).
- `daemon status` supports `--no-probe`, `--deep`, and `--json` for scripting. - `daemon status` supports `--no-probe`, `--deep`, and `--json` for scripting.
- `daemon status` also surfaces legacy or extra gateway services when it can detect them (`--deep` adds system-level scans). - `daemon status` also surfaces legacy or extra gateway services when it can detect them (`--deep` adds system-level scans).
- `daemon status` prints which config path the CLI uses vs which config the daemon likely uses (service env), plus the resolved probe target URL. - `daemon status` prints which config path the CLI uses vs which config the daemon likely uses (service env), plus the resolved probe target URL.
- `daemon install` defaults to Node runtime; use `--runtime bun` only when WhatsApp is disabled. - `daemon install` defaults to Node runtime; use `--runtime bun` only when WhatsApp is disabled.
- `daemon install` options: `--port`, `--runtime`, `--token`. - `daemon install` options: `--port`, `--runtime`, `--token`, `--force`.
### `logs` ### `logs`
Tail Gateway file logs via RPC. Tail Gateway file logs via RPC.

View File

@@ -170,13 +170,14 @@ clawdbot logs --follow
``` ```
Notes: Notes:
- `daemon status` probes the Gateway RPC by default (same URL/token defaults as `gateway status`). - `daemon status` probes the Gateway RPC by default using the daemons resolved port/config (override with `--url`).
- `daemon status --deep` adds system-level scans (LaunchDaemons/system units). - `daemon status --deep` adds system-level scans (LaunchDaemons/system units).
- `daemon status` reports **supervisor runtime** (launchd/systemd running) separately from **RPC reachability** (WS connect + status RPC). - `daemon status` reports **supervisor runtime** (launchd/systemd running) separately from **RPC reachability** (WS connect + status RPC).
- `daemon status` prints config path + probe target to avoid “localhost vs LAN bind” confusion and profile mismatches. - `daemon status` prints config path + probe target to avoid “localhost vs LAN bind” confusion and profile mismatches.
- `logs` tails the Gateway file log via RPC (no manual `tail`/`grep` needed). - `logs` tails the Gateway file log via RPC (no manual `tail`/`grep` needed).
- If other gateway-like services are detected, the CLI warns. We recommend **one gateway per machine**; one gateway can host multiple agents. - If other gateway-like services are detected, the CLI warns. We recommend **one gateway per machine**; one gateway can host multiple agents.
- Cleanup: `clawdbot daemon uninstall` (current service) and `clawdbot doctor` (legacy migrations). - Cleanup: `clawdbot daemon uninstall` (current service) and `clawdbot doctor` (legacy migrations).
- `daemon install` is a no-op when already installed; use `clawdbot daemon install --force` to reinstall (profile/env/path changes).
Bundled mac app: Bundled mac app:
- Clawdbot.app can bundle a bun-compiled gateway binary and install a per-user LaunchAgent labeled `com.clawdbot.gateway`. - Clawdbot.app can bundle a bun-compiled gateway binary and install a per-user LaunchAgent labeled `com.clawdbot.gateway`.

View File

@@ -207,6 +207,7 @@ async function probeGatewayStatus(opts: {
password?: string; password?: string;
timeoutMs: number; timeoutMs: number;
json?: boolean; json?: boolean;
configPath?: string;
}) { }) {
try { try {
await withProgress( await withProgress(
@@ -224,6 +225,7 @@ async function probeGatewayStatus(opts: {
timeoutMs: opts.timeoutMs, timeoutMs: opts.timeoutMs,
clientName: "cli", clientName: "cli",
mode: "cli", mode: "cli",
...(opts.configPath ? { configPath: opts.configPath } : {}),
}), }),
); );
return { ok: true } as const; return { ok: true } as const;
@@ -447,6 +449,7 @@ async function gatherDaemonStatus(opts: {
daemonCfg.gateway?.auth?.password, daemonCfg.gateway?.auth?.password,
timeoutMs, timeoutMs,
json: opts.rpc.json, json: opts.rpc.json,
configPath: daemonConfigSummary.path,
}) })
: undefined; : undefined;
let lastError: string | undefined; let lastError: string | undefined;

View File

@@ -25,6 +25,11 @@ export type CallGatewayOptions = {
instanceId?: string; instanceId?: string;
minProtocol?: number; minProtocol?: number;
maxProtocol?: number; maxProtocol?: number;
/**
* Overrides the config path shown in connection error details.
* Does not affect config loading; callers still control auth via opts.token/password/env/config.
*/
configPath?: string;
}; };
export type GatewayConnectionDetails = { export type GatewayConnectionDetails = {
@@ -36,13 +41,12 @@ export type GatewayConnectionDetails = {
}; };
export function buildGatewayConnectionDetails( export function buildGatewayConnectionDetails(
options: { config?: ClawdbotConfig; url?: string } = {}, options: { config?: ClawdbotConfig; url?: string; configPath?: string } = {},
): GatewayConnectionDetails { ): GatewayConnectionDetails {
const config = options.config ?? loadConfig(); const config = options.config ?? loadConfig();
const configPath = resolveConfigPath( const configPath =
process.env, options.configPath ??
resolveStateDir(process.env), resolveConfigPath(process.env, resolveStateDir(process.env));
);
const isRemoteMode = config.gateway?.mode === "remote"; const isRemoteMode = config.gateway?.mode === "remote";
const remote = isRemoteMode ? config.gateway?.remote : undefined; const remote = isRemoteMode ? config.gateway?.remote : undefined;
const localPort = resolveGatewayPort(config); const localPort = resolveGatewayPort(config);
@@ -107,6 +111,7 @@ export async function callGateway<T = unknown>(
const connectionDetails = buildGatewayConnectionDetails({ const connectionDetails = buildGatewayConnectionDetails({
config, config,
url: opts.url, url: opts.url,
...(opts.configPath ? { configPath: opts.configPath } : {}),
}); });
const url = connectionDetails.url; const url = connectionDetails.url;
const token = const token =