Prepare tests for a change
Prepare a reviewed plan’s tests and keep them on a branch before implementation. Start with ticket.ts, frame.ts, plan.ts, approval.ts and checkpoint.ts from planning a change, the setup configuration and zod. Your repository needs a working npm test command and a package lockfile for npm ci.
Download all files. Extract into a dedicated directory, run npm install, then adapt outpost.config.ts using Installation. The commands below identify the scripts to run.
This lesson reuses the previous lesson’s files, not its saved execution. It defines another graph and needs its own runId: planning runs again. For one path from ticket to implementation, start directly with the development workflow project.
Prepare and reuse the sandbox
Section titled “Prepare and reuse the sandbox”These helpers open one sandbox when delivery starts and reuse it for commands and agent turns.
These shared types connect each loop’s attempts and checks.
Write and check the tests
Section titled “Write and check the tests”The test loop rejects changes outside test files and requires the tests to fail before committing.
Start the test workflow
Section titled “Start the test workflow”Save these files beside the helpers. Use a fresh ticket key: this four-task graph has its own checkpoint identity.
Answer and approve
Section titled “Answer and approve”Your application calls answer("owner", requestId, text) for a pending question, then decide("owner", "approve", reason) after reviewing the plan. Use reject to stop. Each call advances the workflow and closes the sandbox before returning.
Run node main.ts to inspect the next question, pending plan or result. Authenticate the caller before accepting the owner actor in an application.
Inspect the result
Section titled “Inspect the result”After approval and an accepted check, the named branch contains a test commit and summary describes the changes. Nothing is merged. Run npm test on that branch and inspect why it fails: this example checks only a nonzero exit status, which can also come from a broken test runner. Verify that the failure demonstrates the missing behavior.
The loop allows four rounds. A rejected check leaves changes for the next attempt; exhaustion fails the task and retains the work. File checks examine the final changes, but instructions not to commit are not a security boundary. After interruption, inspect the branch before authorizing replay.
Continue with implementation and review. That larger graph starts under a fresh ticket key; it reuses these files, not this lesson’s checkpoint.

