fix: avoid duplicate doctor config output

This commit is contained in:
Peter Steinberger
2026-01-20 06:32:45 +00:00
parent d5ffc672dd
commit 5d7e38a786
4 changed files with 18 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ import { resolveChannelDefaultAccountId } from "../channels/plugins/helpers.js";
import { getChannelPlugin, listChannelPlugins } from "../channels/plugins/index.js";
import type { ChannelAccountSnapshot } from "../channels/plugins/types.js";
import { withProgress } from "../cli/progress.js";
import type { ClawdbotConfig } from "../config/config.js";
import { loadConfig } from "../config/config.js";
import { loadSessionStore, resolveStorePath } from "../config/sessions.js";
import { buildGatewayConnectionDetails, callGateway } from "../gateway/call.js";
@@ -501,9 +502,10 @@ export async function getHealthSnapshot(params?: {
}
export async function healthCommand(
opts: { json?: boolean; timeoutMs?: number; verbose?: boolean },
opts: { json?: boolean; timeoutMs?: number; verbose?: boolean; config?: ClawdbotConfig },
runtime: RuntimeEnv,
) {
const cfg = opts.config ?? loadConfig();
// Always query the running gateway; do not open a direct Baileys socket here.
const summary = await withProgress(
{
@@ -516,6 +518,7 @@ export async function healthCommand(
method: "health",
params: opts.verbose ? { probe: true } : undefined,
timeoutMs: opts.timeoutMs,
config: cfg,
}),
);
// Gateway reachability defines success; channel issues are reported but not fatal here.
@@ -526,13 +529,12 @@ export async function healthCommand(
} else {
const debugEnabled = isTruthyEnvValue(process.env.CLAWDBOT_DEBUG_HEALTH);
if (opts.verbose) {
const details = buildGatewayConnectionDetails();
const details = buildGatewayConnectionDetails({ config: cfg });
runtime.log(info("Gateway connection:"));
for (const line of details.message.split("\n")) {
runtime.log(` ${line}`);
}
}
const cfg = loadConfig();
const localAgents = resolveAgentOrder(cfg);
const defaultAgentId = summary.defaultAgentId ?? localAgents.defaultAgentId;
const agents = Array.isArray(summary.agents) ? summary.agents : [];