Repository navigation
Conversation
run_end_ceiling_ms parsed the environment value with int(), so a spelling the
CLI accepts fell through to the SDK default instead:
run_end_ceiling_ms({"CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS": "1e6"})
600000 # expected 1000000
The docstring already said the value is read "as the CLI will see it" and
named 1e6 as a spelling the CLI reads, so the two disagreed about the same
environment variable, and the SDK closed stdin earlier or later than the
caller configured.
Keep int() first and only fall back to a float read, so everything the plain
read already handled is untouched by construction: whitespace, 0, negatives,
and an integer too large for a float, which keeps its exact value and is
clamped later by the sleeper rather than becoming an infinity here. A
non-finite value falls back to the default.
Fixes anthropics#1359
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.
Fixes #1359.
run_end_ceiling_msparsed the environment value withint(), so a spelling the CLI accepts fell through to the SDK default:Taking option 1 from the issue, since the docstring already said the value is read "as the CLI will see it" and named
1e6as a spelling the CLI reads.The parse keeps
int()first and only falls back to a float read when that fails. That way everything the plain read already handled stays byte-for-byte unchanged rather than by my re-deriving it: whitespace around an integer,0, negatives, and an integer beyond float range, which keeps its exact value and gets clamped later by the sleeper instead of becoming an infinity here. A non-finite value falls back to the default.The six cases from your list, before and after:
1e61e2-1e3inf/nan"9" * 4000," 250 ",soon,"",-1Tested: six parameters added to
TestRunEndCeilingFromEnv.test_parseas you suggested. Two of them fail onmain(scientific,scientific_small); the other four are controls that pass either way, which is what makes them worth having. Full suite 1593 passed, 6 skipped.ruff check,ruff format --checkandmypy src/clean.One judgement call worth flagging, since the issue leaves it open: a non-integral value like
1.5now truncates to 1 rather than falling back. Milliseconds are integral and truncation is what a float ceiling means downstream, but if you would rather have1.5keep falling back to the default, say so and I will require the float to be integral.Not run: nothing end to end. The value only bounds
Query._arm_run_end_ceiling's wait, and the function is pure, so the parametrised test covers what changed.