Overview
Phase 4.B introduces an ExecutionContext abstraction so that conductor.py and all agent adapters can isolate task execution from the shared filesystem.
Motivation
cf work batch run --strategy parallel currently runs concurrent threads on the same live filesystem with no isolation. Agents can corrupt each other's work, hit git index locks, or overwrite changes.
Deliverables
codeframe/core/sandbox/context.py
Define the ExecutionContext protocol/dataclass:
class IsolationLevel(str, Enum):
NONE = "none" # shared filesystem (current behavior)
WORKTREE = "worktree" # git worktree per task
CLOUD = "cloud" # E2B Linux VM per task
@dataclass
class ExecutionContext:
task_id: str
isolation: IsolationLevel
workspace_path: Path
cleanup: Callable[[], None] # called on task completion
CLI flag
--isolation none|worktree|cloud on cf work start and cf work batch run
- Default:
none (preserves current behavior)
Integration points
conductor.py passes ExecutionContext to each worker
- All agent adapters (ReactAgent, ClaudeCodeAdapter, etc.) respect
context.workspace_path
- Runtime creates/tears down context around each task run
Acceptance Criteria
Dependencies
- Blocked by nothing (can start now)
- Blocks: worktree isolation (#next), E2BAgentAdapter (#next+1)
Track
Phase 4.B — Execution Environment Layer
Overview
Phase 4.B introduces an
ExecutionContextabstraction so thatconductor.pyand all agent adapters can isolate task execution from the shared filesystem.Motivation
cf work batch run --strategy parallelcurrently runs concurrent threads on the same live filesystem with no isolation. Agents can corrupt each other's work, hit git index locks, or overwrite changes.Deliverables
codeframe/core/sandbox/context.pyDefine the
ExecutionContextprotocol/dataclass:CLI flag
--isolation none|worktree|cloudoncf work startandcf work batch runnone(preserves current behavior)Integration points
conductor.pypassesExecutionContextto each workercontext.workspace_pathAcceptance Criteria
ExecutionContextdataclass defined incore/sandbox/context.pyIsolationLevelenum withnone | worktree | cloud--isolationflag wired up oncf work startandcf work batch runconductor.pycreates context before dispatch, cleans up afternonepreserves all existing behaviorDependencies
Track
Phase 4.B — Execution Environment Layer