Skip to content

The #469 env-cache fix is inert in user-prompt-hook.sh, and the #469 test certifies it against a premise that hook does not meet #479

Closed

Description

@fdaviddpt

Found by the v0.24.0 gate 3 round-2 release audit (strategy B, ranked fails-to-preserve). Not blocking
under the round-2 cap; carried forward. This is the composition finding the release-level pass exists for.

#469 (merged as #476, commit d3bf69f, the newest commit in the v0.24.0 range) makes
_remember_env_cache_path fall back to REMEMBER_HOOK_CWD when CLAUDE_PROJECT_DIR is unset, so the
#227 fast path stops being permanently dead on Codex and Gemini CLI.

It is inert in scripts/user-prompt-hook.sh, because that hook's ordering is:

Nothing between :70 and :133 sets it. On a host with no CLAUDE_PROJECT_DIR, both sources are
empty at the moment the key is computed. Measured with both vars scrubbed:

CACHE MISS rc=1
key=[UNSET] file=[UNSET]

Every UserPromptSubmit writes a cache file and no UserPromptSubmit ever reads one -- verbatim the #469
symptom, on the hook that fires once per human turn.

scripts/post-tool-hook.sh (sets at :229, loads at :294) and scripts/session-start-hook.sh
(sets at :136, publishes at :176) are correctly ordered. This is the only affected caller.

The guard half. tests/test_env_cache_hook_cwd_key_469.py:78 puts REMEMBER_HOOK_CWD into the
subprocess environment before _remember_env_cache_load runs, and its comment at lines 37-40 asserts
that is

exactly the shape user-prompt-hook.sh and post-tool-hook.sh already offer from their own stdin cwd

True of one, false of the other. The test certifies the fix against a premise that does not hold in a
file it names by name -- nominally on, effectively off for that hook.

The one fact that would settle it: whether the bounded stdin read is acceptable on the fast path.
user-prompt-hook.sh:150-156 argues against it on #227 cost grounds -- reasoning that predates #469 and
is precisely what makes the fix inert here. So the choice is between paying the read and accepting that
this hook has no fast path on Codex. Either is defensible; silently having neither is not.

Row. fails-to-preserve rather than misreports, because fixing the comment leaves the cache dead
and only fixing the ordering removes the defect.

Platform. tests/test_env_cache_hook_cwd_key_469.py skips entirely on win32 (#79), so this
finding's Windows dimension is untested there by construction.

Activity

  1. added
    bug
    priority:high
    cohort-3
    on Aug 29, 2026
  2. self-assigned this
    on Sep 1, 2026
  3. added a commit that references this issue on Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcohort-3priority:high

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions