From 44441dd5d8ef817ca453ad0a7ca01b15794abdd7 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 8 Jan 2026 08:45:25 +0100 Subject: [PATCH] fix: clarify daemon status probe target --- docs/cli/index.md | 4 ++-- docs/gateway/index.md | 3 ++- src/cli/daemon-cli.ts | 3 +++ src/gateway/call.ts | 15 ++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/cli/index.md b/docs/cli/index.md index d3b8571be..8aa28d29f 100644 --- a/docs/cli/index.md +++ b/docs/cli/index.md @@ -424,12 +424,12 @@ Subcommands: - `daemon restart` 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 daemon’s resolved port/config (override with `--url/--token/--password`). - `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` 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` options: `--port`, `--runtime`, `--token`. +- `daemon install` options: `--port`, `--runtime`, `--token`, `--force`. ### `logs` Tail Gateway file logs via RPC. diff --git a/docs/gateway/index.md b/docs/gateway/index.md index 95dd92573..b060df1c2 100644 --- a/docs/gateway/index.md +++ b/docs/gateway/index.md @@ -170,13 +170,14 @@ clawdbot logs --follow ``` 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 daemon’s resolved port/config (override with `--url`). - `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` 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). - 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). +- `daemon install` is a no-op when already installed; use `clawdbot daemon install --force` to reinstall (profile/env/path changes). Bundled mac app: - Clawdbot.app can bundle a bun-compiled gateway binary and install a per-user LaunchAgent labeled `com.clawdbot.gateway`. diff --git a/src/cli/daemon-cli.ts b/src/cli/daemon-cli.ts index e73a62ed0..697de4ecd 100644 --- a/src/cli/daemon-cli.ts +++ b/src/cli/daemon-cli.ts @@ -207,6 +207,7 @@ async function probeGatewayStatus(opts: { password?: string; timeoutMs: number; json?: boolean; + configPath?: string; }) { try { await withProgress( @@ -224,6 +225,7 @@ async function probeGatewayStatus(opts: { timeoutMs: opts.timeoutMs, clientName: "cli", mode: "cli", + ...(opts.configPath ? { configPath: opts.configPath } : {}), }), ); return { ok: true } as const; @@ -447,6 +449,7 @@ async function gatherDaemonStatus(opts: { daemonCfg.gateway?.auth?.password, timeoutMs, json: opts.rpc.json, + configPath: daemonConfigSummary.path, }) : undefined; let lastError: string | undefined; diff --git a/src/gateway/call.ts b/src/gateway/call.ts index 1f66463f1..a381151a7 100644 --- a/src/gateway/call.ts +++ b/src/gateway/call.ts @@ -25,6 +25,11 @@ export type CallGatewayOptions = { instanceId?: string; minProtocol?: 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 = { @@ -36,13 +41,12 @@ export type GatewayConnectionDetails = { }; export function buildGatewayConnectionDetails( - options: { config?: ClawdbotConfig; url?: string } = {}, + options: { config?: ClawdbotConfig; url?: string; configPath?: string } = {}, ): GatewayConnectionDetails { const config = options.config ?? loadConfig(); - const configPath = resolveConfigPath( - process.env, - resolveStateDir(process.env), - ); + const configPath = + options.configPath ?? + resolveConfigPath(process.env, resolveStateDir(process.env)); const isRemoteMode = config.gateway?.mode === "remote"; const remote = isRemoteMode ? config.gateway?.remote : undefined; const localPort = resolveGatewayPort(config); @@ -107,6 +111,7 @@ export async function callGateway( const connectionDetails = buildGatewayConnectionDetails({ config, url: opts.url, + ...(opts.configPath ? { configPath: opts.configPath } : {}), }); const url = connectionDetails.url; const token =