Skip to content

Harden Windows queue Planfile probes against non-UTF8 subprocess output#13

Merged
tom-sapletta-com merged 4 commits into
mainfrom
copilot/fix-unicode-decode-error
Jul 22, 2026
Merged

Harden Windows queue Planfile probes against non-UTF8 subprocess output#13
tom-sapletta-com merged 4 commits into
mainfrom
copilot/fix-unicode-decode-error

Conversation

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Queue mode still crashed on Windows with UnicodeDecodeError because some Planfile probe subprocesses were run in text mode, so Python reader threads decoded output as strict UTF-8 before Koru’s fallback logic could run. Ticket execution could complete, but probe paths still emitted background decode failures.

  • Probe subprocess decoding moved to byte-safe path

    • In src/koru/queue/ticket.py, switched probe calls from subprocess.run(..., text=True) to text=False in:
      • _python_has_planfile_cli
      • _planfile_supports_structured_queue_json
      • _configured_planfile_cmd_usable
    • Decoding is now routed through koru.queue.runners._decode_subprocess_output, aligning probe behavior with queue runner robustness.
  • Version / marker parsing now operates on safely decoded text

    • Structured-version detection and module-missing marker checks now parse decoded strings produced by the shared tolerant decoder, preventing code-page-specific byte sequences from crashing probe logic.
  • Regression coverage for non-UTF8 probe output

    • Added focused tests in tests/test_planfile_queue.py for:
      • non-UTF8 bytes in version probe output (including old/new version behavior)
      • non-UTF8 bytes in configured-command probe output on both failure and success paths
# Before (can crash in reader thread on Windows code page output)
subprocess.run(cmd, capture_output=True, text=True, ...)

# After (capture bytes, decode with queue-safe fallback)
proc = subprocess.run(cmd, capture_output=True, text=False, ...)
text = _decode_subprocess_output(proc.stdout)

Copilot AI changed the title [WIP] Fix UnicodeDecodeError in Windows queue mode subprocess Harden Windows queue Planfile probes against non-UTF8 subprocess output Jul 18, 2026
Copilot AI requested a review from tom-sapletta-com July 18, 2026 07:00
@tom-sapletta-com

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@tom-sapletta-com
tom-sapletta-com marked this pull request as ready for review July 22, 2026 06:08
@tom-sapletta-com
tom-sapletta-com merged commit eee1221 into main Jul 22, 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.

Windows queue mode still crashes subprocess reader threads with UnicodeDecodeError

3 participants