Execution and isolation
Understand how LegionCode separates task workspaces and keeps execution behind a controlled boundary.
LegionCode runs repository tools inside a scoped workspace. Concurrent tasks do not share writable files, and clients do not execute repository commands directly.
Isolated workspaces
A workspace defines the repository and execution environment for a task. Two tasks can start from the same repository and branch while keeping separate writable state.
Isolation reduces accidental interference. It does not guarantee that two independent diffs will merge cleanly; review and reconcile them before taking Git actions.
Execution boundary
File reads, writes, commands, and Git operations run through the execution backend. Paths are resolved against the assigned workspace and checked before use.
The runtime owns tool policy and records tool calls in the turn lifecycle. Cloud execution uses Cloudflare Sandbox through the secure-agent API. Local execution will use the same backend contract.
Isolation is not approval
Sandbox isolation reduces the effect of a bad command. Permission policy and human review still decide whether an action is appropriate.
Interruption and settlement
Stopping work sends a runtime command to interrupt the active provider, tool, and execution backend. The turn then records one terminal result: completed, failed, cancelled, interrupted, or timed out.
Clients render that result from the lifecycle. They do not mark a turn complete because a stream closed or a request ended.
Review boundary
Treat generated changes as proposed code. The review surface uses the finalized artifact for the selected turn. Review the diff, run the checks required by the repository, and take explicit Git actions only when the result is acceptable.