Repository navigation
fix: support host-confined Windows workers and private state ownership - #1257
Conversation
Signed-off-by: Bryan Bednarski <[email protected]> (cherry picked from commit 25973ea) Signed-off-by: Bryan Bednarski <[email protected]>
Signed-off-by: Bryan Bednarski <[email protected]> (cherry picked from commit dc46f53) Signed-off-by: Bryan Bednarski <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (14)
🧰 Additional context used📚 Code guidelines (4)📓 Path-based instructions (6)Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.⚙️ CodeRabbit configuration file Files:
Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.⚙️ CodeRabbit configuration file Files:
Source excerpt: In MDX files, top-of-file comments must use JSX comment delimiters: `{/*` to open and `*/}` to close.📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md) Files:
Source excerpt: Verify MDX files use JSX delimiters for top-of-file SPDX comments.📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md) Files:
Source excerpt: Search documentation source for references to the old version and update current-version install commands, package examples, and configuration examples to `` where appropriate: Review matches before changing th...📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md) Files:
Source excerpt: Preserve MDX front matter and the JSX SPDX comment.📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md) Files:
🔇 Additional comments (2)
WalkthroughThe Windows security descriptor now sets its owner to the current user. Windows worker launches proceed when a host Job Object prevents breakaway, and log a warning if the child remains in a job. Tests and documentation cover the updated behavior. ChangesWindows file ownership
Windows worker breakaway
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant WorkerLauncher as spawn_with_handle_list
participant Windows as Windows process and job APIs
participant RelayLogger as Relay logger
WorkerLauncher->>Windows: Create child with preferred breakaway
Windows-->>WorkerLauncher: Return child process
WorkerLauncher->>Windows: Check child job membership
Windows-->>WorkerLauncher: Child remains in a job
WorkerLauncher->>RelayLogger: Log warning with job restriction reason
Merge Risk: ⚪ Minimal · up to Windows workers now start inside a host job when breakaway is blocked, and private files are explicitly owned by the process user. No concrete merge-blocking risk was identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
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
Windows hosts that prohibit Job Object breakaway currently reject daemon worker startup even when the worker could run safely inside the enclosing job. Separately, private files created by LocalSystem can inherit Administrators as their owner and fail Relay's subsequent process-user ownership checks.
Allow host-confined workers and explicitly assign private file ownership to the process user, while preserving job confinement and private access checks.
Details
Validation:
just test-rustrun completed with 5,598 passes and one failure in the Pi workspace symlink fixture. This was not an entirely passing suite. macOS regression validation has not been run.cargo check, the documentation link check, anduv auditpassed. The complete hook run was not green:cargo-denyis unavailable, andnpm auditcannot parse a Pi workspace package.json symlink checked out as target text on Windows. No dependency or symlink changes are included in this PR.Where should the reviewer start?
Start with
spawn_with_handle_listincrates/cli/src/process/detached.rsandworker_starts_without_escaping_restrictive_external_parent_jobincrates/cli/tests/coverage/daemon/mcp_tests.rs. Then review the explicit owner inwith_private_windows_descriptorincrates/cli/src/filesystem/atomic.rs; the existing private atomic-write regression covers the write/rewrite ownership checks.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
New Features
Documentation