Repository navigation
Description
Raised at maintainer review of PR #493 (#447), not by the lane. Not blocking that merge -- the pin it adds is the right artifact and it makes this legible for the first time -- but #447 offered two ways to settle the question and only one of them was taken, so the other should not be lost with the issue.
What #447 asked for, and what landed
#447's "what would settle it" was a disjunction:
Either the pin generalises to the extractor rather than to one key ... or somebody establishes that no host's payload can carry a nested
cwd.
#493 does the first, following #379's precedent exactly: tests/test_stdin_extractor_top_level_wins_447.py:129 asserts the top-level value wins when the nested key comes after it, and :140 -- test_nested_key_ahead_of_top_level_is_the_documented_gap -- pins the opposite case as today's behaviour. Nested-before-top-level extracts the nested value, for cwd on all four hooks.
That is a characterization, not a fix, and the lane says so plainly. The second half of the disjunction is untouched: nobody has established that no host's payload can carry a nested cwd ahead of the top-level one.
Why this is worth its own line rather than closing with #447
#344 was bounded by a whitelist. This is not:
cwdis validated for embedded newlines and tested for directory existence, and is otherwise taken as given.- It becomes
REMEMBER_HOOK_CWD, whichscripts/resolve-paths.shresolves intoPROJECT_DIR-- the root every subsequent write is relative to.
So the consequence of picking the wrong occurrence is not a mis-compared string, it is memory written under the wrong project root. A pinned gap is a gap that is known, which is strictly better than before #493; it is not a gap that is closed, and the test's own name is the honest record of that.
What would settle it
The half #447 named and #493 did not take: a statement, backed by reading the three hosts' documented hook payload schemas, about whether a nested cwd can precede the top-level one on any of them. Claude Code, Codex and Gemini CLI all send {session_id, transcript_path, cwd, hook_event_name, ...} -- the question is whether any of them nests an object carrying a cwd key ahead of that field, now or by a schema they are free to change.
Two outcomes, both useful. If no host can produce it, say so in the extractor's own header and flip the pinned test to an assertion. If any host can, the extractor needs to become top-level-aware without acquiring a JSON parser -- #340 and #344's standing decision, which #493 correctly honoured and which this issue does not reopen.
Ranked
fails-to-preserve, unreachable-until-shown. No payload observed in the wild produces this. The filing is about the missing half of the evidence, not about an observed corruption.
Platform
Nothing platform-specific -- a property of one shell function's scanning order, identical everywhere. Test-file inspection observed on macOS/arm64 (Darwin 24.3.0); the rest reasoned.
Activity
Fewer warm-path forks (#511), env-cache key parity on Windows (#504),…