From 01c5a6f198e782dcb6a6b18bdea967636ef45d06 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 9 Mar 2026 16:06:16 -0500 Subject: [PATCH] Unblock canary onboard smoke bootstrap --- cli/src/commands/auth-bootstrap-ceo.ts | 7 +++++++ scripts/docker-onboard-smoke.sh | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/cli/src/commands/auth-bootstrap-ceo.ts b/cli/src/commands/auth-bootstrap-ceo.ts index ec539396..dc720f63 100644 --- a/cli/src/commands/auth-bootstrap-ceo.ts +++ b/cli/src/commands/auth-bootstrap-ceo.ts @@ -75,6 +75,11 @@ export async function bootstrapCeoInvite(opts: { } const db = createDb(dbUrl); + const closableDb = db as typeof db & { + $client?: { + end?: (options?: { timeout?: number }) => Promise; + }; + }; try { const existingAdminCount = await db .select() @@ -122,5 +127,7 @@ export async function bootstrapCeoInvite(opts: { } catch (err) { p.log.error(`Could not create bootstrap invite: ${err instanceof Error ? err.message : String(err)}`); p.log.info("If using embedded-postgres, start the Paperclip server and run this command again."); + } finally { + await closableDb.$client?.end?.({ timeout: 5 }).catch(() => undefined); } } diff --git a/scripts/docker-onboard-smoke.sh b/scripts/docker-onboard-smoke.sh index c441a623..41c875be 100755 --- a/scripts/docker-onboard-smoke.sh +++ b/scripts/docker-onboard-smoke.sh @@ -49,20 +49,27 @@ wait_for_http() { generate_bootstrap_invite_url() { local bootstrap_output - bootstrap_output="$( + local bootstrap_status + if bootstrap_output="$( docker exec \ -e PAPERCLIP_DEPLOYMENT_MODE="$PAPERCLIP_DEPLOYMENT_MODE" \ -e PAPERCLIP_DEPLOYMENT_EXPOSURE="$PAPERCLIP_DEPLOYMENT_EXPOSURE" \ -e PAPERCLIP_PUBLIC_URL="$PAPERCLIP_PUBLIC_URL" \ -e PAPERCLIP_HOME="/paperclip" \ "$CONTAINER_NAME" bash -lc \ - 'npx --yes "paperclipai@${PAPERCLIPAI_VERSION}" auth bootstrap-ceo --data-dir "$PAPERCLIP_HOME" --base-url "$PAPERCLIP_PUBLIC_URL"' \ + 'timeout 20s npx --yes "paperclipai@${PAPERCLIPAI_VERSION}" auth bootstrap-ceo --data-dir "$PAPERCLIP_HOME" --base-url "$PAPERCLIP_PUBLIC_URL"' \ 2>&1 - )" || { + )"; then + bootstrap_status=0 + else + bootstrap_status=$? + fi + + if [[ $bootstrap_status -ne 0 && $bootstrap_status -ne 124 ]]; then echo "Smoke bootstrap failed: could not run bootstrap-ceo inside container" >&2 printf '%s\n' "$bootstrap_output" >&2 return 1 - } + fi local invite_url invite_url="$( @@ -77,6 +84,10 @@ generate_bootstrap_invite_url() { return 1 fi + if [[ $bootstrap_status -eq 124 ]]; then + echo " Smoke bootstrap: bootstrap-ceo timed out after printing invite URL; continuing" >&2 + fi + printf '%s\n' "$invite_url" }