Skip to main content

What Patches Do

A patch is a shell script attached to a checkpoint. Patches run in order every time a sandbox is forked from that checkpoint — layer setup without re-creating the checkpoint.

Creating a Patch

From a file or stdin:
# From a file
oc patch create cp-7f3a1b2c --script ./setup.sh --description "Install deps"

# One-liner from stdin
echo "npm install -g typescript" | oc patch create cp-7f3a1b2c --script=-

Layering Setup

Add multiple patches — they execute in creation order on every fork:
oc patch create cp-7f3a1b2c --script ./install-node.sh --description "Node.js 20"
oc patch create cp-7f3a1b2c --script ./app-config.sh --description "App config"

# Each spawned sandbox gets both patches applied in order
oc cp spawn cp-7f3a1b2c

Inspecting Patches

Review what will run before forking:
oc patch list cp-7f3a1b2c
# ID          SEQ  DESCRIPTION     STRATEGY  CREATED
# pa-abc123   1    Node.js 20      on_wake   2025-01-15T10:30:00Z
# pa-def456   2    App config      on_wake   2025-01-15T10:31:00Z

Removing a Patch

oc patch delete cp-7f3a1b2c pa-abc123
SDK usage: Patches. Full flags: CLI Reference.