[fix] windows cortex-engine exec for v0.1.10 Release - #47
Conversation
Include the exec runner on Windows (cfg + re-export) and treat WorkspaceWrite network_access as a bool so nightly MSVC builds. Co-authored-by: Mathis <echobt@users.noreply.github.com>
Greptile SummarySummaryWindows command execution is now enabled, but restricted commands still fail before they start and timed-out full-access commands can leave child processes behind. These failures must be resolved before merging. Confidence Score: 3/5Not safe to merge: normal restricted Windows commands cannot run, and timed-out full-access commands can leave descendant processes running. Two independently confirmed command-execution failures affect newly enabled Windows behavior. Files Needing Attention: src/cortex-engine/src/exec/mod.rs, src/cortex-engine/src/exec/runner.rs, src/cortex-engine/src/exec/policy.rs, and src/cortex-engine/src/sandbox/windows.rs
What T-Rex did
|
| #[cfg(any(target_os = "linux", target_os = "macos"))] | ||
| // Process-group teardown is Unix-only; the runner itself is required on Windows | ||
| // so local_shell / plugin exec still compile (job-object isolation is separate). | ||
| #[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] |
There was a problem hiding this comment.
Restricted Commands Cannot Run
This change enables the command runner on Windows, but ReadOnly and WorkspaceWrite commands still enter the legacy sandbox preparation path. That path rejects non-full-access policies on Windows before spawning the command, so local-shell and plugin commands using the normal restricted policies fail instead of running.
Artifacts
- Authored and executed Bash harness that compares the parent cfg with PR [fix] windows cortex-engine exec for v0.1.10 Release #47 and validates the active legacy preparation chain, ending with the confirmed rejection path.
- Executed parent-source comparison showing the exec runner cfg excluded Windows before the change, ending with the prior runner-unavailable condition.
- Executed validation and focused Cargo tests showing Windows runner enablement while non-full-access policies reach the rejecting legacy Windows backend, ending with confirmed behavior.
- Python harness authored and executed against the parent and PR sources; it verifies the Windows full-access timeout path lacks tree cleanup.
- Executed environment check showing only the Linux Rust target is installed and PowerShell, pwsh, and Wine are unavailable; native Windows reproduction cannot run on this host.
- Captured execution of the authored harness showing all path assertions passed and confirming the direct-child-only Windows timeout cleanup.
| #[cfg(any(target_os = "linux", target_os = "macos"))] | ||
| // Process-group teardown is Unix-only; the runner itself is required on Windows | ||
| // so local_shell / plugin exec still compile (job-object isolation is separate). | ||
| #[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] |
There was a problem hiding this comment.
Timeouts Leave Child Processes
This change enables the runner on Windows, but full-access commands receive neither process-group cleanup nor Job Object ownership. When a timeout occurs, the runner kills only the immediate child; descendants it started can remain running after the command is reported as timed out.
Artifacts
- Authored and executed Bash harness that compares the parent cfg with PR [fix] windows cortex-engine exec for v0.1.10 Release #47 and validates the active legacy preparation chain, ending with the confirmed rejection path.
- Executed parent-source comparison showing the exec runner cfg excluded Windows before the change, ending with the prior runner-unavailable condition.
- Executed validation and focused Cargo tests showing Windows runner enablement while non-full-access policies reach the rejecting legacy Windows backend, ending with confirmed behavior.
- Python harness authored and executed against the parent and PR sources; it verifies the Windows full-access timeout path lacks tree cleanup.
- Executed environment check showing only the Linux Rust target is installed and PowerShell, pwsh, and Wine are unavailable; native Windows reproduction cannot run on this host.
- Captured execution of the authored harness showing all path assertions passed and confirming the direct-child-only Windows timeout cleanup.
Summary
Fixes the
cortex-cli-windows-x64compile failure that blocked Cortex CLI / Cortex Code Release v0.1.10 (run 34173465433). Linux/macOS already built; Create Release and R2 publish were skipped. Tagv0.1.10exists; there is no GitHub Release and no assets.Two
cortex-engineerrors on Windows nightly:exec/mod.rsre-exportedrunnerwhilemod runnerwas cfg-gated to Linux/macOS. The runner is required on Windows (local_shell, plugins). Unix process-group teardown stays cfg-gated inside the runner; Windows uses job objects via the existing sandbox backend.exec/policy.rsdid*network_accesson abool(E0614). Match ergonomics on Windows nightly bind that Copy field by value. The mapping now usesSandboxPolicy::has_full_network_access()so both rustc 1.98 (CI) and nightly (Release) compile.No product chrome, version bump, or workflow rewrite.
Test plan
cargo fmt --all -- --check./scripts/clippy.shcargo test -p cortex-engine --lib— 1279 passed, 6 ignored. Full workspaceCI / Testgreen.CI / TUI checksgreencargo audit— clean (CI / Security Auditgreen)CI / Source and dependency policygreen)cortex-cli/cortex-app-server/cortex-commononly; this diff iscortex-engine.CI / Changed-line coveragegreen.x86_64-pc-windows-msvcrustctarget_os="windows"is set, somod runner+pub use runnernow compile in. Fullcargo check -p cortex-engine --target x86_64-pc-windows-msvccannot finish on this Linux agent (aws-lc-sysneedswindows.h). Cfg-reviewed both sites; Release Windows job is the real compile.7e0fc0cAttestation (required)
I attest that:
WorkspaceWrite.network_accessstill becomesSandboxPolicyType::Custom.network_accessviahas_full_network_access(). No new egress, path, or secret handling. No secrets, tokens, or keyring dumps.true/falseand ReadOnly network mapping. No mocks that report success..envfiles.Risk
Release / Windows CLI compile only. Exec policy semantics unchanged. After merge, do not re-run failed jobs on 34173465433 — that run is pinned to
3035361(pre-fix). Do not push tagv0.1.10again: apush: tagsRelease would check out the old tag SHA.release.ymlworkflow_dispatchbuilds from the selected branch (mainafter merge), thengit tag v0.1.10 || true(tag already exists; not moved). Create Release can still publish assets onto the existing tag because no GitHub Release exists yet. Same tagv0.1.10can be reused; no version bump required.After this PR is merged, Mathis/Oding re-dispatch Release for tag
v0.1.10:Or: Actions → Release → Run workflow → branch
main→ version0.1.10.Optional: if you want the tag commit to match the fixed binaries, move
v0.1.10to the merge SHA before dispatch. Not required to publish assets.