Test a local patch
Short answer: Use airgap_verify_patch when you have an uncommitted unified diff on your machine that is not on GitHub yet. Your agent supplies the clean base files and the unified diff; airgap uploads that snapshot to a disposable Linux microVM, checks and applies the patch with git apply, runs your test command, scrubs secrets from the logs, and destroys the VM.
use airgap to verify this patch before I commit itapply this diff to our base files in airgap and run pytestHow patch verification isolates your working tree
airgap never reads your local repository or working tree on its own. Because a diff alone cannot reconstruct a project, the caller explicitly sends only the clean base files needed to build and test. Inside the remote /workspace directory, airgap runs:
- Path validation: Rejects absolute paths, path traversal (
..), Windows drive prefixes, control characters, symlinks, and.gitmetadata. Files are uploaded as regular UTF-8 files (mode0644). - Dry-run and apply: Runs
git apply --checkbeforegit applyso a broken or stale patch fails cleanly without running tests against partial files. - Test execution and summary parsing: Runs your
test_commandwith a bounded timeout, redacts secrets from output, and hashes the request, base snapshot, and result into an unsigned SHA-256 receipt.
Inputs and limits
| Field / Limit | Value | Notes |
|---|---|---|
diff | Required string | Standard unified diff applied with git apply |
test_command | Required string | Shell command that builds and executes tests |
files | Required object | Map of relative file path to UTF-8 base file content |
image | Auto-detected | Image must provide sh, tar, mkdir, sleep, and git |
timeout_secs | 120 s (1..1800 s) | Plus up to 600 s for first-time template provisioning |
| Snapshot cap | 2000 files / 8 MiB | Total path + content bytes; upload only minimal files needed |
Direct MCP tool call
{
"tool": "airgap_verify_patch",
"arguments": {
"diff": "--- a/src/lib.rs\n+++ b/src/lib.rs\n@@ -1 +1 @@\n-pub fn add(a: i32, b: i32) -> i32 { a - b }\n+pub fn add(a: i32, b: i32) -> i32 { a + b }\n",
"test_command": "cargo test --quiet",
"files": {
"Cargo.toml": "[package]\nname = \"demo\"\nversion = \"0.1.0\"\nedition = \"2021\"\n",
"src/lib.rs": "pub fn add(a: i32, b: i32) -> i32 { a - b }\n#[test] fn ok() { assert_eq!(add(2, 2), 4); }\n"
}
}
}Verification rules and troubleshooting
verified: true requires exit code 0, untruncated logs, a recognized Rust or pytest test summary, at least one passing test, and zero failures. If your stack prints an unrecognized test summary format, airgap returns command_passed: true with null counts and verified: false rather than guessing. For GitHub pull requests, prefer Verify a pull request so you never have to serialize files manually.