Skip to content

fix(daemon): use exit code instead of localized text for schtasks fallback#85347

Merged
steipete merged 2 commits into
openclaw:mainfrom
Linux2010:fix/85255-schtasks-locale-fallback
May 22, 2026
Merged

fix(daemon): use exit code instead of localized text for schtasks fallback#85347
steipete merged 2 commits into
openclaw:mainfrom
Linux2010:fix/85255-schtasks-locale-fallback

Conversation

@Linux2010

Copy link
Copy Markdown
Contributor

Summary

Fixes shouldFallbackToStartupEntry() silently failing on non-English Windows systems by using exit code instead of localized error text matching.

Problem

The regex only matched English/Spanish error messages ("access is denied" / "acceso denegado"), causing silent fallback failure on non-English Windows systems (Chinese, Japanese, French, German, Korean, Russian, etc.).

Fix

  • Replace /access is denied|acceso denegado/i regex with params.code === 1
  • schtasks returns exit code 1 for access denied / generic failure regardless of system locale
  • Locale-independent, simpler, and more reliable

Files Changed

File Changes
src/daemon/schtasks.ts +1/-1

Fixes: #85255

…lback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-22 19:37 UTC / May 22, 2026, 3:37 PM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
Adds a code-1 schtasks /Create fallback trigger and a zh-CN Startup-folder fallback regression test.

Reproducibility: yes. Source inspection shows current main only recognizes English/Spanish denial text and timeout/no-output cases, so the linked zh-CN denial detail would miss the fallback path; I did not run Windows proof in this read-only review.

PR rating
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🐚 platinum hermit
Summary: The patch is small and well targeted, and maintainer proof override removes the merge gate, but direct Windows artifact proof is still absent.

Rank-up moves:

  • Maintainers can attach or request redacted Windows terminal/log proof if they want to reduce the code-1 compatibility risk before merge.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Override: A maintainer applied proof: override for this PR.

Risk before merge

  • The PR changes the final schtasks /Create failure behavior for every code-1 result, so a non-permission create failure with code 1 would now install and launch the Startup-folder fallback instead of surfacing a hard error.
  • Microsoft's public schtasks /create documentation does not guarantee that access-denied failures always map to exit code 1, so the merge relies on maintainer acceptance, live Windows knowledge, or the applied proof override. (learn.microsoft.com)
  • If a generic code-1 failure is not actually recoverable through the Startup-folder path, users may see a successful fallback install while Scheduled Task supervisor status is lost.

Maintainer options:

  1. Accept the proof override and broader fallback (recommended)
    Merge after normal checks if maintainers intentionally accept code 1 as a locale-independent fallback signal for this daemon install path.
  2. Require Windows exit-code proof
    Wait for redacted Windows output showing localized access denial returns code 1 and the Startup-folder launcher is created and started after this patch.
  3. Tighten the fallback predicate
    If maintainers do not want all code-1 create failures to fall back, require a narrower predicate backed by observed Windows outputs before merge.

Next step before merge
No automated repair lane is needed; the remaining action is maintainer acceptance of the proof override and the broader code-1 fallback before merge.

Security
Cleared: The diff changes one daemon fallback predicate and one focused test, with no dependency, CI, secret, permission, or downloaded-code changes.

Review details

Best possible solution:

Merge after normal checks if maintainers intend the proof override to accept the Windows exit-code behavior; otherwise request redacted Windows terminal/log proof before merge while keeping the existing text and timeout fallbacks.

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

Yes. Source inspection shows current main only recognizes English/Spanish denial text and timeout/no-output cases, so the linked zh-CN denial detail would miss the fallback path; I did not run Windows proof in this read-only review.

Is this the best way to solve the issue?

Yes, with maintainer acceptance of the broader exit-code trigger. Adding code 1 while preserving existing text and timeout fallbacks is the narrowest code fix shown here, but the external command contract is not documented by Microsoft.

Label changes:

  • add rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🦐 gold shrimp, patch quality is 🐚 platinum hermit, and The patch is small and well targeted, and maintainer proof override removes the merge gate, but direct Windows artifact proof is still absent.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Override: A maintainer applied proof: override for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a normal-priority Windows daemon install/update fix with limited platform-specific blast radius.
  • merge-risk: 🚨 compatibility: The PR changes existing error behavior by converting generic schtasks /Create code-1 failures into Startup-folder fallback installs.
  • merge-risk: 🚨 availability: The affected path controls whether the Gateway is registered or launched at login on native Windows after install/update.
  • rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🦐 gold shrimp, patch quality is 🐚 platinum hermit, and The patch is small and well targeted, and maintainer proof override removes the merge gate, but direct Windows artifact proof is still absent.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Override: A maintainer applied proof: override for this PR.

What I checked:

  • Current main fallback predicate is locale-sensitive: Current main only falls back for English/Spanish access-denied text, timeout code 124, and timeout/no-output details; it does not treat code 1 as fallback-worthy. (src/daemon/schtasks.ts:38, e0fda55cf7f4)
  • Current create-failure path throws unless the predicate matches: activateScheduledTask calls shouldFallbackToStartupEntry only after the final schtasks /Create attempt fails; otherwise it throws schtasks create failed. (src/daemon/schtasks.ts:914, e0fda55cf7f4)
  • Documented behavior expects fallback when task creation is denied: The user-facing daemon setup docs say native Windows tries Scheduled Tasks first and falls back to a per-user Startup-folder login item if task creation is denied. Public docs: docs/start/wizard-cli-reference.md. (docs/start/wizard-cli-reference.md:83, e0fda55cf7f4)
  • PR diff adds the missing code-based trigger and focused coverage: The provided PR context shows params.code === 1 || added to shouldFallbackToStartupEntry and a new test using stderr: "错误: 拒绝访问。" with code: 1. (src/daemon/schtasks.ts:40, 7307a5221faa)
  • Proof gate was explicitly overridden: The provided timeline shows steipete applied proof: override on 2026-05-22T19:32:06Z, after the earlier ClawSweeper comment requested real Windows proof.
  • Fallback behavior history: Commit 32d8ec9 introduced shouldFallbackToStartupEntry while hardening Windows gateway fallback launch. (src/daemon/schtasks.ts:38, 32d8ec948262)

Likely related people:

  • steipete: Introduced the Windows Startup-folder fallback predicate in 32d8ec9 and has multiple later daemon/schtasks maintenance commits, including test stabilization and lowercase helper refactors. (role: introduced fallback behavior and recent area owner; confidence: high; commits: 32d8ec948262, 1a68e55f474d, 572c5b6dd0ae; files: src/daemon/schtasks.ts, src/daemon/schtasks.startup-fallback.test.ts)
  • tmimmanuel: Authored the April 2026 change preserving Windows scheduled task restart/install behavior, including updates to schtasks.ts and startup-fallback tests. (role: recent Windows scheduled task behavior contributor; confidence: medium; commits: 0fef95b17d72; files: src/daemon/schtasks.ts, src/daemon/schtasks.startup-fallback.test.ts)
  • MoerAI: Authored the March 2026 fix accepting a localized/variant Last Result schtasks key, which is adjacent to Windows schtasks parsing and locale behavior. (role: adjacent schtasks locale contributor; confidence: medium; commits: 3e8bc9f16ac3; files: src/daemon/schtasks.ts)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Mossy Test Hopper

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: sniffs out flaky tests.
Image traits: location workflow harbor; accessory review stamp; palette moss green and polished brass; mood determined; pose peeking out from the egg shell; shell glossy opal shell; lighting bright celebratory glints; background quiet workflow signs.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Mossy Test Hopper in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@steipete steipete added the proof: override Maintainer override for the external PR real behavior proof gate. label May 22, 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 22, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 22, 2026
@steipete
steipete merged commit 501e74d into openclaw:main May 22, 2026
129 of 136 checks passed
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…lback (openclaw#85347)

* fix(daemon): use exit code instead of localized text for schtasks fallback

Problem:
- shouldFallbackToStartupEntry() only matched English/Spanish error messages
  ("access is denied" / "acceso denegado"), causing silent fallback failure
  on non-English Windows systems (Chinese, Japanese, French, German, etc.)

Fix:
- Replace regex matching with exit code check (params.code === 1)
- schtasks returns exit code 1 for access denied / generic failure
  regardless of system locale

Fixes: openclaw#85255

* test(daemon): cover localized schtasks fallback

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: override Maintainer override for the external PR real behavior proof gate. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shouldFallbackToStartupEntry fails on non-English Windows (locale blind spot)

2 participants