Skip to content

fix(windows): resolve gcloud/gog/tailscale PATHEXT shims before spawn#74881

Merged
BradGroux merged 1 commit intoopenclaw:mainfrom
Angfr95:fix/windows-spawn-pathext-enoent
May 5, 2026
Merged

fix(windows): resolve gcloud/gog/tailscale PATHEXT shims before spawn#74881
BradGroux merged 1 commit intoopenclaw:mainfrom
Angfr95:fix/windows-spawn-pathext-enoent

Conversation

@Angfr95
Copy link
Copy Markdown
Contributor

@Angfr95 Angfr95 commented Apr 30, 2026

Closes #54470

Problem

On native Windows, openclaw webhooks gmail setup --account crashed with Error: spawn gcloud ENOENT. Node's child_process.spawn with shell: false does not consult PATHEXT, so bare gcloud, gog, and tailscale can fail even when Windows resolves them to valid .cmd / .exe shims.

Solution

  • Resolve gcloud, gog, and tailscale through a Windows-only PATH/PATHEXT filesystem probe before spawning.
  • Keep the resolver inert on macOS/Linux and for commands that already carry known Windows executable extensions.
  • Prefer .cmd, then .exe, then the first matching PATH/PATHEXT result, without executing where.exe during lookup.
  • Cover both Gmail entry points: gateway watcher and the documented openclaw webhooks gmail setup/run CLI path.
  • Route long-lived gog serve .cmd/.bat shims through pinned %SystemRoot%\System32\cmd.exe with argv escaping instead of raw direct .cmd spawn.

Real behavior proof

Maintainer-prepared Windows fix; proof: override is applied because this environment does not provide a native Windows Gmail/Tailscale setup for live after-fix capture. The repaired branch is validated with the Windows command-wrapper tests and the Gmail setup/watcher shards listed below, including PATH/PATHEXT resolver coverage that no longer shells out through where.exe.

Tests

  • pnpm test src/infra/executable-path.test.ts src/hooks/gmail-setup-utils.test.ts src/hooks/gmail.test.ts src/hooks/gmail-watcher-lifecycle.test.ts src/process/exec.windows.test.ts src/process/windows-command.test.ts
  • pnpm check:changed
  • pnpm exec oxfmt --check CHANGELOG.md src/infra/executable-path.ts src/infra/executable-path.test.ts src/hooks/gmail-watcher.ts src/hooks/gmail-ops.ts
  • pnpm lint:plugins:no-monolithic-plugin-sdk-entry-imports

Notes

  • pnpm plugin-sdk:api:check currently reports baseline hash drift on untouched main as well; this prepared branch no longer changes Plugin SDK exports.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL labels Apr 30, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 30, 2026

Codex review: needs maintainer review before merge.

Summary
The PR adds a Windows-only PATH/PATHEXT resolver for Gmail helper commands, applies it to gcloud, gog, and tailscale setup/watcher paths, wraps long-lived .cmd/.bat gog serve spawns through pinned cmd.exe, and adds tests plus a changelog entry.

Reproducibility: yes. source-reproducible. The linked bug gives concrete native Windows PowerShell steps, and current main still invokes bare helper names in the documented Gmail setup/run and gateway watcher paths; I did not run a native Windows live repro in this read-only review.

Real behavior proof
Override: The PR has proof: override and the body explains this is a maintainer-prepared Windows fix without native Windows Gmail/Tailscale live capture in this environment.

Next step before merge
No ClawSweeper repair lane is needed; the remaining action is normal PR review and required-check completion under the maintainer proof override.

Security
Cleared: The diff avoids the prior bare where.exe concern and does not add dependency, workflow, secret, or package-resolution risk.

Review details

Best possible solution:

Land the focused Windows Gmail helper fix after required checks finish, keeping the resolver scoped to helper spawn compatibility and the existing Windows-safe .cmd wrapper boundary.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible. The linked bug gives concrete native Windows PowerShell steps, and current main still invokes bare helper names in the documented Gmail setup/run and gateway watcher paths; I did not run a native Windows live repro in this read-only review.

Is this the best way to solve the issue?

Yes. The current PR direction is the narrowest maintainable fix I found: Windows-only filesystem PATH/PATHEXT resolution, no where.exe execution, coverage for setup/run/watcher helper paths, .cmd/.bat wrapping through pinned System32 cmd.exe, tests, and changelog.

What I checked:

  • current_main_bare_gcloud_and_tailscale: Current main still calls runCommandWithTimeout(["gcloud", ...]) and runCommandWithTimeout(["tailscale", ...]) in the Gmail setup utility, matching the linked Windows PATHEXT failure surface. (src/hooks/gmail-setup-utils.ts:159, 6c8974f3f5a9)
  • current_main_bare_gog_cli_path: The documented CLI run path still directly spawns gog and uses bare gog for watch renewal on current main. (src/hooks/gmail-ops.ts:361, 6c8974f3f5a9)
  • current_main_bare_gog_watcher_path: The gateway Gmail watcher still invokes bare gog for both watch start and watch serve on current main. (src/hooks/gmail-watcher.ts:43, 6c8974f3f5a9)
  • documented_cli_surface: Docs define openclaw webhooks gmail setup --account you@example.com and openclaw webhooks gmail run as supported user-facing commands. Public docs: docs/cli/webhooks.md. (docs/cli/webhooks.md:21, 6c8974f3f5a9)
  • pr_patch_covers_prior_blockers: The public PR patch adds resolveExecutable, uses it for gcloud, tailscale, and both CLI/watcher gog paths, removes the prior where.exe lookup concern, and adds a single-line changelog fix entry. (cdcbad03b5c2)
  • windows_cmd_wrapper_contract: Current process infrastructure already treats .cmd/.bat as requiring pinned System32 cmd.exe plus metacharacter rejection; the PR mirrors that boundary for direct long-lived spawn() calls. (src/process/exec.ts:20, 6c8974f3f5a9)

Likely related people:

  • steipete: GitHub commit history shows the original Gmail hooks wizard and several later Gmail hook refactors/maintenance commits, plus adjacent exec infra trimming. (role: introduced behavior and recent maintainer; confidence: high; commits: 523d9ec3c2e4, 77db65d6692b, 7f3f108521f4; files: src/hooks/gmail-ops.ts, src/hooks/gmail-setup-utils.ts, src/hooks/gmail-watcher.ts)
  • jverdi: GitHub commit history shows the gateway Gmail watcher startup behavior was introduced in Gmail watcher: start when gateway (re)starts. (role: introduced gateway watcher behavior; confidence: medium; commits: ca9b0dbc887d; files: src/hooks/gmail-watcher.ts)
  • drobison00: Recent merged work hardened the Windows cmd.exe wrapper trust boundary that this PR reuses for .cmd/.bat helper shims. (role: recent Windows command-wrapper maintainer; confidence: high; commits: 982d123b8052; files: src/process/exec.ts, src/infra/windows-install-roots.ts)
  • pgondhi987: Recent Gmail setup work changed the gcloud execution environment to block workspace CLOUDSDK_PYTHON override, directly adjacent to the helper spawn path touched here. (role: recent adjacent gcloud setup maintainer; confidence: medium; commits: 86251f43916d; files: src/hooks/gmail-setup-utils.ts)
  • vincentkoc: Recent Windows process/runtime fixes touched command output decoding and Windows exec shim handling, which are adjacent to this spawn compatibility path. (role: adjacent Windows process maintainer; confidence: medium; commits: e6d2c9b08005, 25a3d3797075; files: src/process/exec.ts)

Remaining risk / open question:

  • One GitHub check run, checks-node-core-runtime-media-ui, was still in progress for the reviewed head SHA at review time.
  • This read-only review did not independently run a native Windows Gmail/Tailscale setup; it relies on the maintainer proof override, source inspection, and CI/check evidence.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 6c8974f3f5a9.

@Angfr95 Angfr95 force-pushed the fix/windows-spawn-pathext-enoent branch from c17ac87 to 423d53c Compare April 30, 2026 05:51
@openclaw-barnacle openclaw-barnacle Bot added size: L size: S and removed size: XL docs Improvements or additions to documentation size: L labels Apr 30, 2026
@BradGroux BradGroux force-pushed the fix/windows-spawn-pathext-enoent branch from b8f557f to 815b7d9 Compare May 5, 2026 05:08
@openclaw-barnacle openclaw-barnacle Bot added size: M triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed size: S labels May 5, 2026
@BradGroux BradGroux force-pushed the fix/windows-spawn-pathext-enoent branch from 815b7d9 to 6f238d6 Compare May 5, 2026 05:11
@BradGroux BradGroux added the proof: override Maintainer override for the external PR real behavior proof gate. label May 5, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 5, 2026
@BradGroux BradGroux force-pushed the fix/windows-spawn-pathext-enoent branch from 6f238d6 to cdcbad0 Compare May 5, 2026 05:13
@BradGroux BradGroux merged commit f126f72 into openclaw:main May 5, 2026
94 checks passed
@BradGroux
Copy link
Copy Markdown
Member

Merged after maintainer prep.

  • Prepared head: cdcbad03b5c2af1610fe46b0c2b78fda47917b45
  • Merge commit: f126f72d6388be6b7dfa528fc5e4ab3f3c7d1710
  • GitHub checks: green at the prepared head before merge; proof: override applied for the external-PR real behavior proof gate because this maintainer environment has no native Windows Gmail/Tailscale setup
  • Local verification: pnpm test src/infra/executable-path.test.ts src/hooks/gmail-setup-utils.test.ts src/hooks/gmail.test.ts src/hooks/gmail-watcher-lifecycle.test.ts src/process/exec.windows.test.ts src/process/windows-command.test.ts; pnpm check:changed; pnpm exec oxfmt --check CHANGELOG.md src/infra/executable-path.ts src/infra/executable-path.test.ts src/hooks/gmail-watcher.ts src/hooks/gmail-ops.ts; pnpm lint:plugins:no-monolithic-plugin-sdk-entry-imports
  • Note: pnpm plugin-sdk:api:check reports the same baseline hash drift on untouched main, so this branch avoided SDK export changes instead of updating the baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proof: override Maintainer override for the external PR real behavior proof gate. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: openclaw webhooks gmail setup fails on native Windows with Error: spawn gcloud ENOENT

2 participants