Skip to content

fix(gateway): keep restart probe auth local#72405

Merged
vincentkoc merged 2 commits into
mainfrom
clownfish/ghcrawl-207050-agentic-merge
Apr 28, 2026
Merged

fix(gateway): keep restart probe auth local#72405
vincentkoc merged 2 commits into
mainfrom
clownfish/ghcrawl-207050-agentic-merge

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • Repair the restart-health probe auth path from fix(gateway): use configured probe auth during restart health checks #57374 so local restart probes never fall back to gateway.remote credentials.
  • Keep the configured local daemon auth plumbing for daemon restart, update restart, status restart inspection, and unmanaged restart checks.
  • Preserve focused regression coverage for local-mode auth, remote-mode separation, and unmanaged restart probes.

Review notes

Validation

  • pnpm check:changed
  • pnpm -s vitest run --config vitest.unit.config.ts src/cli/daemon-cli/lifecycle.test.ts src/cli/daemon-cli/restart-health.test.ts src/cli/daemon-cli/status.gather.test.ts
  • pnpm -s vitest run --config vitest.gateway.config.ts src/gateway/probe-auth.test.ts

ProjectClownfish replacement details:

openclaw@2026.4.6 check /tmp/projectclownfish-fix-v7xq2a/openclaw-openclaw
pnpm check:no-conflict-markers && pnpm tool-display:check && pnpm check:host-env-policy:swift && pnpm tsgo && pnpm lint && pnpm lint:webhook:no-low-level-body-read && pnpm lint:auth:no-pairing-store-group && pnpm lint:auth:pairing-account-scope

openclaw@2026.4.6 check:no-conflict-markers /tmp/projectclownfish-fix-v7xq2a/openclaw-openclaw
node scripts/check-no-conflict-markers.mjs

openclaw@2026.4.6 tool-display:check /tmp/projectclownfish-fix-v7xq2a/openclaw-openclaw
node --import tsx scripts/tool-display.ts --check

tool-display snapshot is up to date

openclaw@2026.4.6 check:host-env-policy:swift /tmp/projectclownfish-fix-v7xq2a/openclaw-openclaw
node scripts/generate-host-env-security-policy-swift.mjs --check

OK apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift

openclaw@2026.4.6 tsgo /tmp/projectclownfish-fix-v7xq2a/openclaw-openclaw
node scripts/run-tsgo.mjs

extensions/discord/src/draft-chunking.ts(27,17): error TS2339: Property 'draftChunk' does not exist on type 'DiscordAccountConfig'.
extensions/discord/src/draft-chunking.ts(28,29): error TS2339: Property 'draftChunk' does not exist on type 'DiscordConfig'.
extensions/memory-wiki/src/gateway.ts(74,7): error TS2536: Type '"respond"' cannot be used to index type 'T'.
extensions/memory-wiki/src/gateway.ts(79,29): error TS2741: Property 'code' is missing in type '{ message: string; }' but required in type '{ code: string; message: string; details?: unknown; retryable?: boolean | undefined; retryAfterMs?: number | undefined; }'.
extensions/memory-wiki/src/gateway.ts(158,13): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
extensions/memory-wiki/src/gateway.ts(232,13): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
extensions/memory-wiki/src/gateway.ts(279,13): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
extensions/memory-wiki/src/gateway.ts(310,57): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
extensions/memory-wiki/src/gateway.ts(323,55): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
extensions/memory-wiki/src/gateway.ts(336,58): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
extensions/memory-wiki/src/obsidian.test.ts(18,11): error TS2322: Type '(command: string, argv: ExecFileOptions | ExecFileOptionsWithBufferEncoding | ExecFileOptionsWithStringEncoding | readonly string[] | null | undefined) => Promise<...>' is not assignable to type '{ (file: string): PromiseWithChild<{ stdout: string; stderr: string; }>; (file: string, args: readonly string[] | null | undefined): PromiseWithChild<{ stdout: string; stderr: string; }>; (file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<...>; (file: string, args: readonly string[] | ... 1...'.
Target signature provides too few arguments. Expected 2 or more, but got 1.
extensions/memory-wiki/src/obsidian.test.ts(21,39): error TS2488: Type 'ExecFileOptions' must have a 'Symbol.iterator' method that returns an iterator.
extensions/memory-wiki/src/obsidian.test.ts(21,39): error TS2488: Type 'ExecFileOptionsWithBufferEncoding' must have a 'Symbol.iterator' method that returns an iterator.
extensions/memory-wiki/src/obsidian.test.ts(21,39): error TS2488: Type 'ExecFileOptionsWithStringEncoding' must have a 'Symbol.iterator' method that returns an iterator.
extensions/memory-wiki/src/obsidian.test.ts(21,39): error TS2488: Type 'null' must have a 'Symbol.iterator' method that returns an iterator.
extensions/memory-wiki/src/obsidian.test.ts(21,39): error TS2488: Type 'undefined' must have a 'Symbol.iterator' method that returns an iterator.
extensions/telegram/src/bot-message-dispatch.test.ts(408,22): error TS2353: Object literal may only specify known properties, and 'blockStreaming' does not exist in type 'TelegramAccountConfig'.
extensions/telegram/src/bot-message-dispatch.test.ts(669,7): error TS2322: Type '{ blockStreaming?: undefined; } | { blockStreaming: boolean; }' is not assignable to type 'TelegramAccountConfig | undefined'.
Type '{ blockStreaming?: undefined; }' has no properties in common with type 'TelegramAccountConfig'.
extensions/telegram/src/bot.helpers.test.ts(58,15): error TS2353: Object literal may only specify known properties, and 'draftChunk' does not exist in type 'TelegramAccountConfig'.
extensions/telegram/src/draft-chunking.ts(27,17): error TS2339: Property 'draftChunk' does not exist on type 'TelegramAccountConfig'.
extensions/telegram/src/draft-chunking.ts(28,30): error TS2339: Property 'draftChunk' does not exist on type 'TelegramConfig'.
src/auto-reply/reply.block-streaming.test.ts(113,17): error TS2322: Type '{ allowFrom: string[]; streaming?: "block" | undefined; }' is not assignable to type 'TelegramConfig'.
Types of property 'streaming' are incompatible.
Type '"block" | undefined' is not assignable to type 'ChannelPreviewStreamingConfig | undefined'.
Type '"block"' has no properties in common with type 'ChannelPreviewStreamingConfig'.
src/channels/plugins/setup-wizard-helpers.test.ts(984,11): error TS2559: Type 'string' has no properties in common with type 'ChannelPreviewStreamingConfig'.
src/commands/doctor-legacy-config.migrations.test.ts(387,11): error TS2559: Type 'string' has no properties in common with type 'ChannelPreviewStreamingConfig'.
src/config/config-misc.test.ts(466,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(466,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(467,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(475,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(478,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(489,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(489,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(490,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(497,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(500,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(510,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(510,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(511,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(519,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(522,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(533,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(533,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(534,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(546,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(549,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(561,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(561,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(562,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(570,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(573,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(592,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(592,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(593,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(611,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(614,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(617,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(628,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(628,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(629,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(639,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(642,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(655,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(655,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(656,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(678,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(681,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(682,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(711,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(711,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(712,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(751,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(754,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(755,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(756,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(759,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(760,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(763,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(821,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(821,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(822,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(883,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(886,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(887,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(890,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(891,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(894,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(895,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(931,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(931,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(932,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(940,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(944,33): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(957,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(957,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(958,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(976,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(979,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(1004,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(1004,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(1005,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(1031,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(1034,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(1037,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config-misc.test.ts(1063,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(1063,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(1064,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(1071,28): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(1086,11): error TS2304: Cannot find name 'withTempHome'.
src/config/config-misc.test.ts(1086,31): error TS7006: Parameter 'home' implicitly has an 'any' type.
src/config/config-misc.test.ts(1087,13): error TS2304: Cannot find name 'writeOpenClawConfig'.
src/config/config-misc.test.ts(1091,26): error TS2304: Cannot find name 'readConfigFileSnapshot'.
src/config/config-misc.test.ts(1093,38): error TS7006: Parameter 'issue' implicitly has an 'any' type.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(176,36): error TS2304: Cannot find name 'OpenClawConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(186,36): error TS2304: Cannot find name 'OpenClawConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(206,36): error TS2304: Cannot find name 'OpenClawConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(217,19): error TS2304: Cannot find name 'migrateLegacyConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(243,19): error TS2304: Cannot find name 'migrateLegacyConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(299,36): error TS2304: Cannot find name 'OpenClawConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(316,36): error TS2304: Cannot find name 'OpenClawConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(333,36): error TS2304: Cannot find name 'OpenClawConfig'.
src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts(341,19): error TS2304: Cannot find name 'migrateLegacyConfig'.
src/plugin-sdk/test-helpers.ts(2,28): error TS2459: Module '"node:fs/promises"' declares 'RmOptions' locally, but it is not exported.
 ELIFECYCLE  Command failed with exit code 2.
 ELIFECYCLE  Command failed with exit code 2.

@greptile-apps

greptile-apps Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the remote credential fallback bug in resolveGatewayProbeCredentialConfig by stripping token and password from gateway.remote when mode === "local", preventing local restart-health probes from inadvertently using remote gateway credentials. Two targeted regression tests are added to cover both the sync and async auth resolution paths.

Confidence Score: 4/5

Safe to merge; the fix is correct and well-targeted, with only a minor test organisation issue present.

Only P2 findings (misplaced test describe block). Core logic of stripping remote credentials for local-mode probes is sound, handles edge cases correctly, and is backed by two new regression tests.

No files require special attention beyond the minor test placement issue in src/gateway/probe-auth.test.ts.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/gateway/probe-auth.test.ts
Line: 135-163

Comment:
**Test placed in wrong describe block**

This test calls `resolveGatewayProbeAuthSafeWithSecretInputs` but lives inside `describe("resolveGatewayProbeAuthSafe")`. The `describe("resolveGatewayProbeAuthSafeWithSecretInputs")` block already exists lower in the file (line 199) and is the natural home for this case. Misplacement makes the suite output misleading and can confuse future contributors tracing failures back to the right function.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(gateway): keep restart probe auth lo..." | Re-trigger Greptile

Comment thread src/gateway/probe-auth.test.ts Outdated
@zssggle-rgb

Copy link
Copy Markdown
Contributor

Thanks for opening the replacement PR and preserving credit for #57374.

I agree with the Greptile P2: the SecretInputs regression test should be moved under the existing resolveGatewayProbeAuthSafeWithSecretInputs describe block.

The focused validation looks aligned with the changed files. The currently failing CI jobs seem to touch areas outside this PR’s changed files; could a maintainer confirm whether those are unrelated or need a rerun?

@zssggle-rgb

Copy link
Copy Markdown
Contributor

I could not push directly to this PR branch, so I opened a tiny follow-up PR targeting this PR head branch to address the Greptile P2 test placement comment: #72433.

It only moves the SecretInputs regression test under the matching resolveGatewayProbeAuthSafeWithSecretInputs describe block. Validation: pnpm -s exec vitest run --config test/vitest/vitest.gateway.config.ts src/gateway/probe-auth.test.ts.

@vincentkoc vincentkoc added the clawsweeper Tracked by ClawSweeper automation label Apr 27, 2026
@vincentkoc vincentkoc force-pushed the clownfish/ghcrawl-207050-agentic-merge branch from da48b76 to 8bb983c Compare April 27, 2026 06:04
@vincentkoc

Copy link
Copy Markdown
Member Author

ProjectClownfish pushed a narrow repair to this branch so the original contributor path can stay canonical.

Source PR: #72405
Validation: pnpm check:changed; pnpm -s vitest run --config test/vitest/vitest.gateway.config.ts src/gateway/probe-auth.test.ts
Contributor credit is preserved in the branch history and PR context.

@vincentkoc vincentkoc force-pushed the clownfish/ghcrawl-207050-agentic-merge branch from 8bb983c to 0d0ce1f Compare April 28, 2026 05:25
@vincentkoc vincentkoc merged commit ce01b8f into main Apr 28, 2026
12 checks passed
@vincentkoc vincentkoc deleted the clownfish/ghcrawl-207050-agentic-merge branch April 28, 2026 05:25
@clawsweeper clawsweeper Bot mentioned this pull request Apr 28, 2026
20 tasks
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix(gateway): keep restart probe auth local

* fix(gateway): repair local restart probe auth replacement
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* fix(gateway): keep restart probe auth local

* fix(gateway): repair local restart probe auth replacement
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
* fix(gateway): keep restart probe auth local

* fix(gateway): repair local restart probe auth replacement
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(gateway): keep restart probe auth local

* fix(gateway): repair local restart probe auth replacement
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix(gateway): keep restart probe auth local

* fix(gateway): repair local restart probe auth replacement
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix(gateway): keep restart probe auth local

* fix(gateway): repair local restart probe auth replacement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper Tracked by ClawSweeper automation gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants