mirror of
https://github.com/openai/codex.git
synced 2026-10-27 18:48:37 +00:00
## Why `PreToolUse` hooks receive the host working directory even when a local `exec_command` call specifies a different `workdir`. This prevents hooks from seeing the directory in which the command will execute. ## What changed - Share working-directory resolution between command execution and hook input, using the selected environment and the command's `workdir`. - Report the resolved local directory in the hook input's `cwd`. Keep hook processes in the host directory and retain the host `cwd` for remote commands. - Reject invalid environment selections or paths before running hooks and record failures in tool-result telemetry. ## Testing Add unit and integration coverage for default, empty, relative, and absolute working directories; Windows path conventions; remote commands; hook denial and input rewriting; and invalid arguments that fail without running hooks. GitOrigin-RevId: 97f71f6d3e21a5d95a7abf5384f06f4993241797