You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(isolation): re-enable worktree isolation with real merge-back (#787) (#867)
* feat(isolation): re-enable worktree isolation with real merge-back (#787)
Re-enables --isolation worktree for the single-run path (cf work start) with
auto-commit + merge-back, reversing the #714 interim hard-reject.
- worktrees: TaskWorktree.auto_commit() stages+commits worktree changes
- sandbox/context: rebased_workspace() keeps state on main / code on worktree;
ExecutionContext gains merge_back/preserve; validate_isolation no longer
rejects WORKTREE (CLOUD still raises); create_execution_context builds a real
worktree (not registered so orphan cleanup can't nuke a preserved branch)
- builtin adapters (#715): react/plan run against workspace_path
- verification_wrapper (#716): gates + quick-fixes run against the worktree
- runtime: merge-back on success; conflict -> blocker + preserve; fail -> preserve
- cli: work start accepts worktree; work batch run rejects it (subprocess can't
reach the gitignored .codeframe DB from a worktree) with a batch-specific message
Tests: new test_worktree_isolation.py (file-on-base after success, conflict->blocker
+preserve, fail->preserve, #715/#716 threading); updated sandbox/exit-code tests
from the #714 disable contract to the #787 enable contract.
* fix(isolation): harden worktree merge-back per review (#787)
Addresses defects found by opencode/GLM + CI review bots:
- auto_commit fails loud (critical): git add/commit now raise on failure instead
of reporting success — a failed stage/commit preserves the branch rather than
merging nothing then deleting it (the #714 silent-data-loss class).
- Preserved-branch collision (major): create_execution_context moved inside
execute_agent's try + a clear ValueError when a leftover cf/<task> branch or
worktree exists — a retry becomes a handled FAILED (preserved), not a stranded
IN_PROGRESS run.
- engine_stats miscount (major): re-sync agent_status to the final state so a
merge-back conflict is recorded BLOCKED, not COMPLETED.
- Concurrent merge-back (major): serialize the checkout+merge on the shared main
tree with a cross-process flock (_main_tree_lock).
- Dirty-tree checkout failure now routes through the merge-back error -> blocker
+ preserve (try/except around merge_back()).
Tests: auto_commit-raises regression, preserved-branch-collision, registry-empty
assertion; fixed mock-workspace path mismatches in test_builtin /
test_verification_wrapper / test_engine_registry_extended (rebased_workspace calls
dataclasses.replace, which needs workspace_path==repo_path for the mock no-op).
0 commit comments