Skip to content

fix: make helper output safe on non-UTF-8 consoles - #144

Open
motodriver wants to merge 3 commits into
browser-use:mainfrom
motodriver:fix/non-utf8-stdout
Open

fix: make helper output safe on non-UTF-8 consoles#144
motodriver wants to merge 3 commits into
browser-use:mainfrom
motodriver:fix/non-utf8-stdout

Conversation

@motodriver

@motodriver motodriver commented Sep 2, 2026

Copy link
Copy Markdown

Summary

  • configure stdout as UTF-8 with replacement in the four affected helper entry points
  • preserve the existing progress glyphs without crashing redirected non-UTF-8 streams
  • add a regression test using an ASCII-configured redirected stdout

Validation

  • python3 -m unittest discover -s tests -v (17 tests passed)
  • python3 -m py_compile helpers/render.py helpers/grade.py helpers/pack_transcripts.py helpers/transcribe_batch.py tests/test_stdout_encoding.py
  • git diff --check

AI assistance disclosure

TRAE assisted with issue analysis, implementation, regression-test drafting, and an independent P0-P2 review of this change. The human author reviewed the final diff and ran the validation commands listed above.

Closes #125


Summary by cubic

Fixes helper scripts crashing on non-UTF-8 consoles by reconfiguring stdout to UTF-8 with replacement. Redirected output now shows progress glyphs instead of failing.

  • Adds a regression test for ASCII-configured redirected stdout.

Closes #125.

Written for commit 28abe48. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread tests/test_stdout_encoding.py Outdated
Comment thread helpers/pack_transcripts.py Outdated
@motodriver

Copy link
Copy Markdown
Author

Addressed both review findings in ef03684:

  • extracted the shared stdout configuration into helpers/_util.py
  • parameterized the ASCII redirected-stream regression across pack_transcripts, render, grade, and transcribe_batch

Validation:

  • python3 -m unittest discover -s tests -v — 17 passed
  • python3 -m py_compile helpers/_util.py helpers/render.py helpers/grade.py helpers/pack_transcripts.py helpers/transcribe_batch.py tests/test_stdout_encoding.py — passed
  • git diff --check — passed

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread tests/test_stdout_encoding.py Outdated
@motodriver

Copy link
Copy Markdown
Author

Addressed the latest P2 review finding in 28abe48.

The regression now executes each helper's actual CLI entry point with --help under PYTHONIOENCODING=ascii, then emits a Unicode probe from an atexit callback. This makes the test fail if any helper's main() stops calling configure_stdout().

Validation:

  • python3 -m unittest tests.test_stdout_encoding -v — 1 passed
  • python3 -m unittest discover -s tests -v — 17 passed
  • python3 -m py_compile helpers/_util.py helpers/render.py helpers/grade.py helpers/pack_transcripts.py helpers/transcribe_batch.py tests/test_stdout_encoding.py — passed
  • git diff --check — passed

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.

Helpers crash with UnicodeEncodeError printing → on non-UTF-8 stdout (Windows)

1 participant