fix: wire maxAttempts parameter in waitForCloudInit for hetzner and digitalocean (#2380)

The `_maxAttempts` parameter in both Hetzner and DigitalOcean's
`waitForCloudInit()` was silently ignored — loop bounds and early-exit
checks were hardcoded. Rename to `maxAttempts` and use it consistently,
matching the AWS/GCP implementations.

Fixes #2378

Agent: issue-fixer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-03-09 06:35:43 -07:00 committed by GitHub
parent f23da1523b
commit 2074211d13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@openrouter/spawn",
"version": "0.15.26",
"version": "0.15.27",
"type": "module",
"bin": {
"spawn": "cli.js"

View file

@ -1009,7 +1009,7 @@ export async function waitForSshOnly(ip?: string): Promise<void> {
// ─── SSH Execution ───────────────────────────────────────────────────────────
export async function waitForCloudInit(ip?: string, _maxAttempts = 60): Promise<void> {
export async function waitForCloudInit(ip?: string, maxAttempts = 60): Promise<void> {
const serverIp = ip || _state.serverIp;
const selectedKeys = await ensureSshKeys();
const keyOpts = getSshKeyOpts(selectedKeys);
@ -1062,7 +1062,7 @@ export async function waitForCloudInit(ip?: string, _maxAttempts = 60): Promise<
}
// Fallback poll if streaming failed (e.g. log file not yet created)
for (let attempt = 1; attempt <= 20; attempt++) {
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
try {
const proc = Bun.spawn(
[
@ -1093,7 +1093,7 @@ export async function waitForCloudInit(ip?: string, _maxAttempts = 60): Promise<
} catch {
/* ignore */
}
logStepInline(`Cloud-init in progress (${attempt}/20)`);
logStepInline(`Cloud-init in progress (${attempt}/${maxAttempts})`);
await sleep(5000);
}
logStepDone();

View file

@ -497,7 +497,7 @@ export async function createServer(
// ─── SSH Execution ───────────────────────────────────────────────────────────
export async function waitForCloudInit(ip?: string, _maxAttempts = 60): Promise<void> {
export async function waitForCloudInit(ip?: string, maxAttempts = 60): Promise<void> {
const serverIp = ip || _state.serverIp;
const selectedKeys = await ensureSshKeys();
const keyOpts = getSshKeyOpts(selectedKeys);
@ -509,7 +509,7 @@ export async function waitForCloudInit(ip?: string, _maxAttempts = 60): Promise<
});
logStep("Waiting for cloud-init to complete...");
for (let attempt = 1; attempt <= 60; attempt++) {
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
try {
const proc = Bun.spawn(
[
@ -541,12 +541,12 @@ export async function waitForCloudInit(ip?: string, _maxAttempts = 60): Promise<
} catch {
// ignore
}
if (attempt >= 60) {
if (attempt >= maxAttempts) {
logStepDone();
logWarn("Cloud-init marker not found, continuing anyway...");
return;
}
logStepInline(`Cloud-init in progress (${attempt}/60)`);
logStepInline(`Cloud-init in progress (${attempt}/${maxAttempts})`);
await sleep(5000);
}
}