Repository navigation
fix(hooks): run the SessionStart hook on Windows Codex and read its context without PATH (#127) - #171
Conversation
…ontext without PATH (#127) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unner (#127) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t report (#166) No outcome required the cap, and it does not establish that the transcript was read. Eric decided to remove it on 2026-10-12. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in the Reflect verifier fixes (#152, #166) and registry U1 (#155) before this branch opens, since all three edit features/recipes.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # .claude/skills/verify-open-pstack/features/recipes.ts
…0 sync Co-Authored-By: Claude Opus 5.5 <[email protected]>
#127) #127 adds a required context field to SessionRecord, and the writer test from #155 builds a record without it, so the merge failed strict typecheck. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge Protections🔴 1 of 2 protections blocking · waiting on 🙋 you
🔴 🚦 Auto-queueWaiting for
This rule is failing.When all merge protections are satisfied and these conditions match, this pull request will be queued automatically.
Show 1 satisfied protection🟢 Queue ready pull requestsAutomatically queue non-draft pull requests targeting main after verify, Unfret, and live-gate pass on the head and every review thread is resolved.
|
Live evidence: Open Pstack
|
|
✅ Accepted riskAccepted by ericlitman: GH-127 (authority 48fa77b) 🔴 Critical · Reject repository-relative Bash executables 🟡 Medium · Missed Bash discovery still reports hook success 🟡 Medium · Non-default Git installations lose startup context 🟡 Medium · Hardcoded system directory breaks non-C Windows startups Advisories (1)
DetailsRun: @unfret review · @unfret status · @unfret help |
There was a problem hiding this comment.
🛑 5 blocking findings
🔴 Critical · Fresh Codex login exposes credentials to PR-controlled code
🔴 Critical · Keep raw Codex evidence private
🔴 Critical · Manual dispatch bypasses the same-repository login boundary
🔴 High · Reuse existing auth instead of creating another login
🔴 High · Label events replace the head's Windows check results with skipped runs
Check
… checks (#127) Unfret on head d89f4a5: the job put a fresh Codex login on a runner that then ran pull request code with hook trust bypassed; manual dispatch could check out a fork ref; it uploaded the raw Codex stream publicly; and label runs replaced the wrapper result with a skipped one. Removing the job removes all of them. The wrapper job already proves the hook on Windows without a login. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Live evidence: Open Pstack
|
There was a problem hiding this comment.
🛑 1 blocking finding
🟡 Medium · Windows hook silently succeeds without an undocumented Bash dependency
Check
…nStart hook (#127) Unfret on head 909b297: run-hook.cmd exits 0 without context when it finds no Bash, which the superpowers wrapper does by design, but the docs never named the dependency. Dependencies now say Windows needs Git for Windows' bash. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Live evidence: Open Pstack
|
There was a problem hiding this comment.
🛑 3 blocking findings
🔴 Critical · Reject repository-relative Bash executables
🟡 Medium · Windows startup skips Bash in non-default Git installations
🟡 Medium · Windows startup still silently loses context without Bash
Check
|
@unfret review |
There was a problem hiding this comment.
🛑 3 blocking findings
🔴 Critical · Reject repository-relative Bash executables
🟡 Medium · Interpreter discovery failure is reported as success
🟡 Medium · Discover Bash in non-default Git installations
Check
|
Operator waiver: Eric accepted these risks on head All three findings concern Bash discovery in
What Eric accepted: the common case works, which is Git for Windows in its standard location. The remaining cases are Git in a non-default folder that is on Follow-up:
|
|
Queued — the merge queue status continues in this comment ↓. |
|
I tested PR head Running the PR's "commandWindows": "cmd.exe /d /s /c \"\"%PLUGIN_ROOT%\\hooks\\run-hook.cmd\" session-start\""That diagnostic run used a one-invocation hook trust bypass because the changed definition had a new hash. I did not run the modified copy in desktop. The result points to Codex needing explicit |
…md.exe /s /c (#127) Coldsun1 tested head fd580ad in the Windows Codex desktop app and CLI: neither received the pstack context. The wrapper printed it when run through cmd.exe directly, and this commandWindows value made a fresh CLI session receive it. Our CI emulates Codex's default COMSPEC path, where both values pass, so it did not catch the failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@Coldsun1 thank you, that was exactly the test this needed. Head |
Live evidence: Open Pstack
|
There was a problem hiding this comment.
🛑 5 blocking findings
🔴 Critical · Reject repository-relative Bash executables
🔴 Critical · Repository cmd.exe executes at startup
🟡 Medium · Carried: failed Bash discovery still reports hook success
🟡 Medium · Non-default Git installations lose startup context
🟡 Medium · Expanded PLUGIN_ROOT is unquoted in the outer cmd parse
Check
…ell and cmd (#127) Codex runs a hook through the session's shell, which is usually PowerShell on Windows. Main's commandWindows value is a PowerShell parse error, which is why the reporter got no context. Head 4's value worked in PowerShell only for paths without a space or &, and in cmd it resolved cmd.exe from the session directory first, so a repository's cmd.exe ran at startup. The hook now starts C:\Windows\System32\cmd.exe by full path with delayed expansion, so the plugin path is expanded after cmd has parsed the line. The wrapper turns delayed expansion off again so a ! in a path stays literal. The Windows job runs the hook through cmd, Windows PowerShell and pwsh, with a space, &, % and ! in the plugin path and a planted cmd.exe in the session directory. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Live evidence: Open Pstack
|
|
@Coldsun1 head The new value is: "commandWindows": "C:\\Windows\\System32\\cmd.exe /d /v:on /s /c \"\"!PLUGIN_ROOT!\\hooks\\run-hook.cmd\" session-start\""It passes in cmd, Windows PowerShell and pwsh, including a plugin path with a space, |
|
I retested head My Codex config has no explicit |
There was a problem hiding this comment.
🛑 4 blocking findings
🔴 Critical · Reject repository-relative Bash executables
🟡 Medium · Missed Bash discovery still reports hook success
🟡 Medium · Non-default Git installations lose startup context
🟡 Medium · Hardcoded system directory breaks non-C Windows startups
Check
|
Operator waiver on head Carried from heads
New on this head (I accepted it as operator, under Eric's instruction to manage this PR): hardcoded system directory breaks non-C Windows startups.
|
|
@Mergifyio queue |
Merge Queue Status
This pull request spent 13 seconds in the queue, including 1 second running CI. Required conditions to merge
|
…sionStart fix (ericlitman#174) Bumps the manifests, marketplace entry and version lines to 1.8.0, adds the 1.8.0 CHANGES.md section (registry U1 to U3 and ericlitman#127), and corrects the NOTICE.md row for run-hook.cmd, which PR ericlitman#171 changed beyond its header. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
The pstack SessionStart hook runs on Windows Codex, and its context script no longer depends on
PATH(#127, reported by Coldsun1). A startup-hook check joins the Mac live gate, and a Windows workflow proves the hook on GitHub'swindows-latestrunner without any login.Evidence
SessionStarthook_responsewith exit 0, whosestdoutis byte-identical tosession-start-context.md.developermessage in the rollout holding the same text. The JSON stream does not show it.hook:startupassertion passes on real sessions from the fixed hook, and fails on a failed hook, empty stdout, a different event, text only in a model reply, or a Codexusermessage.session-startwithoutPATH: it prints the exact context underenv -iwith bash 3.2 and 5, from a path with spaces. A missing context file exits 1, and a missing script exits 127.wrapperjob runs thecommandWindowsvalue through cmd, Windows PowerShell and pwsh, the way Codex calls each one. The plugin path contains a space,&,%and!, and the session directory contains a plantedcmd.exe. Each shell is checked with an ordinaryPATH, a System32-onlyPATH, a missing script and a missing context file, andsession-startis also checked under Git's bash with an emptyPATH. All 13 checks passed on a lab push of this head's files (run). They also passed in this PR's run onacf8292(run).fd580ad): the Windows Codex desktop app (0.162.0-alpha.17.2) and the CLI received no pstack context. The wrapper printed it when run directly, andcmd.exe /d /s /c ""%PLUGIN_ROOT%\hooks\run-hook.cmd" session-start"made a fresh CLI session receive it.codex-rs/core/src/session/mod.rs,build_hooks_config, thencodex-rs/hooks/src/engine/command_runner.rs,build_command). On Windows that shell is usually PowerShell, which gets-NoProfile -Command <value>. Cmd gets/c "<value>", and so does%COMSPEC%when there is no session shell. The CI job up to head 4 emulated only the cmd case.windows-latest(run), six plugin paths in each shell:"%PLUGIN_ROOT%\hooks\run-hook.cmd" session-start, fails 6/6 in Windows PowerShell and in pwsh with a parse error, "Unexpected token 'session-start'". This is what Coldsun1 saw onfd580ad. Main has nocommandWindowsat all (Windows Codex SessionStart hook exits 1; plugin command lacks a Windows override #127).&. In cmd it runs the session directory'scmd.exeinstead of the system one, which is Unfret's head-4 security finding.C:\Windows\System32\cmd.exe /d /v:on /s /c ""!PLUGIN_ROOT!\hooks\run-hook.cmd" session-start", passes 6/6 in all three shells once the wrapper turns delayed expansion off. Without that change, a path containing!fails.acf8292, run from the candidate with--feature claude:hook:startup --feature codex:hook:startup --self-test(evidence).Merge Danger
Door: two-way
Blast Radius: hooks
Every Claude Code and Codex session runs this hook at startup. A changed hook definition changes its trust hash, so Codex users review and trust it again once. The workflow sits under
.github/, so Mergify does not auto-queue it. I queue it by hand once its checks pass. The Windows command namesC:\Windows\System32\cmd.exe, so a Windows installed elsewhere does not run the hook, asdocs/reference.mdstates.Acceptance criteria
windows-latest." See Evidence.project-skillin both under--self-test, from the candidate head." See Evidence.Gate results
My run on the tree committed as
acf8292, every command withMASTRA_TELEMETRY_DISABLED=1:bun install --frozen-lockfile(poteto-mode scripts)bun run testbun run typecheck(strict)bun install --frozen-lockfile --ignore-scripts(verifier)PSTACK_STATIC_ONLY=1 bash tests/skill-collision-repro.sh(includes the verifier's tests and typecheck)claude plugin validate plugins/pstackNot verified
acf8292.resumeis deliberately not added (design-pass comment on Windows Codex SessionStart hook exits 1; plugin command lacks a Windows override #127).Unfret rebuttals
Closes #127
🤖 Generated with Claude Code