Repository navigation
fix(plugin): make the Codex Windows hook commands parse in PowerShell - #4241
Conversation
worktrunk-bot
left a comment
There was a problem hiding this comment.
plugins/worktrunk/CLAUDE.md and the mirrored docstring on test_codex_hooks_carry_windows_commands both say /d "keeps a user's AutoRun out of a hook whose stdout Codex reads back as context". That holds only on the PowerShell leg, where the cmd this line spawns is the sole cmd in the chain. On the two cmd legs there is an outer cmd that Codex spawned, and neither passes /d: default_shell_command builds the program from COMSPEC and appends /C, and Shell::derive_exec_args yields ["/c"] for ShellType::Cmd (which build_hooks_config then trims to the args). So on a cmd session a user's AutoRun still runs once, and its stdout still lands in what Codex reads back as context.
Worth scoping the clause rather than dropping it — /d does close the hop this line owns, and plugins/worktrunk/CLAUDE.md is what a later change reads as the record of what each token in this command buys.
`/d` suppresses AutoRun only in the cmd this command line spawns. Codex's own outer cmd passes none: `default_shell_command` appends `/C` to `COMSPEC`, and `derive_exec_args` yields `/c` for `ShellType::Cmd`. So a cmd session still runs a user's AutoRun once, into the stdout Codex reads back as context.
# Conflicts: # plugins/worktrunk/CLAUDE.md
The repository guidance had grown into long implementation histories, especially in the plugin instructions surfaced by #4241. This trims the nine guidance files from 2,769 lines to 380, keeping active contracts and fragile workflows while moving enduring cache semantics into the owning module docstring and updating trace and feature-spec references. This follows #4245, which moved the guidance into `AGENTS.md`. The nine `CLAUDE.md` forwarding files remain in place. Verified with the plugin-layout and documentation-sync integration tests, `pre-commit`, JSON parsing for the updated feature specifications, and `git diff --check`. > _This was written by Codex on behalf of max-sixty_
# Conflicts: # plugins/worktrunk/AGENTS.md
|
Merged
Head is now |
Use the existing which dependency and shell-integration-tests gate. Reuse the Git 2.56 diagnostic normalization already on main so the local pre-merge gate passes.
Windows Codex hooks failed before updating activity markers because their cmd-specific command strings did not parse in PowerShell. The Windows commands now invoke the quoted wrapper through
cmd /d /c call; the wrapper keeps marker failures best-effort by returning zero while preserving stderr diagnostics.The invocation rationale lives in
hooks/wt.cmd. Regression coverage runs the shipped commands through cmd, Windows PowerShell, and PowerShell 7 from a plugin path containing spaces, checking marker updates, Unicode arguments, and failures. This installed-shell coverage uses the existingshell-integration-testsfeature, enabled in CI; the manifest guard runs on every platform. Shell discovery uses the existingwhichdependency.The invocation retains a documented tradeoff: in a cmd session, the bare
cmdname can resolve from the project directory./ddisables AutoRun only for the cmd hop this command creates.The tests reproduce Codex's process invocation; an installed Windows Codex session has not been exercised.
Closes #4239. Thanks to wstczyw for the report and reproduction.