Skip to content

The open-source app everyone uses to manage agents at work

Unblock canary onboard smoke bootstrap

Dotta01c5a6f198e7
diff --git a/cli/src/commands/auth-bootstrap-ceo.ts b/cli/src/commands/auth-bootstrap-ceo.ts
index ec539396cc..dc720f63d8 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<void>;
+ };
+ };
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 c441a6236d..41c875be6e 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"
}