Skip to content

fix(windows): recognize Traditional Chinese Task Scheduler states - #9160

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
chuenchen309:fix/windows-zh-tw-task-states
Nov 27, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
chuenchen309:fix/windows-zh-tw-task-states

Conversation

@chuenchen309

@chuenchen309 chuenchen309 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • On zh-TW Windows, schtasks /query /fo CSV /nh reports 就緒 (Ready), 已停用 (Disabled) and 執行中 (Running). The CSV fast path in parseTaskCsvState knows the zh-CN, ja-JP and ko-KR words but none of these, so on a Traditional Chinese host every task-state read falls through to the PowerShell Schedule.Service read. That is the PowerShell start the fast path exists to avoid within the 1 s manager-state cap ([Bug][Windows] zh-CN schtasks status makes ocx stop and ocx update fail closed inside the 1s manager-state cap #8863).
  • Recognize the four zh-TW status words from System32\zh-TW\schtasks.exe.mui. Running (執行中) and Queued (已排入佇列) stay active. Ready (就緒) and Disabled (已停用) prove inactivity. The zh-CN words don't cover zh-TW because the glyphs differ (就绪/就緒, 已禁用/已停用). structure/ops/windows-checked-stop.md lists zh-TW with the other locales.

Related to #8863. Same change as #8959 (ja-JP) and #8976 (ko-KR).

Verification

  • bun test tests/windows/windows-checked-stop-live.test.ts -t "zh-TW task state": all four new cases fail on unpatched dev (8ef1526) with Expected: "schtasks" / Received: "powershell", and pass with this change.
  • bun test tests/windows/windows-checked-stop-live.test.ts tests/windows/windows-checked-stop.test.ts tests/windows/windows-scheduler-install-verification.test.ts: 115 passed, 0 failed, 3 skipped (Linux, Bun 1.4.4).
  • On a zh-TW Windows 11 host (code page 950), the live schtasks /query /fo CSV /nh output showed only three status values across 305 tasks: 就緒 255, 已停用 41, 執行中 9. Decoding those raw bytes with decodeWindowsTextBytes(..., { locale: "zh-TW" }) and passing each row to the patched parseTaskCsvState classified all 305 rows, with no unknown. 已排入佇列 comes from the .mui string table because no task was queued at the time.
  • On the same host (warm), five runs of schtasks /query /tn <task> /fo CSV /nh took 21–42 ms and the powershell … Schedule.Service … .State fallback took 362–421 ms. So that fallback fit the 1 s cap on this warm host. This change removes the PowerShell start on zh-TW machines instead of fixing a failure I reproduced.
  • bun run typecheck, bun run structure:check, bun run privacy:scan and git diff --check pass.
  • bun run test:changed was stopped after 300 s without a result (it first installed the gui dependencies). I skipped the full suite as disproportionate for a locale-word change. The focused Windows suites above cover the changed parser and the stop and install checks that call it. Cross-platform coverage remains with repository CI.

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.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes
    • Windows Task Scheduler status reporting now recognizes additional Traditional Chinese, Korean, and Japanese status labels, including labels for tasks that are running, queued, ready, or disabled.
    • Unrecognized localized labels continue to use the existing numeric-state fallback, preserving status reporting where a text label is not recognized.

On zh-TW Windows, schtasks prints 就緒, 已停用 and 執行中, none of which
the CSV fast path knew, so every checked-stop state read started
PowerShell for the Schedule.Service fallback. Add the four zh-TW words
from System32\zh-TW\schtasks.exe.mui alongside the zh-CN, ja-JP and
ko-KR ones. Queued (已排入佇列) stays active, like the other locales.
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The checked-stop CSV state recognition now includes additional Korean and Japanese variants and Traditional Chinese (zh-TW) words. A test verifies four zh-TW mappings, and the documentation lists the added locale.

Changes: Localized Task Scheduler state recognition

Layer / File(s) Summary
CSV status mapping and validation
src/service/windows-checked-stop-live.ts:180-188, tests/windows/windows-checked-stop-live.test.ts:237-254, structure/ops/windows-checked-stop.md:185
The active and not-running status sets include additional Korean, Japanese, and zh-TW words. The test checks four zh-TW mappings and confirms that only the expected schtasks query runs. The documentation now lists zh-TW.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

Suggested reviewers: ingwannu, grayfoxey

Merge Risk: Minimal · up to fa1ba

This adds recognition of Traditional Chinese Task Scheduler state words so zh-TW Windows can avoid a PowerShell fallback. Classification behavior is unchanged, and there is no identified risk to merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(windows): recognize Traditional Chinese Task Scheduler states" matches the main change. The PR adds zh-TW Task Scheduler CSV status words (就緒, 已停用, 執行中, 已排入佇列) to the schtasks fast path…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "fix(windows): recognize Traditional Chinese Task Scheduler states" matches the main change. The PR adds zh-TW Task Scheduler CSV status words (就緒, 已停用, 執行中, 已排入佇列) to the schtasks fast path, and the new test and docs cover the same change. The title is specific and concise, and it names the platform, the locale, and the affected feature.

Finishing Touches

Generate unit tests (beta)

  • 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 8ef1526 and fa1baab.

Files selected for processing: 3

  • src/service/windows-checked-stop-live.ts
  • structure/ops/windows-checked-stop.md
  • tests/windows/windows-checked-stop-live.test.ts

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ✅ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

✅ 4/4 boxes ticked.

This pull request has been marked Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers notified: @lidge-jun @Ingwannu

Hygiene

✅ Deterministic PR hygiene checks passed.

@chuenchen309

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
github-actions Bot marked this pull request as ready for review November 26, 2026 11:25

@lidge-jun lidge-jun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Verified on exact head fa1baab (L4 review APPROVE via gpt-6.1-terra r2 continueFrom, 45 pass / 3 Windows-only skip in windows-checked-stop-live.test.ts + typecheck + structure:check + privacy:scan, exact-head PR CI green). Merging into dev (closes #9038).

@lidge-jun
lidge-jun merged commit cc139c0 into lidge-jun:dev Nov 27, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants