Repository navigation
Conversation
…nvironment The summarizer's nested `claude -p` call (save, NDC compression, staging consolidation all route through the one `call_haiku`/`_run` spawn site) inherited CLAUDE_CODE_EFFORT_LEVEL from the parent process. A parent session that pins it to "max" -- the only way to keep max effort across sessions, since the effortLevel setting stops at xhigh -- sent Haiku into max-effort thinking on a summarization task: small saves still finished but at roughly five times the output tokens, and NDC/consolidation never finished inside their 180s timeout at all, so now.md stopped rotating and SessionStart silently stopped injecting it. CLAUDE_CODE_EFFORT_LEVEL is now popped and restored in _without_session_env, the same literal-name pop/restore mechanism already used for the ten other Claude Code session variables the nested call must not inherit, and the existing EXPECTED_SESSION_NAMES-driven tests (including the per-name parametrized removal test and its positive "an arbitrary variable survives" control) now exercise it automatically through the real call_haiku() path. CLAUDE_EFFORT is deliberately left alone, with a dedicated test pinning it: the reporter measured that unsetting only CLAUDE_CODE_EFFORT_LEVEL fixed the timeouts, and CLAUDE_EFFORT is not a Claude Code session variable the child would otherwise look like a resumable part of. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…_CODE_EFFORT_LEVEL docs/configuration.md's "put back afterwards" enumeration and the EXPECTED_SESSION_NAMES provenance comment both named the list of Claude Code session variables the nested claude -p strips, by literal name and by history, and neither mentioned the eleventh entry the previous commit added. Self-review (Explore) caught both as stale prose adjacent to the diff; fixed rather than filed, since both are one sentence of blast radius in the same two files the fix already touched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Closes #1128.
The summarizer's nested
claude -pinheritedCLAUDE_CODE_EFFORT_LEVELfrom the parent session's environment. Atmaxeffort the small save calls still finished but cost roughly 5x the output tokens, and the two larger calls (NDC compression, staging consolidation) never finished inside their 180s timeouts -- sonow.mdstopped rotating, grew pastsession_start_max_bytes, and SessionStart stopped injecting it._without_session_env()inpipeline/summarizer.pynow pops/restoresCLAUDE_CODE_EFFORT_LEVELthe same way it already pops/restores the other ten Claude Code session variables stripped before the single nestedclaude -pspawn site (call_haiku/_run, which save, NDC compression and staging consolidation all route through).CLAUDE_EFFORTis deliberately NOT stripped -- the issue reporter measured that unsetting onlyCLAUDE_CODE_EFFORT_LEVELfixed the timeouts, andCLAUDE_EFFORTis not a Claude Code session variable the child would otherwise look like a resumable part of.tests/test_summarizer_env_898.pygainedCLAUDE_CODE_EFFORT_LEVELin itsEXPECTED_SESSION_NAMEStuple, which several existing AST-based and behavioral tests already iterate over -- this alone turned 5 existing tests red before the fix and green after -- plus one new explicit test with a positive control (assertsCLAUDE_EFFORTsurvives in the child's env whileCLAUDE_CODE_EFFORT_LEVELdoes not, and that the parent's own environment is restored afterward).A second commit fixes two stale-prose findings a spawned reviewer caught on the diff:
docs/configuration.md's enumeration of the ten stripped variables (now eleven, with a sentence on whyCLAUDE_EFFORTis not also listed), and the test file's module comment claiming the tuple matches round 16's shipped list verbatim (now notes the #1128 addition and its different provenance).Test evidence
RED (before the
pipeline/summarizer.pyfix, only the test-tuple edit applied):python3 -m pytest tests/test_summarizer_env_898.py -q-> 5 failed, 45 passed.GREEN (after the fix): same command -> 50 passed, then 51 passed once the dedicated positive-control test was added. The one non-zero exit code seen on these runs is the repo's own coverage-threshold gate on a single-file targeted subset (fail-under=80) -- expected and unrelated to this change.
Also ran clean:
tests/test_haiku.py,tests/test_literal_env_reads_898.py(the repo-wide AST scanner for non-literal env-var names),tests/test_arith_base_lint_332.py,tests/test_pep604_floor_guard.py.Full
pytest(the repository's whole test_command) was deliberately not run locally -- targeted only; CI is the full-suite gate across 3 OSes and 4 interpreters.Review
Two spawns reviewed the fix commit:
oss:auditor(classes A/B/C plus platform, all clean) andExplore(2 findings, both fixed in the follow-up commit, described above). No correctness issues found in the pop/restore logic itself; the Codex child-env route was confirmed never to have carried this variable, so the fix's single-spawn-site scope matches the bug.Docs
README.md(this repo's configured docs target) never documented the env-stripping mechanism, so nothing in it needed updating.docs/configuration.md, which does document it in detail, was updated in the second commit even though it isn't in the configured docs_targets, because it was stale on the diff itself.Not implemented here, flagged as an optional follow-up the issue itself marks as a "could also": having the repo's doctor command warn when
CLAUDE_CODE_EFFORT_LEVELis set in the environment the summarizer will inherit.[AI-generated]