Description
Jobs scheduled via the schtasks (Windows) backend fail with FILE NOT FOUND because the task action invokes a bare opencode binary that Task Scheduler cannot resolve.
Environment
- OS: Windows 10/11
- Backend:
schtasks
- opencode installed via scoop (shim on user
PATH)
Field evidence
- Task action using bare
opencode in schtasks /TR → Task Scheduler reports LastResult 2147942402 (0x80070002, FILE NOT FOUND); the plugin surfaces ENOENT -4058.
- Scoop shims live in the interactive user
PATH, which is invisible to the Task Scheduler session, so the bare name never resolves.
- Same task rewritten with the absolute opencode binary path →
LastResult 0, job runs.
Root cause
findOpencode() (src/index.ts:621) is POSIX-only (which/Unix candidate paths) and falls back to the bare opencode string on Windows.
- The generated
schtasks task sets no WorkingDirectory.
- The
schtasks backend has no stdout/stderr redirect to the scoped log (launchd/systemd backends have one), so the failure is silent unless you dig up LastResult.
Expected behavior
- Resolve the absolute opencode binary on Windows (scoop shim dir, default install locations,
where.exe).
- Set
WorkingDirectory on the schtasks task.
- Redirect task output to the scoped log via a
cmd wrapper, like the other backends.
A PR with the fix will reference this issue.
Description
Jobs scheduled via the
schtasks(Windows) backend fail with FILE NOT FOUND because the task action invokes a bareopencodebinary that Task Scheduler cannot resolve.Environment
schtasksPATH)Field evidence
opencodeinschtasks /TR→ Task Scheduler reportsLastResult 2147942402(0x80070002, FILE NOT FOUND); the plugin surfacesENOENT -4058.PATH, which is invisible to the Task Scheduler session, so the bare name never resolves.LastResult 0, job runs.Root cause
findOpencode()(src/index.ts:621) is POSIX-only (which/Unix candidate paths) and falls back to the bareopencodestring on Windows.schtaskstask sets noWorkingDirectory.schtasksbackend has no stdout/stderr redirect to the scoped log (launchd/systemd backends have one), so the failure is silent unless you dig upLastResult.Expected behavior
where.exe).WorkingDirectoryon theschtaskstask.cmdwrapper, like the other backends.A PR with the fix will reference this issue.