Skip to content
Documentation

Patch behavior and recovery

CodeSpace accepts Codex V4A patches and applies additional workspace rules before calling the pinned library. A supported library option is not automatically an allowed service operation.

Patch request contract

Use relative paths and versions returned by read. The version absent means the target must not exist. Include both source and destination versions when protecting a move. A complete preview/apply example shows how to change the operation key between those distinct requests.

RuleCodeSpace behavior
PathsResolve within the registered root; reject absolute and escaping paths
Symlinks and special filesReject symlink paths and devices, sockets, or FIFOs
Add or move destination existsRefuse rather than overwrite the existing destination
NewlinesRequest Codex PreserveLineEndings; selected parity cases are tested
Patch formatV4A only; no automatic unified-diff conversion or git apply fallback
Previewcheck_only: true runs preflight without writing; it is not a reservation or proof that later apply will succeed

Results and recovery limits

StatusMeaning and next action
checkedPreview passed; use a new operation key for actual application
appliedPost-apply disk hashes matched helper claims
rejectedRequest was refused or an error was recorded; inspect the error and whether execution had already begun
failed_rolled_backHelper application failed and snapshot restoration reported completion
failed_partialHelper application failed and restoration was incomplete; inspect files
unknownFinal outcome is not known; inspect files and recorded state before retrying

The Runner snapshots affected files and restores them if the helper apply call fails. An error while verifying a successful helper response currently returns before restoration. The gateway can record that error as rejected even though files may have changed. Do not interpret every rejected result as proof of no writes. Crash recovery also does not automatically restore snapshots or replay work. No git reset --hard is used.

A successful result includes affected files and changes with kind and available before/after hashes. Those hashes describe the observed files, not a repository commit or a successful build. The same files and changes are stored on the patch ledger and returned by operation_status, together with kind: "patch" and minted/finished events. Commands are not recorded there.

Write lock and transport

One live command blocks other patch/exec work in that workspace with WORKSPACE_BUSY, including waiters already queued behind that process. Request-owned patch and exec work waits in an in-memory FIFO that starts at acquire until the current request finishes. Queue saturation is RESOURCE_QUEUE_FULL. There is no durable occupancy queue. Reads and searches remain possible. Patch operation keys support replay only for matching request fingerprints; choosing a new key after an uncertain response risks applying the change twice.

stdio and Streamable HTTP expose the same tool schemas. Connection failure does not establish whether a mutation ran. See error codes and recovery rules.