Skip to content

fix: fall back to the Startup folder when Task Scheduler is denied - #5

Merged
StarsailsClover merged 1 commit into
mainfrom
v26.0-Alpha.5
Oct 4, 2026
Merged

StarsailsClover merged 1 commit into
mainfrom
v26.0-Alpha.5

Conversation

@StarsailsClover

Copy link
Copy Markdown
Member

Problem

Alpha.4's autostart install failed on the affected machine: schtasks /Create /SC ONLOGON returned Access is denied in a non-elevated session, so no persistent protection was installed even though the detection fix was correct.

Fix

  • --method auto|task|startup. auto still prefers Task Scheduler (logon daemon plus periodic check) and now falls back to a Startup-folder loop when task creation is denied.
  • The fallback script runs watch --once --quiet every N minutes (5 by default) and survives logons without administrator rights.
  • The immediate helper is started fully detached (Stdio::null, DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP) so the install command no longer hangs on inherited pipes.
  • autostart status and doctor report the Startup-script state.

Verified on the affected machine

  • autostart install now reports the fallback and writes %APPDATA%\...\Startup\KeepMyConfig.cmd.
  • Detached watch daemon running (PID recorded), journal shows watch_start.
  • watch --once --quiet exits 0; doctor reports protection ok and autostart ok.
  • ccswitch adopt --apply --force applied after the fix: 3/3 Codex providers now merge the common config, MCP table has 4 codex-enabled entries, database backup recorded.

Tests

  • 34 tests passing (18 core unit + 11 workflow + 3 CLI + 2 autostart); clippy -D warnings and fmt --check clean.

schtasks /Create /SC ONLOGON returns 'Access is denied' for non-elevated sessions on the affected host, so the Alpha.4 autostart install could not protect the machine. Auto mode now falls back to a Startup-folder loop that runs watch --once --quiet every N minutes, and the immediate helper starts fully detached (null stdio, DETACHED_PROCESS).

- add --method auto|task|startup and Startup-script reporting in status/doctor
- keep Task Scheduler as the preferred path when the host permits it
- regression test for the periodic loop script
@StarsailsClover
StarsailsClover merged commit 156e24e into main Oct 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant