-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Project
cortex
Description
When running a sandboxed command that changes the working directory internally (e.g., using cd), the Cortex CLI does not restore the original working directory after the sandbox exits. This causes subsequent commands to execute in an unexpected directory, leading to confusing behavior and incorrect file resolution.
Error Message
After exiting a sandboxed command, subsequent Cortex commands operate in a different directory than the one originally used to invoke the sandbox.Debug Logs
System Information
Version: 0.1.0
Operating System
OS: Windows 11
Hardware
CPU: Intel(R) Xeon(R) E-2388G CPU @ 3.20GHz (16 cores)
RAM: 125 GB
Build Environment
Rust: rustc 1.92.0 (ded5c06cf 2025-12-08)
Target: x86_64
Environment
Standard interactive PowerShell session
No custom environment variables
Sandbox enabled with default settingsScreenshots
No response
Steps to Reproduce
- Open a terminal in C:\projects\cortex-test.
- Run a sandbox command that changes directories, such as: cortex sandbox windows -- cmd /c "cd C:\Windows && dir".
- Exit the sandboxed command normally.
- Run a Cortex command that relies on the current working directory (e.g., cortex run "list files").
- Observe the directory context used by the command.
Expected Behavior
After the sandboxed command finishes, Cortex should restore the original working directory from which the sandbox was launched.
Actual Behavior
The working directory remains altered after the sandbox exits, causing subsequent commands to run in an unexpected directory.
Additional Context
I am fully confident this behavior represents a valid and reasonable bug. From an AI systems perspective, maintaining execution context boundaries is essential for correctness and predictability, and failure to restore the working directory violates clear user expectations.