FE-1109: Reconcile executor sandbox worktrees and test runner ports#275
FE-1109: Reconcile executor sandbox worktrees and test runner ports#275kostandinang wants to merge 6 commits into
Conversation
PR SummaryMedium Risk Overview
Docs/plan updates mark FE-1109 built, rename cook-execution-ports → execution-ports in SPEC/PLAN, extend I52-L coverage, refresh skills/TOPOLOGY, and remove completed Reviewed by Cursor Bugbot for commit 1d3a1aa. Bugbot is set up for automated code reviews on this repo. Configure here. |
8ee8fe2 to
4434358
Compare
|
Addressed the Bugbot finding: execute_worktree_create is now idempotent. Calling it a second time returns |
3299af6 to
873f91b
Compare
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Introduce the executor execution-ports seam and the first real capability port. execute_worktree_create now creates the run workspace through an injected GitWorktreePort (real git worktree add --detach <dir> HEAD in the app layer) instead of a direct mkdir, keeping executor core free of git/subprocess (D52-L) and one-explicit-side-effect discipline (I52-L). - src/executor/execution-ports.ts: types-only ExecutionPorts bag (GitWorktreePort + placeholder AgentRunnerPort/TestRunnerPort/GitLandPort) - src/app/git-worktree-port.ts: app-layer git subprocess implementation - src/executor/worktree.ts: inject port; add worktree_create_failed variant that does not advance run metadata; report git_worktree_add side effect - pi-extensions: optional executionPorts option, inject into the adapter - tests: app-layer port contract, injection, failure-does-not-persist, shared fake-ports helper for lifecycle setup helpers - memory/PLAN.md, memory/SPEC.md: mark GitWorktreePort slice done, de-cook the execution-ports naming
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a825f18. Configure here.
Second capability of the executor sandbox. execute_test_result now runs
the real verify subprocess in the run's git worktree through an injected
TestRunnerPort instead of reading a prewritten test-result.json.
- execution-ports.ts: add TestRunnerPort (run -> completed{verdict,exitCode}
| failed{message}); testRunner is now a required ExecutionPorts member
- src/app/test-runner-port.ts: app-layer 'npm run verify' subprocess
- src/executor/test-result.ts: run injected port; report true verdict +
exit code; add test_run_failed (runner cannot execute -> no metadata
advance); remove prewritten testResultPath model
- run.ts: drop stale testResultPath metadata field
- pi-extensions: default + inject testRunner into the adapter
- tests: app-layer port contract, injection, failing-verdict-advances,
runner-failure-does-not-persist; shared fake-ports helper
- TOPOLOGY.md, scope-execution-task skill, PLAN.md, SPEC.md: reflect real
verify-subprocess ingestion; mark executor-sandbox slices done
Address Cursor Bugbot: the injected GitWorktreePort path always ran 'git worktree add', which fails when the worktree directory already exists — unlike the prior mkdir path that could be safely retried. A second create now returns 'already_created' without re-invoking git.
* FE-1110: Drop unused cwd from TestRunArgs The test runner runs inside the worktree, so the repo-root cwd was dead weight carried only for shape-symmetry with GitWorktreeCreateArgs. Remove it from the port arg type, the executor call site, and the port tests. Pure interface tidy; no behavior change. (REFACTOR.md commit 1/3) * FE-1110: Extract shared app-layer command-runner Both execution ports duplicated the same spawn-based subprocess runner. Extract it into a single command-runner module (spawn wrapper + CommandResult carrying an explicit spawnError signal); the git-worktree and test-runner ports now keep only their command/args and result mapping. Behavior preserved: the git port still surfaces its spawn-error text, now via a spawnError fallback, locked by a new git spawn-failure test. (REFACTOR.md commit 2/3) * FE-1110: Consolidate port test fakes onto shared fake-ports Three copies of the port fakes existed: the shared fake-ports helper, a parametrized inline fake in the worktree test, and local copies in the extension registry test. Parametrize the shared git-worktree fake with an optional create override, then point the worktree and registry tests at the shared helpers and delete their local duplicates. (REFACTOR.md commit 3/3) * FE-1110: Remove completed refactor plan REFACTOR.md was a temporary execution aid; all three commits landed.
Co-authored-by: Cursor <cursoragent@cursor.com>
a825f18 to
6c8c072
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>


Part of the orchestrator-alpha-cutover (FE-1089) — the first real-execution layer of the arc that re-grows the cook orchestrator natively on the alpha branch.
Two run-lifecycle steps that used to fake execution now do the real thing, behind small injected ports so the executor core stays free of git and shell calls.
What changed
execute_worktree_create) — runs a realgit worktree addinstead of making an empty folder.execute_test_result) — runsnpm run verifyin that worktree and records the real pass/fail, instead of reading a pre-written results file.Both sit behind an
ExecutionPortsseam: the core only knows the port types; the real git/shell work lives in the app layer and is injected at startup. Also folds in the port-internals cleanup from #276.Behavior notes
git worktree addleaves the run untouched.Verified
npm run verifygreen — 165 test files, 1117 passed, build OK. Tests cover both ports (command shape, pass/fail, spawn failure) and the failure paths.Stacked on #274.