Skip to content

fix(executor): preserve Rust execution cwd and sandbox lifecycle - #1237

Open
rudycelekli wants to merge 1 commit into
mksglu:nextfrom
rudycelekli:fix/rust-execution-lifecycle-20261001
Open

rudycelekli wants to merge 1 commit into
mksglu:nextfrom
rudycelekli:fix/rust-execution-lifecycle-20261001

Conversation

@rudycelekli

Copy link
Copy Markdown

What / Why / How

Rust returns from execute() before the shared cwd selection and cleanup. As a result, project-relative reads use .ctx-mode-* instead of the project, cwd overrides are ignored, and successful executions and compiler failures leave their sandboxes behind. background: true is also ignored by that branch.

Route the compiled Rust result through the existing shared lifecycle. Keep the execution cwd separate from the sandbox directory and forward the existing background flag. This preserves the array-argument execFileSync compiler invocation, the bounded compiler timeout, and the existing common process handling.

This completes the project-cwd and cleanup invariants introduced in commit 89f4e736 / #788. It does not add compiler cancellation or replace the process implementation. Reviewed the open cancellation/streaming patches touching the executor; they retain the old Rust cwd/cleanup branch and address different behavior.

Affected platforms

  • All platforms

The shared executor is affected wherever Rust is installed. Local execution was macOS with Node 22.19.0 and a real rustc; native Windows/Linux execution and client-specific delivery are not claimed.

Test plan

Added five native compiler/process regressions in the existing tests/executor.test.ts:

  • Read a relative evidence file from a project path containing spaces; remove the completed sandbox.
  • Honor a per-call cwd override.
  • Remove a sandbox after a compiler error.
  • Preserve a nonzero program exit while cleaning up.
  • Keep a backgrounded program's sandbox and clean up its owned process afterward.

Before: the relative-file program exits 101 (No such file or directory), the four lifecycle cases fail on the unchanged base, and a requested background run is killed rather than marked backgrounded.

After: the program reads project evidence, override reads override project, completed/failed sandboxes no longer exist, and the background case stays alive with backgrounded: true.

  • Focused native Rust regressions: 5 passed.
  • npm run typecheck: passed.
  • npm test --ignore-scripts: passed (4778 passed / 26 skipped; 213 files). This runs the repository's full Vitest script while skipping the generated-bundle pretest, as required by the ops TDD instructions.
  • No live claude -p model session or client transcript was run. The tests drive the real executor/compiler/process boundary; the client-to-MCP boundary remains untested locally.

Checklist

  • Tests added/updated (TDD: red → green)
  • npm test --ignore-scripts passes
  • npm run typecheck passes
  • Docs considered: restores existing executor behavior; no installation or capability change.
  • Native Windows/Linux CI confirmed
  • Targets next

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant