Skip to content

fix(pod): decode localized schtasks output in the OEM code page - #38907

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/38541-schtasks-oem-decode
Nov 18, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/38541-schtasks-oem-decode

Conversation

@JLargent42

@JLargent42 JLargent42 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A localized schtasks refusal on a non-English Windows host shows its accented letters instead of replacement characters.

_schtasks_raw decodes schtasks.exe output as UTF-8, but schtasks.exe writes to a redirected pipe in the console's OEM code page. Every non-ASCII byte becomes U+FFFD, in the require_backend refusal and in the /Create and /Delete failure messages.

Why it matters

The refusal text is the only explanation an operator gets of why pods cannot run on the host. On a French host ERREUR : Acces refuse. loses both accented letters. Exit-code decisions are unaffected.

Not a goal

What changed (motivation → approach → change)

Symptom: U+FFFD in the refusal. Cause: **UTF8_TEXT on _schtasks_raw, while schtasks.exe writes the OEM page. Change: _schtasks_raw now decodes with _script_encoding() (Python's oem codec on Windows, UTF-8 elsewhere), the codec the wrapper .cmd already uses. It keeps errors="replace" and carries the # subprocess-encoding: locale marker. The UTF8_TEXT import in pod/windows.py is removed because nothing else used it.

Backwards compatibility

Compatible: ASCII and English output decode identically; only non-ASCII bytes change, from U+FFFD to the real letters.
Removes nothing: no key, function or behaviour is taken away.

Tests

  • test_schtasks_output_is_decoded_in_the_oem_code_page: cp437 bytes for three accented letters come back intact.
  • test_a_localized_refusal_reaches_the_operator_unchanged: a cp850 French /Create refusal appears unchanged in WindowsTaskCreateRefused.
  • test_an_ascii_refusal_reads_the_same_in_the_oem_page: ASCII is unchanged.

They stub subprocess.run with a fake that decodes the bytes with the encoding and errors the call passes, and patch _script_encoding, so they start no child and run on Linux. The first two fail on main ('/Z ���' != '/Z éüè') and pass here. Local: 452 related pod/spawn-audit/encoding-gate tests pass, check_subprocess_encoding.py, black, mypy and comment-history are clean.

Proof: not provable -- other: prove.py not run on this ARM host; checked by hand that two of the new tests fail on origin/main's windows.py and pass with the fix.

Manual verification

A maintainer must check this on Windows. It was written on Linux (aarch64) and the real oem codec and schtasks.exe were not run. Per the issue: _schtasks_raw(schtasks_bin(), "/Query", "/Z", <three OEM-437 letters>) should return those letters in stderr, and a French or German host's refusal should read correctly.

Screenshots / video

N/A — no UI change.

Related Issues

Fixes #38541

Sibling sweep

Swept: git grep -n "UTF8_TEXT" -- src/kiro_crew/pod/
Siblings: none -- _schtasks_raw is the only schtasks.exe spawn in pod/windows.py.

Pattern harvest

Not generalizable: one Windows tool wrongly pinned to UTF-8; the encoding lint gate already steers such sites to its locale marker.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@JLargent42
JLargent42 requested review from a team and KiroCrewCaptain as code owners November 18, 2026 01:57
@JLargent42 JLargent42 self-assigned this Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 0916380ee6d0bf66e7866204735aa05c0403e2c6 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 0916380ee6d0bf66e7866204735aa05c0403e2c6 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the change is display-only and easy to revert. schtasks output only feeds error messages, exit codes decide everything, and errors="replace" means a wrong codec cannot crash anything.

Notes

  • The claim that schtasks writes the OEM page to a pipe has not been checked on Windows, so the maintainer check on a French or German host that the description asks for should happen before merge.

[DESIGN-REVIEWED] 0916380

Description read

[DESCRIPTION-READ] 14454515502fc660a32280c7ba02e1c86285942e43607976fe8ed8e01d4b6818

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 0916380ee6d0bf66e7866204735aa05c0403e2c6 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. This is a one-site fix aimed at the cause, **UTF8_TEXT on the only schtasks.exe spawn, and it has an issue (#38541) and tests that fail on base.

Not checked: whether schtasks.exe writes OEM-page bytes to a redirected pipe. That is Windows-only, and the description asks a maintainer to confirm it.

Inventory (4 items) — 4 justified

Intent: an operator on a non-English Windows host reads schtasks refusal text with its real accented letters. This is a FIX.

  1. require_backend refusals and /Create//Delete failure messages show localized letters instead of U+FFFD — justified
  2. _schtasks_raw decodes with _script_encoding(), the codec the .cmd wrapper already uses, not a second spelling — justified
  3. The unused UTF8_TEXT import is removed from pod/windows.py — justified
  4. Three tests stub subprocess.run and pin OEM, cp850 and ASCII decoding — justified

The premise is not an availability-path risk: errors="replace" is kept and exit codes still decide, so a wrong codec only changes the text. Grepping _schtasks_raw\(|subprocess\.run\( in pod/windows.py finds one spawn site and its three callers, so there are no unfixed siblings.

[FIRST-PRINCIPLES-REVIEWED] 0916380

Description read

[DESCRIPTION-READ] 54b38f929cb3f2f779e912293ac2b7c7169cc4ed7071ef1a8ccd3eb837f83608

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 0916380ee6d0bf66e7866204735aa05c0403e2c6 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 0916380

Verdict parsed from the review's SHA-scoped output markers for commit 0916380ee6d0bf66e7866204735aa05c0403e2c6.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 0916380ee6d0bf66e7866204735aa05c0403e2c6 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 0916380ee6d0bf66e7866204735aa05c0403e2c6 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0916380

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0916380ee6d0bf66e7866204735aa05c0403e2c6 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 18, 2026
@JLargent42
JLargent42 force-pushed the fix/38541-schtasks-oem-decode branch from 7d9d82f to 1bbfe63 Compare November 18, 2026 02:48
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 18, 2026
@JLargent42
JLargent42 force-pushed the fix/38541-schtasks-oem-decode branch from 1bbfe63 to 0916380 Compare November 18, 2026 07:49
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 18, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: the decider estimates a 7% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes.

The change swaps the **UTF8_TEXT decode in _schtasks_raw for the OEM code page (via _script_encoding()) and keeps errors="replace". It also adds the # subprocess-encoding: locale marker that code-style.md asks for when a child writes in the console encoding. Every caller of _schtasks_raw/schtasks() decides by exit code. The output text only ends up in the WindowsTaskCreateRefused message, so a wrong codec can only garble that text. It cannot break control flow or crash. The removed UTF8_TEXT import was unused in pod/windows.py. The new tests decode bytes with the encoding the call passes, so they would fail with the old UTF-8 decode. CI is all green, including the Windows tests and the Pod Boot Canary (Windows).

Tier: 1, every tier gate passed.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 0916380ee6 · 63 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 18, 2026 11:04

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved automatically by the code change approver, not by a person. The decider estimates a 7% chance that this change introduces a defect, within the 12% limit for approving on its own, and the change has at most 400 changed lines.

The change swaps the **UTF8_TEXT decode in _schtasks_raw for the OEM code page (via _script_encoding()) and keeps errors="replace". It also adds the # subprocess-encoding: locale marker that code-style.md asks for when a child writes in the console encoding. Every caller of _schtasks_raw/schtasks() decides by exit code. The output text only ends up in the WindowsTaskCreateRefused message, so a wrong codec can only garble that text. It cannot break control flow or crash. The removed UTF8_TEXT import was unused in pod/windows.py. The new tests decode bytes with the encoding the call passes, so they would fail with the old UTF-8 decode. CI is all green, including the Windows tests and the Pod Boot Canary (Windows).

Tier: 1, every tier gate passed.
Criteria: no merge conflict, no owner block, no change request, the default branch, no security-sensitive path, no design document to agree on, the readiness status, the review lanes, the P0 history, the linked issues' tier, the review lessons, no concern label, the file count, a safe change category, not its own change, the decider, the security checklist, the change matches its title, no competing change.

Decider v3c (217fe607). To overrule it, request changes or dismiss this review.

@KiroCrewCaptain
KiroCrewCaptain merged commit 521a888 into main Nov 18, 2026
103 of 106 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/38541-schtasks-oem-decode branch November 18, 2026 11:05
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 18, 2026
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 18, 2026
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.

Localized schtasks stderr is decoded as UTF-8 in Windows pod refusals

2 participants