Repository navigation
Description
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:
:70--unset REMEMBER_HOOK_CWD(the post-tool-hook.sh and user-prompt-hook.sh consult REMEMBER_HOOK_CWD without ever setting, clearing or validating it #417 ambient clear):133--if _remember_env_cache_load && ...<- the cache read:192--REMEMBER_HOOK_CWD=$(_stdin_cwd "$_HOOK_STDIN" ...)<- inside the_REMEMBER_FAST=0
block, so it is only reached after the load has already failed:203--_remember_env_cache_publish
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
fix: #469 env-cache fallback still inert in user-prompt-hook.sh (#479) (