feat(spawn): add worker git worktree isolation#1250
Conversation
|
Current-main validation refresh for #294 / PR #1250:
Commands/results:
Acceptance mapping:
Result: #294 acceptance still looks satisfied by this PR on a clean current-main merge rehearsal. Remaining gates are branch protection review ( |
4a38893 to
0925e19
Compare
|
Current-main validation refresh for #294 / PR #1250: Commit / PR:
Environment:
Commands / result:
Acceptance coverage:
No generated artifacts were present in the isolated checkout. Remaining gap before closure is branch protection review/merge. |
|
Final CI refresh for #294 closure PR after the current-main push:
Remaining blocker: normal merge is still blocked only by branch protection requiring review ( |
0925e19 to
8439df9
Compare
Resolves the first two codex-gate P1s on the worktree-isolation path; a third
(validate-worktree-path-before-git-creates-it) remains and needs restructuring,
so this PR is NOT yet mergeable.
- session_scope::with_workspace: reject `..` and require the workspace to be
under root by CANONICAL form (canonicalize_lossy walks ancestors), closing the
lexical-only escape + the missing-symlinked-leaf hole.
- spawn: only rebind the session scope for Worktree isolation; shared spawns keep
the parent scope (default spawns were failing in scoped gateway sessions).
Tests: with_workspace_rejects_{parent_dir,symlinked_workspace}_escape.
8439df9 to
76d6ff6
Compare
|
Deferred for rework — converted to draft. During the backlog landing sweep, the codex pre-merge gate found this worktree-isolation path to be security-sensitive with layered issues across 3 review rounds. I fixed the first two P1s + one P2 (pushed Fixed (in 76d6ff6, tested)
Remaining before merge
The first two P1 fixes + the P2 are a sound foundation; the rework should add validate-before-create + scope-rooted placement on top. Build/test/clippy are green on |
Summary
origin/mainf6936c452389c5172496ee0c3e13393956086d92isolation: "worktree"to builtin spawn calls, allocating each worker under.octos/work/<agent_id>on a freshoctos/worker/<agent_id>branchoctos cleanto remove orphaned.octos/work/*directoriesCloses #294
Current-main refresh
f6936c452389c5172496ee0c3e13393956086d92.8439df924fd6845f68ff165d5509d26ef38a0c99./Users/yuechen/home/octos/target/octos-1250-fresh.epPHQW/octos.rustc 1.95.0;cargo 1.95.0.crates/octos-agent/src/agent/loop_runner.rs, preserving current-main turn-ledger recording and applying the worktree isolation slice.crates/octos-agent/src/tools/spawn.rs,crates/octos-cli/src/commands/clean.rs, andcrates/octos-core/src/session_scope.rs.Validation
git status --short --branchshowed a clean isolated checkout at push time.git ls-files --others --exclude-standardwas empty at push time.git diff --check origin/main...HEADpassed.cargo fmt --all -- --checkpassed.typos crates/octos-agent/src/tools/spawn.rs crates/octos-cli/src/commands/clean.rs crates/octos-core/src/session_scope.rspassed.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo test -p octos-core with_workspace -- --nocapturepassed: 2 tests.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo test -p octos-agent worker_worktree_slug_validation -- --nocapturepassed: 1 matching test.CARGO_TARGET_DIR=/private/tmp/octos-1250-fegal-agent-worktree-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo test -p octos-agent worktree_isolation_runs_concurrent_writers -- --nocapturepassed: 1 matching test.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-cli-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo test -p octos-cli clean_collects_orphaned_worker_worktrees_only -- --nocapturepassed: 1 matching test.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo check -p octos-agent --all-targetspassed.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo check -p octos-cli --all-targetspassed.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo clippy -p octos-agent --lib --tests --no-deps -- -D warningspassed.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo clippy -p octos-cli --lib --no-deps -- -D warningspassed.CARGO_TARGET_DIR=/private/tmp/octos-1250-f693-target CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo clippy --workspace --all-targets -- -D warningspassed.CI / merge status
8439df924fd6845f68ff165d5509d26ef38a0c99.reviewDecision=REVIEW_REQUIRED.