Repository navigation
Description
Bug Description
GitHubStep (src/specify_cli/workflows/step/github/__init__.py) invokes gh api via subprocess.run(..., capture_output=True, text=True) without specifying encoding="utf-8" or decoding bytes in the caller thread, even though GitHub REST API responses from gh api are UTF-8 JSON.
On Windows (where io.text_encoding(None) defaults to legacy code pages such as cp1252) or under non-UTF-8 locales:
- When the fetched GitHub issue or pull request JSON contains any UTF-8 byte undefined in
cp1252(such as0x90inU+1F41Bor后,0x9Din right double quotation marks, or0x81),subprocess._readerthreadfails withUnicodeDecodeError, leavingresult.stdout = None.return result.stdout.strip()then raisesAttributeError: 'NoneType' object has no attribute 'strip', which escapesGitHubStep.execute()(except (ValueError, OSError):) and crashes the workflow run instead of returningStepStatus.FAILED. - Even when all bytes are defined in
cp1252, non-ASCII label names (such ascafé) are decoded from UTF-8 (c3 a9) into mojibake (café), so existing labels are not matched (addedis not skipped) and post-write verification fails withGitHub step: GitHub did not apply label 'café' to issue #12.
By contrast, ShellStep (src/specify_cli/workflows/step/shell/__init__.py) captures raw bytes and decodes in the main thread specifically so reader-thread decode failures on Windows become clean StepStatus.FAILED results rather than unhandled exceptions.
Steps to Reproduce
- Run a workflow step with
type: github,operation: add-labelon Windows (cp1252default text encoding) against an issue whosegh apiUTF-8 JSON response body contains bytes such as0x90or0x9D(for example CJK text, smart quotes, or emoji), or against an issue carrying a non-ASCII label such ascafé. - Observe
GitHubStep.execute()raise an unhandledAttributeErrorin the first case and fail withGitHub did not apply labelin the second.
Expected Behavior
GitHubStep sends and decodes gh api JSON payloads as UTF-8 in the main thread, preserving non-ASCII issue/PR bodies and label names across all host locales and converting malformed non-UTF-8 output into a clean StepStatus.FAILED result.
Actual Behavior
subprocess.run(..., text=True) uses the host locale encoding in background reader threads, raising unhandled AttributeError: 'NoneType' object has no attribute 'strip' on Windows when gh api returns UTF-8 bytes undefined in cp1252, and failing label deduplication and verification on non-ASCII labels.
Specify CLI Version
main @ 59d61c5 (1.4.2 / 1.4.1.dev0)
AI Agent
opencode
Operating System
Windows 11 (10.0.26100)
Python Version
Python 3.14.7
Error Logs
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 37: character maps to <undefined>
AttributeError: 'NoneType' object has no attribute 'strip'
GitHub step: GitHub did not apply label 'café' to issue #12
Additional Context
Affects workflows using built-in type: github (add-label), such as the bundled bugfix and assess workflows when run locally on Windows.
AI Disclosure
Found, reproduced, and drafted autonomously with OpenCode using Gemini 4 Carbon (max reasoning effort, autonomous mode; bug discovery, reproduction, and issue text).
Activity
fix(workflows): decode gh api output as UTF-8 in github step (github#…