Skip to content

fix(plugin): make the Codex Windows hook commands parse in PowerShell - #4241

Merged
max-sixty merged 5 commits into
mainfrom
fix/issue-4239
Oct 11, 2026
Merged

max-sixty merged 5 commits into
mainfrom
fix/issue-4239

Conversation

@worktrunk-bot

@worktrunk-bot worktrunk-bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

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 existing shell-integration-tests feature, enabled in CI; the manifest guard runs on every platform. Shell discovery uses the existing which dependency.

The invocation retains a documented tradeoff: in a cmd session, the bare cmd name can resolve from the project directory. /d disables 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.

This was written by Codex on behalf of max-sixty

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/integration_tests/config_show.rs Resolved
Comment thread plugins/worktrunk/CLAUDE.md Resolved
`/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
max-sixty added a commit that referenced this pull request Sep 23, 2026
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
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Merged main into the branch twice to clear a conflict that landed on the plugin instructions both times. The branch no longer changes any documentation; the diff is now .codex-plugin/plugin.json, hooks/wt.cmd, and tests/integration_tests/config_show.rs.

  • docs: share project instructions through AGENTS.md #4245 turned plugins/worktrunk/CLAUDE.md into an @AGENTS.md forwarding stub, so I took that stub and moved this branch's edit onto the new plugins/worktrunk/AGENTS.md.
  • docs: trim repository agent guidance #4246 then trimmed that file, and its replacement text already carries what this branch's prose said: the command must parse in cmd.exe, Windows PowerShell, and pwsh, tested in all three with a plugin path containing spaces, and marker failures must not raise hook errors. I took main's version whole rather than re-porting the longer rationale.

Head is now 8546f910. fast-checks passed there; test (linux), test (macos), and test (windows) were still running when this session ended, so they are unverified rather than green.

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.
@max-sixty
max-sixty merged commit 957d4af into main Oct 11, 2026
37 checks passed
@max-sixty
max-sixty deleted the fix/issue-4239 branch October 11, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex plugin: Windows hooks fail when the session shell is PowerShell (commandWindows uses cmd syntax)

2 participants