Add SDK health wait gate (#206)

* Add SDK health wait gate

* Default connect to waiting for health

* Document connect health wait default

* Add abort signal to connect health wait

* Refactor SDK health probe helper

* Update quickstart health wait note

* Remove example health polling

* Fix docker example codex startup
This commit is contained in:
Nathan Flurry 2026-03-06 00:05:06 -08:00 committed by GitHub
parent 4335ef6af6
commit e7343e14bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 423 additions and 95 deletions

View file

@ -4,7 +4,6 @@ import fs from "node:fs";
import path from "node:path";
import { PassThrough } from "node:stream";
import { fileURLToPath } from "node:url";
import { waitForHealth } from "./sandbox-agent-client.ts";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const EXAMPLE_IMAGE = "sandbox-agent-examples:latest";
@ -173,7 +172,7 @@ async function ensureExampleImage(_docker: Docker): Promise<string> {
}
/**
* Start a Docker container running sandbox-agent and wait for it to be healthy.
* Start a Docker container running sandbox-agent.
* Registers SIGINT/SIGTERM handlers for cleanup.
*/
export async function startDockerSandbox(opts: DockerSandboxOptions): Promise<DockerSandbox> {
@ -275,18 +274,8 @@ export async function startDockerSandbox(opts: DockerSandboxOptions): Promise<Do
}
const baseUrl = `http://127.0.0.1:${mappedHostPort}`;
try {
await waitForHealth({ baseUrl });
} catch (err) {
stopStartupLogs();
console.error(" Container logs:");
for (const chunk of logChunks) {
process.stderr.write(` ${chunk}`);
}
throw err;
}
stopStartupLogs();
console.log(` Ready (${baseUrl})`);
console.log(` Started (${baseUrl})`);
const cleanup = async () => {
stopStartupLogs();