Skip to content

fix(startup): fall back to Run key when Task Scheduler fails#51

Merged
dbfx merged 3 commits intomainfrom
fix/startup-fallback-run-key
Mar 23, 2026
Merged

fix(startup): fall back to Run key when Task Scheduler fails#51
dbfx merged 3 commits intomainfrom
fix/startup-fallback-run-key

Conversation

@dbfx
Copy link
Contributor

@dbfx dbfx commented Mar 23, 2026

Summary

  • Reverted the broken Run key fallback — since the exe manifest is requireAdministrator, Windows silently skips HKCU Run entries, making the fallback a silent no-op
  • Improved the error toast: shorter title, descriptive subtitle pointing at likely causes (group policy, AV), and a "Learn more" action button linking to https://usekudu.com/help/startup-failed
  • Applied the same toast improvements to the Schedules page startup error path
  • Updated the comment in applyAutoLaunchWin32 to document why the Run key is not viable

Help page content

The toast links to https://usekudu.com/help/startup-failed — this page needs to be created. See below for a prompt to generate the content.

AI prompt for help page content

Write a support/help page for the URL path /help/startup-failed on a system cleaner app called Kudu (usekudu.com). The page should explain why the "Run at startup" toggle can fail on Windows and how to fix it.

Context for the AI:

  • Kudu uses Windows Task Scheduler (schtasks /Create) to register a logon-triggered task called "KuduStartup"
  • The app's exe manifest is requestedExecutionLevel: requireAdministrator, which means the HKCU Run registry key approach does NOT work (Windows silently skips Run-key entries for admin-manifest executables)
  • The app already runs elevated (UAC prompt on launch), so the failure is NOT a simple permissions issue
  • Common causes of failure: group policy restrictions on task creation, antivirus/endpoint protection software blocking schtasks, restricted enterprise environments (Citrix, terminal services), corrupted Task Scheduler service

Page should include:

  1. A brief explanation of what happened (the startup toggle failed because Kudu couldn't create a scheduled task)
  2. A numbered list of troubleshooting steps:
    • Check if Task Scheduler service is running (services.msc → "Task Scheduler" → should be Running/Automatic)
    • Check if group policy blocks task creation (corporate/managed machines — contact IT admin)
    • Temporarily disable antivirus and retry (some AV blocks schtasks for non-whitelisted apps)
    • Try creating the task manually: open Task Scheduler → Create Task → set trigger to "At log on" → set action to the Kudu exe path with --startup argument → set "Run with highest privileges"
    • As a last resort, reinstall Kudu and ensure you click "Yes" on the UAC prompt during first launch
  3. A "Still not working?" section pointing users to open a GitHub issue or contact support
  4. Keep the tone friendly, concise, and non-technical where possible. Use screenshots or step descriptions rather than command-line instructions where feasible.

Test plan

  • On Windows, toggle startup on when schtasks works → verify scheduled task is created
  • On Windows where schtasks is blocked → verify error toast shows with "Learn more" button
  • Click "Learn more" → verify it opens the help page URL
  • On Schedules page, enable a schedule when startup fails → verify same toast with link
  • Verify macOS/Linux startup behavior unchanged

🤖 Generated with Claude Code

Standard users, group policy restrictions, and some AV software can
block schtasks /Create, causing the "Run at startup" toggle to fail
with a confusing error toast. Instead of throwing, catch the failure
and fall back to Electron's app.setLoginItemSettings (HKCU Run key),
which requires no special permissions. When disabling, both the
scheduled task and the Run key entry are cleaned up.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c671e7e73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The HKCU Run key fallback cannot work because the exe manifest is
requestedExecutionLevel: requireAdministrator — Windows silently
skips Run-key entries for admin-manifest executables. Revert to
letting the error surface when schtasks fails (group policy, AV)
and update the toast message to point at the actual likely causes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the ui label Mar 23, 2026
Both the Settings and Schedules pages now show a "Learn more" action
button on the error toast that opens a help page explaining common
causes and workarounds for Task Scheduler restrictions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fe1f9dd25e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dbfx dbfx merged commit ac70237 into main Mar 23, 2026
8 checks passed
@dbfx dbfx deleted the fix/startup-fallback-run-key branch March 23, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant