preflight.sh
A shell validation script executed before an AI agent runs. It checks the environment lock (lockfile hash) and whether the Git working tree is clean, preventing failures caused by running in a drifted environment.
Timeline (last 90 days)
The core logic of the preflight script preflight.sh is to assert the five assumptions and print the results line by line, exiting with a non-zero code on any failure; implementation details include: the workspace check uses mkdir -p plus a touch probe and gets available MB with df -Pm (default threshold 512MB), the clock check compares the Date header of the first outbound host with local UTC time (default tolerance 120 seconds), the credential check outputs only the first 10 characters of sha256, and the run lock uses exec 9>"$LOCK" plus flock -n 9.
The way to prevent Runner environment drift is: generate a baseline on a clean code tree with sha256sum package-lock.json > env.lock, and write preflight.sh to verify the environment lock and whether the Git working tree is clean before each attempt.
Preflight should run before the prompt, not after the diff.
Preflight can catch three types of failures: a stale lockfile, uncommitted changes, and rerunning on an old state, each of which costs more than an hour.
All Facts (4)
The core logic of the preflight script preflight.sh is to assert the five assumptions and print the results line by line, exiting with a non-zero code on any failure; implementation details include: the workspace check uses mkdir -p plus a touch probe and gets available MB with df -Pm (default threshold 512MB), the clock check compares the Date header of the first outbound host with local UTC time (default tolerance 120 seconds), the credential check outputs only the first 10 characters of sha256, and the run lock uses exec 9>"$LOCK" plus flock -n 9.
50%UnverifiedThe way to prevent Runner environment drift is: generate a baseline on a clean code tree with sha256sum package-lock.json > env.lock, and write preflight.sh to verify the environment lock and whether the Git working tree is clean before each attempt.
50%UnverifiedPreflight should run before the prompt, not after the diff.
50%UnverifiedPreflight can catch three types of failures: a stale lockfile, uncommitted changes, and rerunning on an old state, each of which costs more than an hour.
50%