Session Patches
When a session runs in a cloud runtime (Daytona, Sprites, Modal), every change the agent made inside the sandbox is captured at shutdown and saved to disk as runtime.mbox — a git format-patch mbox you can apply back to your host workspace.
~/.glue/sessions/<session-id>/
├── conversation.jsonl
├── meta.json
├── runtime.mbox ← agent's changes
└── runtime.mbox.meta.json ← runtime + bootstrap contextWhat's in the patch
Phase 1 of the cloud runtime correctness work moved capture from git diff to git format-patch --binary -M -C plus a working-tree diff on top. This means the patch preserves:
- Untracked files — anything the agent created without
git add. (Agit add -Nintent-to-add runs first so untracked paths appear in the diff.) - Binary files — byte-for-byte. Images, PDFs, fixtures all survive via
--binary. - Renames and copies —
-M -Ckeeps a moved file as one rename hunk, not delete + add. - Agent commits — if the agent ran
git commitinside the sandbox, each commit appears as its own mbox entry with the original message and authorship. - Working-tree changes on top of HEAD — uncommitted edits the agent made after its last commit.
If the agent didn't change anything, the patch isn't written and no warning is printed.
When no patch is captured
If the runtime couldn't produce a diff, you'll see a warning at session shutdown instead of silence:
◆ Runtime workspace diff unavailable (noBootstrapSha): runtime did not
record a bootstrap commit (resumed sandbox?); commit changes inside
the sandbox before exiting to preserve themReasons surfaced today:
| Reason | Meaning |
|---|---|
noBootstrapSha | Runtime never recorded a baseline (typically a resumed Sprites sandbox where bootstrap short-circuited) |
gitFailed | git exited non-zero inside the sandbox (no repo, bad SHA, etc.) |
executorDead | Sandbox transport died (Modal sandbox auto-terminated, network drop) |
runtimeNotGit | Workspace isn't a git repo |
notSupported | Host/Docker runtime — captured silently, not surfaced as a warning |
The runtime.mbox.meta.json sidecar
Every saved patch has a companion metadata file:
{
"runtime_id": "daytona",
"sandbox_id": "sb-abc123",
"bootstrap_sha": "deadbeef…",
"remote_url": "https://github.com/you/repo.git",
"runtime_cwd": "/workspace",
"format": "format-patch",
"captured_at": "2026-05-19T10:24:00Z",
"size_bytes": 4892,
"truncated": false,
"truncation_cap_bytes": 52428800
}Apply tools — glue session apply and any third-party tooling — read this so they don't have to re-infer context from the patch body.
Size cap
Patches are capped at 50 MB. A larger diff is written to runtime.mbox.truncated (note the suffix) with a visible warning, and glue session apply refuses to apply the truncated file as-is. This keeps a misbehaving agent (or a node_modules commit) from filling your session directory with hundreds of MB you can't use.
Working with patches
List
glue session listShows every session with its runtime, patch availability, and size:
01HMA2EY9… daytona patch=4892 bytes Refactor auth helpers
01HMA2C3K… sprites patch=- Quick lookup
01HMA274X… host patch=- Local devShow
glue session show <id>Prints the metadata plus the first 40 lines of the patch so you can eyeball what the agent did before applying.
Diff
glue session diff <id> | lessStreams the full mbox to stdout.
Apply
glue session apply <id>By default this creates a branch glue/<session-id> from your current HEAD and runs git am --3way (the proper apply path for a format-patch mbox — preserves commits with their original messages and authorship). Falls back to git apply --3way for working-tree-only patches.
Flags:
--branch <name>— pick the branch name instead of the default--in-place— apply on the current branch, no new branch--target <dir>— apply to a directory other than the cwd
On conflicts, the .rej files are surfaced for you to resolve.
git am and git apply both failed. Inspect rejections or apply manually:
rejection: /path/to/file.dart.rejExport
glue session export <id> --to /tmp/agent-work.mboxCopies the patch + the meta sidecar to a destination — useful for sending to a teammate or attaching to a PR.
Workflow examples
Land the agent's work as a branch you can PR:
GLUE_RUNTIME=daytona glue "refactor the auth helpers to use the new
CredentialStore API"
# ... session ends ...
glue session apply <id>
# → on branch glue/<id>; tests + push as usual(You can also set runtime: daytona in ~/.glue/config.yaml to make it the default instead of passing the env var each time.)
Inspect before applying:
glue session show <id> # quick look at metadata + first 40 lines
glue session diff <id> | less # full patch
glue session apply <id> # if it looks goodApply to a clean checkout instead of your working tree:
git worktree add /tmp/review-branch HEAD
glue session apply <id> --target /tmp/review-branchSlash command
/session inside an interactive session shows the same metadata — when running in a cloud sandbox, it tells you where the patch will land on close:
Session Info
…
Runtime: daytona
Sandbox: sb-abc123
Patch on close: ~/.glue/sessions/01HMA2EY9…/runtime.mboxSee also
- Runtimes overview — capability matrix
- Daytona — REST sandbox, bundle bootstrap
- Sprites — Fly.io persistent sandbox
- Modal — Python-sidecar sandbox