test: harden live docker lanes

This commit is contained in:
Peter Steinberger
2026-04-24 05:54:49 +01:00
parent 01e4824fd3
commit 1e83357abe
5 changed files with 197 additions and 123 deletions

View File

@@ -41,9 +41,9 @@ export type McpClientHandle = {
rawMessages: unknown[];
};
const GATEWAY_WS_OPEN_TIMEOUT_MS = 5_000;
const GATEWAY_WS_OPEN_TIMEOUT_MS = 15_000;
const GATEWAY_RPC_TIMEOUT_MS = 30_000;
const GATEWAY_CONNECT_RETRY_WINDOW_MS = 120_000;
const GATEWAY_CONNECT_RETRY_WINDOW_MS = 240_000;
export function assert(condition: unknown, message: string): asserts condition {
if (!condition) {
@@ -118,10 +118,10 @@ async function connectGatewayOnce(params: {
}): Promise<GatewayRpcClient> {
const ws = new WebSocket(params.url);
await new Promise<void>((resolve, reject) => {
const timeout = setTimeout(
() => reject(new Error("gateway ws open timeout")),
GATEWAY_WS_OPEN_TIMEOUT_MS,
);
const timeout = setTimeout(() => {
ws.close();
reject(new Error("gateway ws open timeout"));
}, GATEWAY_WS_OPEN_TIMEOUT_MS);
timeout.unref?.();
ws.once("open", () => {
clearTimeout(timeout);

View File

@@ -184,6 +184,20 @@ cd "$tmp_dir"
if [ "${OPENCLAW_LIVE_CODEX_HARNESS_USE_CI_SAFE_CODEX_CONFIG:-1}" = "1" ]; then
node --import tsx /src/scripts/prepare-codex-ci-config.ts "$HOME/.codex/config.toml" "$tmp_dir"
fi
codex_preflight_log="$tmp_dir/codex-preflight.log"
codex_preflight_token="CODEX-PREFLIGHT-OK"
if ! "$NPM_CONFIG_PREFIX/bin/codex" exec \
--json \
--color never \
--skip-git-repo-check \
"Reply exactly: $codex_preflight_token" >"$codex_preflight_log" 2>&1; then
if grep -q "Failed to extract accountId from token" "$codex_preflight_log"; then
echo "SKIP: Codex auth cannot extract accountId from the available token; skipping live Codex harness lane."
exit 0
fi
cat "$codex_preflight_log" >&2
exit 1
fi
pnpm test:live ${OPENCLAW_LIVE_CODEX_TEST_FILES:-src/gateway/gateway-codex-harness.live.test.ts}
EOF