Skip to content

fix(service): explain a missing Windows scheduled task on start - #9043

Merged
lidge-jun merged 6 commits into
devfrom
fix/9038-windows-service-start-missing-task
Nov 25, 2026
Merged

lidge-jun merged 6 commits into
devfrom
fix/9038-windows-service-start-missing-task

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • When the Windows Task Scheduler backend fails to start, check whether the task is registered. A confirmed missing task now makes ocx service start exit 1 with the explicit ocx service install command.
  • Reuse the locale-independent, three-state registration probe on the failed-start path. A present or unreadable registration keeps the original failure. An explicit access denial keeps its existing guidance.
  • Document the start recovery path and cover absence, presence, unreadable results, and access denial with injected scheduler failures.

Refs #9038. This covers the missing-registration start diagnostic. The reported installation timeout and elevation behavior remain open. #9041 is related to the status lookup during installation.

Verification

  • bun test tests/windows/windows-scheduler-errors.test.ts tests/windows/windows-scheduler-install-verification.test.ts tests/service/service-start-environment.test.ts — 41 passed.
  • bun check --no-script --noEmit — no errors in 2,691 files.
  • bun scripts/structure-ssot.ts — passed.
  • cd docs-site && bun run build — static HTML generation completed and the updated lifecycle page was verified. Pagefind completion is still pending locally.
  • git diff --check — passed.
  • Local checks used Bun 1.4.4 on Linux with isolated homes and a bounded cgroup. Scheduler responses were injected. Live Windows Task Scheduler acceptance is pending.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults (none of those surfaces changed).

Summary by CodeRabbit

  • Bug Fixes
    • On Windows, ocx service start now checks whether the service is registered when startup fails. If registration is confirmed missing, it displays installation guidance and exits with a nonzero status. Other startup failures continue to report the original error.
  • Documentation
    • Updated the service-start guidance to explain how to install the service when Windows Task Scheduler registration is missing.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f554eda and 4123218.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The Windows Scheduler service-start path now checks task registration after a qualifying generic /run failure. It advises ocx service install only when the task is confirmed absent; other failures retain their original error. The CLI, tests, and service-start documentation reflect this behavior.

Changes: Windows Scheduler start recovery

Layer / File(s) Summary
Detect and handle confirmed task absence
src/service/windows-scheduler.ts, tests/windows/windows-scheduler-errors.test.ts
The recovery helper returns install advice only when a qualifying Scheduler /run error is followed by a probe confirming the task is absent. Tests cover absent, present, and unknown probe results, as well as other errors.
Wire recovery into the start command
src/service/cli.ts, docs-site/src/content/docs/reference/cli/lifecycle.md, structure/ops/service-and-sidecars.md
The CLI uses recovery for the Windows Scheduler backend. When recovery advice is returned, it reports the advice, sets a nonzero exit code, and skips the serving report. The documentation describes this behavior.

Estimated code review effort: 3 (Moderate) | ~15 minutes

Change: Bug fix

Possibly related issues

  • Issue 9038: The missing-task start-path behavior is addressed when the registration probe confirms absence. The issue’s separate installation timeout problem is not addressed.
Merge Risk: Minimal · previous review f554e

ocx service start now advises running ocx service install when a failed Windows Scheduler start is followed by a probe confirming the task is missing. All other failures keep their original error. No merge-blocking risk is identified; live Windows acceptance is still pending.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(service): explain a missing Windows scheduled task on start" matches the main change. The PR makes ocx service start detect a confirmed missing Windows Task Scheduler registration aft…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(service): explain a missing Windows scheduled task on start" matches the main change. The PR makes ocx service start detect a confirmed missing Windows Task Scheduler registration after a generic /run failure, exit with code 1, and advise running ocx service install. The docs and tests cover the same behavior. The title is specific, short, and uses a conventional prefix. It does not mention the exit code or the probe, but it does not need to cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 394af78 and f554eda.

Files selected for processing: 5

  • docs-site/src/content/docs/reference/cli/lifecycle.md
  • src/service/cli.ts
  • src/service/windows-scheduler.ts
  • structure/ops/service-and-sidecars.md
  • tests/windows/windows-scheduler-errors.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@Ingwannu

Copy link
Copy Markdown
Owner Author

Validation update for 2e7657f59fc9cc546acc4e01b4b5473750c2f7ba. The hosted docs build completed successfully, including the build step that generates search assets. The local build reached static HTML generation. I ended the redundant local indexing run after the hosted result became available. Live Windows acceptance is still pending.

lidge-jun and others added 4 commits November 25, 2026 10:29
Move the try/catch around the Scheduler start into startWindowsSchedulerService so
the advice-or-rethrow decision is exercised directly: one start attempt, advice only
for a confirmed missing registration, the original error otherwise.

Supersedes #9085, which reported the same missing-task start failure (#9038).

Co-authored-by: EnesKartal <43950508+EnesKartal@users.noreply.github.com>
@lidge-jun
lidge-jun marked this pull request as ready for review November 25, 2026 02:06
@lidge-jun
lidge-jun self-requested a review as a code owner November 25, 2026 02:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T02:07:25.872184Z f554eda Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration (lane W, @lidge-jun) at exact head 41232188769a63bbf0448545d294c04553452422. This covers the missing-registration half of #9038: ocx service start now exits 1 with the install command when Task Scheduler confirms the task is absent.

Changes I added since 2e7657f59:

  • f78fdef93 moves the start-or-explain decision into startWindowsSchedulerService, with a test for one start attempt, advice only on confirmed absence, and the original error otherwise. It carries a Co-authored-by trailer for @EnesKartal, because this supersedes fix(service): refuse cleanly when starting an uninstalled service #9085.
  • f89fb79cc keeps the literal ops.start(); that the environment-guard order check reads.
  • Merges from dev.

Relaxed merge gate, checked against dev 8d43c92f84:

  • (a) the head is 7 commits behind.
  • (b) merge-tree is clean (aaa6d5cebd).
  • (c) no intervening commit touches this PR's files. The only shared class both sides touch is docs-site/, and here that is one prose paragraph, not a count.
  • (d) the temporary merge adbb137da5 was not pushed. Typecheck is clean. The focused files windows-scheduler-errors, windows-scheduler-install-verification and service-start-environment give 42 pass / 0 fail. The guards give 53 pass / 0 fail. structure:check passes.

Evidence:

  • PR CI on this head: all checks pass. A cancelled gates job (its GUI-tests step was cancelled) was rerun and passed. The exact-head test changed job is the test:changed evidence (coordinator ruling).
  • Real Windows x64 (Bun 1.4.4), at f89fb79cc: the same three files give 42 pass / 0 fail. A live check ran a real schtasks /run against a random missing task name: the registration probe reported absent and the install advice was returned.
  • Independent gpt-6.1-terra review, two rounds: PASS. The remaining limit is that CLI printing and the exit code are covered by reading, not by a command-level test. Since that review, only dev was merged in.
  • assert-mergeable-review.sh --maintainer-integration 9043: OK.

@lidge-jun
lidge-jun merged commit 66367b7 into dev Nov 25, 2026
53 of 55 checks passed
@lidge-jun
lidge-jun deleted the fix/9038-windows-service-start-missing-task branch November 25, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants