Checkpoints of a task's files
The task’s computer keeps a checkpoint of every repo in the task’s workspace when setup ends and at the end of each turn that changed a file. A checkpoint holds what a push would commit: tracked files, and untracked files that aren’t ignored. A turn that changed nothing keeps none. A pipeline stage’s turn keeps none either.
Each checkpoint lists, for every repo, how many files changed since that repo’s previous checkpoint. A repo can be left out of one, with the reason, when another git was writing the clone, when git can’t stage it whole, as with a repo inside it, or when it would add more than 256 MB of new files. The checkpoint itself stays on the computer. Agents keeps only the list, never a file’s content or path.
The computer keeps the newest 50 checkpoints of each workspace and removes older ones. A take that kept no repo stays in the list, with why, until 50 newer checkpoints exist. 50 and 256 MB are first guesses and may change.
List the checkpoints
Section titled “List the checkpoints”Each entry reads like “Checkpoint 3 (turn, 2026-11-16T16:07:09Z)”, then one line per repo with its tree and the number of changed files, or “not kept” with the reason. Three callers can list them:
- The task’s page. Open the task’s work and choose Changes. Under its pull requests, Checkpoints lists them newest first, each with its number, its time, what took it, and how many files each repo changed or why a repo was not kept.
- The task’s agent. Ask it to list its checkpoints. Its
list_checkpointstool lists its own workspace’s, newest first, if the person its turn is for can see the task, and it asks nobody first. - Anyone who can see the task. The same people who can open its pull request read the list newest first from
GET /v1/tasks/<id>/checkpoints.
Restore one
Section titled “Restore one”Anyone who can see the task can restore one of its checkpoints. In the task’s Changes, choose Restore on a checkpoint’s row. While the task’s computer writes the files back a line says so, and once it has, the line says how many files it wrote back in each repo and offers Undo. Restore is off while the agent works, and a refusal shows under the row in the server’s words. Through the API, ask with POST /v1/tasks/<id>/checkpoints/<checkpoint id>/restore, which answers the restore’s id, and read how it went at GET /v1/tasks/<id>/restores/<restore id>. From the command line, bin/agentsctl task restore <task id> <checkpoint id> does both, waits for the task’s computer, and names the checkpoint that undoes it once the task’s checkpoints list it.
The task’s agent can restore its own workspace’s checkpoints too. Ask it to, and its restore_checkpoint tool restores one inside its turn and answers how many files it wrote back in each repo and which checkpoint undoes it. It asks nobody first, and no person needs to stand behind its turn, since its own tools already change those files without asking. A pipeline stage can’t restore.
The computer first keeps the files as they are as a checkpoint named by the restore’s id. Then it writes the checkpoint’s files back in every repo it kept. Nothing is committed or pushed, the branch stays where it was, and the next push adds the restored files as one commit on top. To undo a restore, restore the checkpoint named by its id.
A restore is refused while the agent’s turn is placed on the task’s computer or runs, while a helper the agent started is still working, while another restore is under way, while the task’s computer is offline, and before the workspace is set up. The agent’s own restore runs inside its turn, so only another session’s turn refuses it. A restore no computer takes within 15 minutes fails. So does one the computer was writing when it restarted, since some files may be written and others not, and restoring again is safe.
A person’s restore reaches the agent at its next turn, which opens with a line naming who restored which checkpoint and the checkpoint of the files before. The task’s record keeps the same line. The agent’s own restore adds no such line to its own session, since its tool’s answer already says it.