Skip to content

Fix Codex worker lifecycle hooks on Windows CMD and PowerShell - #397

Open
raizedz wants to merge 2 commits into
AgentSystemLabs:mainfrom
raizedz:codex/windows-codex-hooks
Open

raizedz wants to merge 2 commits into
AgentSystemLabs:mainfrom
raizedz:codex/windows-codex-hooks

Conversation

@raizedz

@raizedz raizedz commented Nov 6, 2026

Copy link
Copy Markdown

Problem

Codex workers on Windows answer normally but their lifecycle hooks exit with code 1. Without SessionStart/Stop reports, the office keeps showing needs input after the turn finishes. POSIX single quoting fails in cmd, and simply double-quoting the executable still fails in Codex's PowerShell environment executor.

Change

Use a fixed Windows node.exe -e command with the generated helper's absolute path in a per-worker environment variable. Prepend the office's Node installation to that worker's PATH. Paths never enter cmd/PowerShell expansion, including spaces, Unicode, apostrophes and shell metacharacters. POSIX commands and native hook trust/approval behavior stay intact. Document the update/resume procedure.

Validation

  • npm run typecheck and npm run build pass.
  • Codex and size tests: 11/11 pass, including generated SessionStart/UserPromptSubmit/Stop commands executed through both cmd and Windows PowerShell against an authenticated test bridge. The regression failed before the fix.
  • Live Codex CLI 0.167.0: resumed the same existing worker chat, reviewed hooks through native /hooks, and observed idle -> working -> done after a response.
  • Full npm test was attempted on Windows: 556/616 passed, 60 failed. This is not a green full suite: failures include client registry path separators, clone fixtures and provider executable fixtures; three stuck fixture subprocesses were terminated to finish the run. A separate Codex worker-fixture run also failed to launch its fixture executables. The actual Windows CLI round trip above passed.

No frontend change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant