Skip to content

Fix run_in_loop.py: re-encode UTF-16LE to UTF-8 and pass reasoning_effort to the client - #230

Merged
t-timms merged 4 commits into
mainfrom
fix/run-in-loop-utf16
Sep 24, 2026
Merged

t-timms merged 4 commits into
mainfrom
fix/run-in-loop-utf16

Conversation

@t-timms

@t-timms t-timms commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Why

experiments/swebench_lite/run_in_loop.py had two independent problems:

  1. Unimportable. It is committed as UTF-16LE with a BOM (introduced in 0f66dc8, 2026-05-09; UTF-8 in a92656b and earlier). Python cannot import it:

    SyntaxError: source code string cannot contain null bytes
    

    scripts/validate_driver.py and the agent-in-loop path of experiments/swebench_lite/run.py both import run_in_loop, so both have been broken since. No test imports the module, so CI stayed green.

  2. Drops the configured reasoning effort. It builds LLMClient from thinking_budget only. For a Qwen3.5+/3.8 model the client then sends no chat-template kwargs, so the server's template default (xhigh thinking) applies regardless of reasoning_effort in settings. The benchmark silently runs a different configuration than the one requested.

Changes

  • Re-encode run_in_loop.py as UTF-8 (content and line endings unchanged).
  • Pass reasoning_effort=settings.reasoning_effort to LLMClient.
  • tests/test_source_encoding.py: every .py under src/, scripts/, experiments/, tests/, benchmarks/ (except benchmarks/fixtures/, which holds intentionally broken code) has no UTF-16 BOM, no NUL bytes, and parses.
  • tests/test_run_in_loop_wiring.py: with reasoning_effort: medium in the global settings.yaml, the client built by _run_one_async receives reasoning_effort="medium".

Verification

  • Scanned every tracked file for a UTF-16 BOM: run_in_loop.py was the only one.
  • Encoding test: with the old file restored it fails (1 failed, 464 passed, the failure is run_in_loop.py); with the fix 465 passed.
  • Wiring test: passes with the change, fails without it.
  • import run_in_loop now succeeds. ruff check / ruff format --check clean.

Note

GodspeedSettings() applies YAML but not GODSPEED_* env vars (only load_settings() does), and this runner uses the constructor, so its configuration has to come from settings.yaml.

Not verified

…TF-8

The file has been committed as UTF-16LE with a BOM since 0f66dc8 (2026-05-09).
Python cannot import such a source file:

    SyntaxError: source code string cannot contain null bytes

so `from run_in_loop import run_one` failed, which took down
scripts/validate_driver.py (it reports a setup error) and the agent-in-loop
path of experiments/swebench_lite/run.py. Nothing in the test suite imports the
module, so CI never noticed.

The content is unchanged; only the encoding is. Line endings are preserved.

Adds tests/test_source_encoding.py, which walks src/, scripts/, experiments/,
tests/ and benchmarks/ and asserts every .py file has no UTF-16 BOM, no NUL
bytes, and parses. A scan of all tracked files found run_in_loop.py to be the
only UTF-16 file.
@github-actions

Copy link
Copy Markdown

🤖 Godspeed Review

LLM review skipped (no API key configured).

Security

No secrets detected in changed files.

run_in_loop._run_one_async built its LLMClient from thinking_budget only and
dropped settings.reasoning_effort. For a Qwen3.5+/3.8 model the client then
sends no chat-template kwargs (_qwen_template_kwargs returns None), so the
server's template default (xhigh thinking) applies whatever the settings say:
the in-loop benchmark silently ran a different configuration than requested.

Adds tests/test_run_in_loop_wiring.py: it points the global settings.yaml at a
temp dir with `reasoning_effort: medium`, runs _run_one_async with a capturing
LLMClient subclass and a stub agent loop, and asserts the client received
reasoning_effort="medium". It fails without the one-line change.

Note for callers: GodspeedSettings() applies YAML but not GODSPEED_* env vars
(only load_settings() does), so benchmark configuration for this runner has to
come from settings.yaml.
@t-timms t-timms changed the title Re-encode run_in_loop.py from UTF-16LE to UTF-8 (unimportable since 2026-05-09) Fix run_in_loop.py: re-encode UTF-16LE to UTF-8 and pass reasoning_effort to the client Sep 24, 2026
@github-actions

Copy link
Copy Markdown

🤖 Godspeed Review

LLM review skipped (no API key configured).

Security

No secrets detected in changed files.

@github-actions

Copy link
Copy Markdown

🤖 Godspeed Review

LLM review skipped (no API key configured).

Security

No secrets detected in changed files.

@github-actions

Copy link
Copy Markdown

🤖 Godspeed Review

LLM review skipped (no API key configured).

Security

No secrets detected in changed files.

@t-timms
t-timms merged commit 2d5f9f7 into main Sep 24, 2026
9 checks passed
@t-timms
t-timms deleted the fix/run-in-loop-utf16 branch September 24, 2026 20:06
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.

1 participant