Repository navigation
feat(examples): add a real-runtime OpenShell smoke test - #21
Conversation
Run ans-openshell-middleware and ans-reference-callee against an actual OpenShell gateway, supervisor and sandbox on the Docker driver and assert the identity guarantees the middleware makes. The in-process demo plays the supervisor itself; this shows what only a real runtime can: that OpenShell invokes the service, applies its header mutations before the request leaves, and blocks the request when the service is down. examples/openshell-smoke/smoke.sh downloads the pinned OpenShell release (openshell-release.env: SHA-256 per CLI and gateway asset, manifest-list digests for the supervisor and sandbox runtime images), extracts the verified tarballs into the run directory, mints every piece of trust material a deployment normally receives from elsewhere into a temporary directory (fixtures/: fixture transparency-log root key, one identity with its receipt and status token pinned to files, the gateway's Ed25519 JWT key with matching JWKS, a private CA for the middleware listener), builds a digest-pinned workload image with curl, and starts the stack with TLS and gateway-JWT verification on, the request hook required through binding_policy, and the Docker driver scoped to its own sandbox_label so an OpenShell install sharing the daemon is never touched. It then runs five checks: an authorized sandbox's plain request is verified by the callee; forged identity headers are replaced; an unsigned direct request is rejected and logged, which arms the callee-log sentinel; an unapproved sandbox is denied before the callee; a request is blocked while the middleware is down (fail_closed). Long external steps run under deadlines, supervisor container logs are kept on failure, and minted keys are never retained. All OpenShell state lives under the temporary directory. The proto-drift CI job now also diffs the vendored extension protos against the pinned OpenShell commit, so a release bump without a contract re-pin fails CI. The smoke workflow runs on ubuntu-latest for pushes to main, pull requests touching the exercised code or the vendored contract, and on demand, and uploads the retained logs when it fails. Motivation: the runnable, reproducible evidence proposed in ai-openshell/openshell#5011 and the live-gateway verification follow-up deferred by #2. Verified: passing runs against OpenShell v0.1.7 on Docker (Rancher Desktop, Apple silicon), including from an empty asset cache with the digest-pinned runtime images and the CI-style fixed temp directory. Assisted by Claude Code (Claude Fable 5.1) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: kperry <kperry@godaddy.com>
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent smoke runs can destroy an active gateway’s supervisors, while timeout and cleanup defects can hang runs or leave host services, private keys, and Docker volumes behind.
5 open issues
Shared namespace reconciliation destroys supervisors from concurrent runs · New Docker query failure can abort cleanup before services and keys are removed · New Failed runs leave sandbox-scoped Docker volumes behind · New Watchdog sleep keeps captured output pipe open until its deadline · New Release downloads can hang indefinitely without transfer deadlines · New
What changed in this PR
Adds a reproducible OpenShell smoke test that exercises the ANS middleware and reference callee through a real gateway, supervisor and Docker sandbox, covering runtime integration left out of the initial import.
Changes:
- Adds five checks for identity signing, forged-header replacement, unsigned-request rejection, sandbox authorization and fail-closed behavior.
- Pins OpenShell assets and runtime images, and generates disposable identity and trust fixtures.
- Adds CI execution, failure-log uploads, upstream protocol drift checks and usage documentation.
| File | Description |
|---|---|
README.md |
Adds a quick-start command for the runtime smoke test. |
Makefile |
Adds the openshell-smoke target. |
examples/openshell-smoke/workload/Dockerfile |
Provides a digest-pinned workload base with curl. |
examples/openshell-smoke/smoke.sh |
Orchestrates the runtime, assertions and cleanup. |
examples/openshell-smoke/README.md |
Documents requirements, checks, trust boundaries and pin updates. |
examples/openshell-smoke/policy.template.yaml |
Defines restricted callee access and fail-closed middleware policy. |
examples/openshell-smoke/openshell-release.env |
Pins the release commit, asset checksums and runtime image digests. |
examples/openshell-smoke/fixtures/main.go |
Generates disposable identity, JWT and TLS material. |
examples/openshell-smoke/fixtures/main_test.go |
Tests fixture loading, validity, permissions and error handling. |
.gitignore |
Ignores the generated fixture executable. |
.github/workflows/openshell-smoke.yml |
Runs the smoke test and uploads retained failure logs. |
.github/workflows/ci.yml |
Checks vendored protocols against the pinned upstream commit. |
Review effort: Balanced
Address the five findings from the review of the smoke harness. The gateway's startup reconciliation force-removes every supervisor container in its sandbox_label, and the label was stable across runs, so a second smoke run against the same daemon destroyed the first run's sandboxes. Each run now works under a label of its own, suffixed with its pid, so two runs on one daemon never reach each other's sandboxes and a run that dies before its own cleanup leaves leftovers the next run can attribute: everything under a harness label whose pid no longer runs is removed before the gateway starts, and a label whose pid is alive is left alone. No lock is needed; a lock keyed on the socket path or the temp directory would not have identified the daemon anyway. cleanup runs under set +e with SIGINT ignored. A Docker query that failed inside the EXIT trap used to abort the trap before the host services were stopped and the minted keys removed; now every step runs whatever fails along the way, each one bounded (the delete RPC under a deadline, TERM then KILL for the host processes), and nothing is retained when there is nothing to retain. The driver creates three volumes per sandbox and removes them after the containers in a background task; when the gateway died before its delete RPC ran, cleanup removed only containers and the volumes stayed on the daemon. The run's whole label, volumes included, is now removed. On stock macOS the run_bounded watchdog subshell inherited the stdout pipe of a "$(run_bounded ...)" capture and held it open until its sleep ended, so a request that completed at once still took the whole deadline to return. The watchdog's output is redirected away and its sleep is killed with it. run_bounded also finds Homebrew's gtimeout. Release downloads fail on a stall (under 1 KiB/s for 30 s) and retry, with the whole retry sequence bounded to ten minutes; the proto-drift fetch in CI carries a deadline and no longer reports a fetch failure as drift. A Docker daemon that is down is reported before any work starts. Verified live on Docker (Rancher Desktop, Apple silicon): two runs at once both reach READY and neither sees the other's sandboxes; a dead run's containers and volumes are reclaimed while a foreign label is untouched; --print-config works while runs are up and changes nothing; SIGKILL of one run's gateway leaves the other run working and removes the dead run's label entirely, retaining only logs; Ctrl-C cleans up fully; a clean run passes all five checks and leaves nothing behind. Assisted by Claude Code (Claude Fable 5.1) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: kperry <kperry@godaddy.com>
chou-godaddy
left a comment
There was a problem hiding this comment.
Thanks for this. I ran it locally on macOS (Apple silicon, Docker Desktop): all 5 checks pass, teardown is clean, and a separate OpenShell gateway on the same Docker daemon was left alone.
+1 to @bchen-godaddy's two follow-ups (watchdog and BIN). On a full macOS run, the watchdog wait was about 6 of the 8 minutes.
I also ran the script with a few faults (a second concurrent run, a frozen or killed gateway, a failing docker ps) to check Copilot's remaining comments and one more spot in cleanup. What I saw:
| Where | What happened |
|---|---|
| L156 shared label | Starting a second run while one was held with --keep-running removed the first run's supervisor within about a second of the second gateway starting; the first sandbox then went to phase Error. |
L194 docker ps in cleanup |
When it failed, cleanup stopped right after the sandbox deletes, and the run directory, including the minted fixture key, stayed on disk. |
L186 sandbox delete in cleanup |
With the gateway frozen, cleanup was still waiting on the first delete after 90 s. |
| L351 downloads | The same curl flags against a local server that stalls mid-response were still waiting after 60 s. |
| Volumes (Copilot) | After killing the gateway mid-run, three sandbox volumes were left. They were gone after the next runs, which matches the comment on L436 that the next run reclaims leftovers, so this may be fine as is. |
|
Thanks for running the faults; every row in your table reproduces what 0846f46 changes, and the first one is why the fix took a different shape than a lock.
The watchdog and |
|
Reran the same fault tests against 0846f46 on macOS (Docker Desktop): all five checks pass, and each issue in my earlier table no longer reproduces: two runs at once both pass without affecting each other, cleanup finishes with a failing |


Summary
Runs
ans-openshell-middlewareandans-reference-calleeagainst a real OpenShell gateway, supervisor and sandbox on the Docker driver, and asserts the identity guarantees the middleware makes. The in-process demo stands in for the supervisor; this shows what only the real runtime can: that OpenShell invokes the extension, applies its header mutations before the request leaves the sandbox, and blocks the request when the extension is down.Motivation: the runnable, reproducible evidence proposed in NVIDIA/OpenShell#5011, and the live-gateway verification that #2 left out of the initial import, delivered as an executable check rather than a guide.
Changes
examples/openshell-smoke/smoke.shdownloads the pinned OpenShell release, mints all trust material into a temporary directory, builds a digest-pinned workload image with curl, starts the stack with TLS and gateway-JWT verification on and the request hook required throughbinding_policy, then runs five checks:middleware_denied,ans_identity_unauthorized) before the callee is reached;middleware_failed, fail_closed).examples/openshell-smoke/openshell-release.envpins v0.1.7: the release commit, a SHA-256 per CLI and gateway asset, and manifest-list digests for the supervisor and sandbox runtime images.smoke.shrefuses any asset whose digest differs and extracts the verified tarballs fresh into the run directory.examples/openshell-smoke/fixtures/(Go) mints the fixture transparency-log root key, one identity with its receipt and status token pinned to files, the gateway's Ed25519 JWT key with a matching JWKS, and a private CA for the middleware listener. Minted keys are never retained after a run.sandbox_labelof its own per run,ans-openshell-smoke-<pid>, so neither an OpenShell install sharing the daemon nor a concurrent smoke run is touched by the gateway's startup reconciliation or by cleanup. A run removes everything under its label when it ends, failures included; a run that died before its own cleanup is reclaimed by the next run, which removes only labels whose pid no longer runs. Every external step and every teardown call runs under a deadline, cleanup survives a failing daemon and a second Ctrl-C, and supervisor container logs are kept on failure..github/workflows/openshell-smoke.ymlruns the harness onubuntu-latestfor pushes tomain, pull requests touching the exercised code or the vendored contract, and on demand, uploading the retained logs on failure. The proto-drift job inci.ymlnow also diffs the vendored extension protos against the pinned OpenShell commit, so a release bump without a contract re-pin fails CI.make openshell-smoke, a Quick start pointer in the top-level README, andexamples/openshell-smoke/README.md(checks, requirements, what is pinned and how, fixture trust versus production, limitations, updating the pin).Testing
--print-configworks while runs are up and changes nothing; SIGKILL of one run's gateway leaves the other serving signed requests and removes the dead run's label entirely; a double Ctrl-C cleans up fully in about three seconds.go build ./...,go vet ./...,go test -race ./...,golangci-lint run(0 issues) andshellcheckonsmoke.share clean. Library coverage is 98.5%.fixtures/coverage is 82.9%. The uncovered lines are ECDSA key-generation error returns that a test cannot reach on Go 1.26, whereecdsa.GenerateKeyignores a caller-supplied random source. Bad arguments, a non-empty output directory, filesystem errors, the fixed clock across all three certificates, and a failing random source for the Ed25519 key and the UUID are covered.ubuntu-lateston x86_64 from an empty asset cache, all five checks passing against OpenShell v0.1.7, about 45 seconds from first download to teardown. Every earlier run was macOS on Apple silicon, so both supported platforms have now been exercised.Notes for review
CONTRIBUTING.md; the maintainer roster lands with chore: adopt ANS governance and contribution licensing #14.Assisted by Claude Code (Claude Fable 5.1)