fix(cli): dedupe onboard auth flags for completion cache · openclaw/openclaw@1e7ae07
steipete
·
2026-04-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -53,6 +53,9 @@ Docs: https://docs.openclaw.ai
|
53 | 53 | - Tooling/check:changed: pass parent heavy-check lock markers to lint lanes so |
54 | 54 | `pnpm check:changed` no longer waits on its own `lint:extensions` child. |
55 | 55 | Thanks @steipete. |
| 56 | +- CLI/completion: dedupe provider auth flags before registering `openclaw onboard` |
| 57 | + options, so completion-cache refresh during update no longer fails when stale |
| 58 | + core fallback flags overlap plugin manifest flags. Fixes #71667. |
56 | 59 | - Plugins/Bonjour: stop the gateway from crash-looping on `CIAO PROBING CANCELLED` when the mDNS watchdog cancels a stuck probe. Restores the rejection-handler wiring dropped during the bonjour plugin migration and shares unhandled-rejection state across module instances so plugin-staged copies of `openclaw/plugin-sdk/runtime` register into the same handler set the host consults. Especially affects Docker on macOS, where mDNS probing reliably hits the watchdog. Thanks @troyhitch. |
57 | 60 | - Google Meet: report pinned Chrome nodes as offline or missing capabilities in |
58 | 61 | setup/join diagnostics, keep inaccessible nodes out of auto-selection, and |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -26,6 +26,11 @@ vi.mock("../../commands/onboard-core-auth-flags.js", () => ({
|
26 | 26 | description: "Mistral API key", |
27 | 27 | optionKey: "mistralApiKey", |
28 | 28 | }, |
| 29 | +{ |
| 30 | +cliOption: "--openai-api-key <key>", |
| 31 | +description: "OpenAI API key (core fallback)", |
| 32 | +optionKey: "openaiApiKey", |
| 33 | +}, |
29 | 34 | ] as Array<{ cliOption: string; description: string; optionKey: string }>, |
30 | 35 | })); |
31 | 36 | |
@@ -156,6 +161,16 @@ describe("registerOnboardCommand", () => {
|
156 | 161 | ); |
157 | 162 | }); |
158 | 163 | |
| 164 | +it("dedupes provider auth flags before registering command options", async () => { |
| 165 | +await runCli(["onboard", "--openai-api-key", "sk-openai-test"]); |
| 166 | +expect(setupWizardCommandMock).toHaveBeenCalledWith( |
| 167 | +expect.objectContaining({ |
| 168 | +openaiApiKey: "sk-openai-test", // pragma: allowlist secret |
| 169 | +}), |
| 170 | +runtime, |
| 171 | +); |
| 172 | +}); |
| 173 | + |
159 | 174 | it("forwards --gateway-token-ref-env", async () => { |
160 | 175 | await runCli(["onboard", "--gateway-token-ref-env", "OPENCLAW_GATEWAY_TOKEN"]); |
161 | 176 | expect(setupWizardCommandMock).toHaveBeenCalledWith( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -47,10 +47,39 @@ const AUTH_CHOICE_HELP = formatAuthChoiceChoicesForCli({
|
47 | 47 | includeSkip: true, |
48 | 48 | }); |
49 | 49 | |
50 | | -const ONBOARD_AUTH_FLAGS = [ |
51 | | - ...CORE_ONBOARD_AUTH_FLAGS, |
52 | | - ...resolveManifestProviderOnboardAuthFlags(), |
53 | | -] as const; |
| 50 | +type OnboardAuthFlag = { |
| 51 | +readonly cliOption: string; |
| 52 | +readonly description: string; |
| 53 | +readonly optionKey: string; |
| 54 | +}; |
| 55 | + |
| 56 | +function extractCliFlags(cliOption: string): string[] { |
| 57 | +return cliOption |
| 58 | +.split(/[ ,|]+/) |
| 59 | +.filter((part) => part.startsWith("-")) |
| 60 | +.map((part) => { |
| 61 | +const equalsIndex = part.indexOf("="); |
| 62 | +return equalsIndex === -1 ? part : part.slice(0, equalsIndex); |
| 63 | +}); |
| 64 | +} |
| 65 | + |
| 66 | +function resolveOnboardAuthFlags(): OnboardAuthFlag[] { |
| 67 | +const seenCliFlags = new Set<string>(); |
| 68 | +const flags: OnboardAuthFlag[] = []; |
| 69 | +for (const flag of [...CORE_ONBOARD_AUTH_FLAGS, ...resolveManifestProviderOnboardAuthFlags()]) { |
| 70 | +const cliFlags = extractCliFlags(flag.cliOption); |
| 71 | +if (cliFlags.some((cliFlag) => seenCliFlags.has(cliFlag))) { |
| 72 | +continue; |
| 73 | +} |
| 74 | +for (const cliFlag of cliFlags) { |
| 75 | +seenCliFlags.add(cliFlag); |
| 76 | +} |
| 77 | +flags.push(flag); |
| 78 | +} |
| 79 | +return flags; |
| 80 | +} |
| 81 | + |
| 82 | +const ONBOARD_AUTH_FLAGS = resolveOnboardAuthFlags(); |
54 | 83 | |
55 | 84 | function pickOnboardProviderAuthOptionValues( |
56 | 85 | opts: Record<string, unknown>, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。