Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The DeepSeek bridge can crash with
UnicodeEncodeErrorwhen model output contains characters that its piped stdout cannot encode. This loses thedsh.resultrecord, even when the agent succeeded. A Unicode preparation or launch error can also fail while being written to stderr, before the structured error is emitted.Emit ASCII-escaped JSONL so decoding restores the original Unicode text without changing the stream configuration. For stderr diagnostics, preserve the original text when encodable and fall back to ASCII escapes only on
UnicodeEncodeError. Result fields, exit codes, newline framing, and stdout flushing remain unchanged.Fixes #78.
Reproduction
Run this against the base revision to reproduce without a DeepSeek installation or API key:
The base raises
UnicodeEncodeError; the fix emits a JSON record whose decoded text is unchanged. This addresses bridge output encoding, separate from the subprocess decoding changes in #71 and the broader Windows support in #57.Validation
Tested on Windows with Python 3.13.5:
python -m pytest tests/test_deepseek_runner.py tests/test_provider_errors.py tests/test_runtime_signals.py -q: 30 passed.tests/test_deepseek_harness_adapter.py: 4 passed / 4 failed on both base and fix. The same pre-existing Windows failures require executable POSIX shell stubs or unavailableSIGHUP/killpgprimitives.git diff --checkpassed.The tests use mocked dsh results and real Python subprocesses.