fix(cli): preserve gateway status rpc probe semantics · openclaw/openclaw@2bf2fd6
obviyus
·
2026-04-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -57,10 +57,6 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
|
57 | 57 | exact: true, |
58 | 58 | policy: { |
59 | 59 | routeConfigGuard: "always", |
60 | | -// `gateway status` is a built-in daemon/RPC health path. Loading the |
61 | | -// full plugin registry here eagerly scans and validates every channel |
62 | | -// plugin before the command can even connect to the already-running |
63 | | -// gateway, which makes this frequently-used status check painfully slow. |
64 | 60 | loadPlugins: "never", |
65 | 61 | }, |
66 | 62 | route: { id: "gateway-status" }, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -43,21 +43,34 @@ export async function probeGatewayStatus(opts: {
|
43 | 43 | }, |
44 | 44 | async () => { |
45 | 45 | const { probeGateway } = await loadProbeGatewayModule(); |
46 | | -const probe = await probeGateway({ |
| 46 | +const probeOpts = { |
47 | 47 | url: opts.url, |
48 | 48 | auth: { |
49 | 49 | token: opts.token, |
50 | 50 | password: opts.password, |
51 | 51 | }, |
52 | 52 | tlsFingerprint: opts.tlsFingerprint, |
53 | 53 | timeoutMs: opts.timeoutMs, |
54 | | -includeDetails: opts.requireRpc === true, |
55 | | -detailLevel: opts.requireRpc === true ? "full" : "none", |
56 | | -}); |
57 | | -return probe; |
| 54 | +includeDetails: false, |
| 55 | +}; |
| 56 | +if (opts.requireRpc) { |
| 57 | +const { callGateway } = await import("../../gateway/call.js"); |
| 58 | +await callGateway({ |
| 59 | +url: opts.url, |
| 60 | +token: opts.token, |
| 61 | +password: opts.password, |
| 62 | +tlsFingerprint: opts.tlsFingerprint, |
| 63 | +method: "status", |
| 64 | +timeoutMs: opts.timeoutMs, |
| 65 | + ...(opts.configPath ? { configPath: opts.configPath } : {}), |
| 66 | +}); |
| 67 | +const authProbe = await probeGateway(probeOpts).catch(() => null); |
| 68 | +return { ok: true as const, authProbe }; |
| 69 | +} |
| 70 | +return await probeGateway(probeOpts); |
58 | 71 | }, |
59 | 72 | ); |
60 | | -const auth = result.auth; |
| 73 | +const auth = "auth" in result ? result.auth : result.authProbe?.auth; |
61 | 74 | if (result.ok) { |
62 | 75 | return { |
63 | 76 | ok: true, |
@@ -66,9 +79,7 @@ export async function probeGatewayStatus(opts: {
|
66 | 79 | kind === "read" |
67 | 80 | ? auth?.capability && auth.capability !== "unknown" |
68 | 81 | ? auth.capability |
69 | | - : // A successful detailed probe performs read RPCs, so it proves read access |
70 | | -// even when hello metadata cannot recover richer scope metadata. |
71 | | -"read_only" |
| 82 | + : "read_only" |
72 | 83 | : auth?.capability, |
73 | 84 | auth, |
74 | 85 | } as const; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。