Skip to content

user-prompt-hook and session-start-hook key the env cache off different forms of the same cwd -- they agree today only because JSON escapes are never decoded #504

Closed

Description

@fdaviddpt

Found by the v0.25.0 release audit (round 2, dispatch token rel2-ab2ef9d5), platform band, returned unranked. Ranked here by the maintainer: not blocking, no existing row fits, no new row earned. v0.25.0 ships with it.

Mechanism, composed from two commits

Neither half is wrong alone:

Two hooks, two forms of the same directory, one cache.

Why it does not bite today

The auditor ran the real normalizer (scripts/resolve-paths.sh:202-228, copied verbatim) under OSTYPE=msys with the real key sanitiser, with a positive control:

raw  = C:\\Users\\dev\\proj  -> key C---Users--dev--proj   }  STABLE
norm = C:\\Users\\dev\\proj  -> key C---Users--dev--proj   }
raw2 = c:/Users/dev/proj     -> key c--Users-dev-proj      }  DIVERGENT
norm2= C:\Users\dev\proj     -> key C--Users-dev-proj      }  (control fires)

For the form the extractor actually produces, the keys agree. The reason they agree is the interesting part: running the delta's own _stdin_cwd over a CRLF, pretty-printed, Windows-native payload returns C:\\Users\\dev\\proj -- JSON escapes are not decoded, so backslashes arrive doubled, and normalization is an identity on that form. All four hooks' extractors are identical here and this is pre-existing.

So the agreement rests on an accident of the extractor, not on the two sites deriving the key the same way.

When it would bite

The moment a host sends a drive path in a form normalization rewrites -- c:/Users/dev/proj, per the control row above. Cost is bounded: user-prompt-hook.sh's own load and publish stay pinned to each other, so it self-heals from prompt two, leaving one extra slow resolution and a stray cache file per session.

What would settle it

The literal cwd string Codex and Gemini CLI put on a Windows payload. Not observed -- and it is the same class of unknown as #494, which asks whether any host can nest a cwd ahead of the top-level one. Both are questions about payloads from hosts this project does not control.

Why no row

misreports sends a reviewer to a rendering seam, and there is none. fails-to-preserve implies lost data, and nothing is lost -- a divergent key costs a re-resolution, not a record. Filed unranked-as-ranked: not blocking, worth closing, no new row on one bounded instance.

Platform

Windows only -- the divergence needs a drive-letter path. Mechanism exercised on macOS/arm64 (Darwin 24.3.0) by running the real normalizer under a forced OSTYPE=msys; no Windows host was used, so the host-payload half is unobserved.

Activity

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

Metadata

Metadata

Assignees

Labels

cohort-4priority:low

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions