Repository navigation
Conversation
…CEILING_MS Fixes anthropics#1359. `run_end_ceiling_ms()` parsed `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS` with a bare `int(raw)`, so CLI-compatible scientific-notation spellings like `"1e6"` were treated as invalid and silently fell back to the 600_000ms default instead of 1_000_000. The value is now parsed by a small `_parse_run_end_ceiling_ms` helper that accepts plain integers (with surrounding whitespace, as before) plus integral scientific-notation spellings such as `1e6`, `1E6`, `2.5e3`. Everything else keeps the old behavior: - unset / invalid strings / empty -> 600_000 default - `"0"` -> 0 (no limit) - negatives -> default - non-integral values (`1.5`, `1e-1`) -> default - very large values are honored, then clamped downstream by the existing `_MAX_RUN_END_CEILING_MS` sleeper bound The parser also guards against absurd exponents (`1e999999999`) so it can never build a gigantic int. Adds a `"1e6" -> 1_000_000` regression case to `TestRunEndCeilingFromEnv.test_parse`. Full suite: 1588 passed, 6 skipped; `ruff check`, `ruff format --check`, and strict `mypy` are clean.
|
I found one boundary case in the exponent guard on the current PR head ( Running the parser from this head on Python 3.10.11 gives: That changes zero from the documented Would it make sense to handle |
0e19 (and any 0eN) keeps the documented 0 = no-limit semantics instead of falling into the _MAX_RUN_END_CEILING_MS fast path. Adds a 0e19 -> 0 regression case per review feedback.
|
Good catch — fixed. The zero coefficient is now handled before the large-shift guard, so |
Fixes #1359.
run_end_ceiling_ms()parsedCLAUDE_CODE_PRINT_BG_WAIT_CEILING_MSwith abare
int(raw), so CLI-compatible scientific-notation spellings like"1e6"were treated as invalid and silently fell back to the 600_000ms default
instead of 1_000_000.
The value is now parsed by a small
_parse_run_end_ceiling_mshelper thataccepts plain integers (with surrounding whitespace, as before) plus integral
scientific-notation spellings such as
1e6,1E6,2.5e3. Everything elsekeeps the old behavior:
"0"-> 0 (no limit)1.5,1e-1) -> default_MAX_RUN_END_CEILING_MSsleeper boundThe parser also guards against absurd exponents (
1e999999999) so it cannever build a gigantic int.
Adds a
"1e6" -> 1_000_000regression case toTestRunEndCeilingFromEnv.test_parse. Full suite: 1588 passed, 6 skipped;ruff check,ruff format --check, and strictmypyare clean.