Repository navigation
fix: trust Codex session hooks on Windows - #1244
mnajafian-nv merged 1 commit into
Conversation
Signed-off-by: Will Killian <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used📓 Path-based instructions (1)Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.⚙️ CodeRabbit configuration file Files:
🔇 Additional comments (2)
WalkthroughThe Codex session-hook override now selects a session-flags configuration path for Windows or non-Windows platforms. Tests check trusted-hook entries for both paths. ChangesCodex hook paths
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested labels: Merge Risk: ⚪ Minimal · up to Windows trust entries now use Codex’s Windows-specific synthetic path while Unix entries retain their existing path. The reviewed change presents no concrete new user-facing risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
#### Overview Fix Windows Codex hooks failing to execute, which leaves sub-agent and collaboration tool scopes missing from ATOF traces. Codex runs hooks through its session shell, which defaults to PowerShell on Windows; Relay currently generates cmd.exe syntax. - [x] I confirm this contribution is my own work, or I have the right to submit it under this project's license. - [x] I searched existing issues and open pull requests, and this does not duplicate existing work. #### Details - Generate Windows Codex hook commands as encoded PowerShell scripts with literal argument quoting, including ASCII and smart apostrophes. - Stop on invocation errors so a missing Relay executable fails instead of reporting success. - Preserve the Relay exit code through both PowerShell layers, including code 2 used for hook denials. - Exercise argument paths with spaces, Unicode, apostrophes and shell characters, stdin forwarding, stdout/stderr, native exit codes and a missing executable in PowerShell 5 and 7. - Run PowerShell 7 regressions only when installed, and decode PowerShell literals correctly in test assertions. - Keep other agents' command rendering unchanged. No public API or breaking changes. Validation: - `just test-rust` and `uv run pre-commit run` passed on this branch. - Native Windows regressions passed on `x1carbon` in PowerShell 5 and 7 using cross-compiled Rust binaries and the repository's native hook fixture. - Real Codex 0.160.1 runs against a deterministic localhost Responses provider spawned one and three sub-agents. ATOF contained all expected sub-agent and collaboration tool scopes, child model calls had correct parentage, and every scope closed. - Windows end-to-end validation used PR #1256's inspected head plus the original Codex hook fix. Follow-up review fixes were validated with native Windows execution tests in PowerShell 5 and 7, including a run with PowerShell 7 absent from PATH. The worker fix's release backport is tracked separately in #1257 and is excluded from this PR. - Python and Node binding suites were not run because their contracts are unchanged. #### Where should the reviewer start? Start with `render_hook_command` in `crates/cli/src/hooks/encoding.rs`, particularly literal PowerShell argument encoding and exit-code propagation. Then review the Windows execution regressions in `crates/cli/tests/coverage/agents/plugin_host_tests.rs`. #### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to) - Fixes [RELAY-1000](https://linear.app/nvidia/issue/RELAY-1000/nemo-relay0100-rc3windowscodex-sub-agent-and-collaboration-tool-scopes). - Relates to #1244, which addressed Windows hook trust; this fixes the remaining hook command execution failure. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved Windows hook execution for Codex in PowerShell and PowerShell 7. Hook commands now handle paths containing spaces, special characters, apostrophes, smart quotes, and Unicode while preserving input, output, and exit codes. * Missing hook relays now report an error and return a failure code. * Claude Code and pi continue using their existing hook command behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Will Killian <[email protected]>
Overview
Fix Codex hook trust for managed Windows runs. Relay currently creates session hook trust entries with a Unix source path, while Codex 0.160.1 discovers those hooks under
C:\<session-flags>\config.toml. The unmatched trust entries allow collaboration to execute without emitting the hooks needed for sub-agent and tool scopes.Details
Validation:
just test-rust: all 5,757 tests passed on macOS.No public API or breaking changes.
Where should the reviewer start?
Start with
session_hook_state_override_for_platformincrates/cli/src/agents/codex/launch.rs, thencodex_session_hook_trust_uses_platform_discovery_pathsincrates/cli/tests/coverage/agents/launcher_tests.rs.Codex's synthetic source path is defined in Codex 0.160.1 hook discovery.
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit