@treeseed/sdk 0.12.22 → 0.12.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -192,8 +192,13 @@ function runWrangler(tenantRoot, args, extraEnv = {}, options = {}) {
192
192
  }
193
193
  return result;
194
194
  }
195
+ const WRANGLER_TRANSIENT_MAX_ATTEMPTS = 6;
196
+ const WRANGLER_COMMAND_TIMEOUT_MS = 18e4;
197
+ function wranglerTransientRetryDelayMs(attempt) {
198
+ return Math.min(5e3 * 2 ** (attempt - 1), 6e4);
199
+ }
195
200
  function isTransientWranglerOutput(output) {
196
- return /fetch failed|timed out|etimedout|econnreset|enetunreach|temporarily unavailable|connectivity issue|internal error|aborted/i.test(output);
201
+ return /fetch failed|timed out|etimedout|econnreset|enetunreach|temporarily unavailable|connectivity issue|internal error|code:\s*7500|aborted/i.test(output);
197
202
  }
198
203
  async function runPrefixedWranglerWithRetry(tenantRoot, args, {
199
204
  env: env2 = {},
@@ -201,7 +206,7 @@ async function runPrefixedWranglerWithRetry(tenantRoot, args, {
201
206
  prefix
202
207
  }) {
203
208
  let lastOutput = "";
204
- for (let attempt = 1; attempt <= 3; attempt += 1) {
209
+ for (let attempt = 1; attempt <= WRANGLER_TRANSIENT_MAX_ATTEMPTS; attempt += 1) {
205
210
  const wrangler = resolveTreeseedToolCommand("wrangler");
206
211
  if (!wrangler) {
207
212
  throw new Error("Wrangler CLI is unavailable.");
@@ -210,22 +215,24 @@ async function runPrefixedWranglerWithRetry(tenantRoot, args, {
210
215
  cwd: tenantRoot,
211
216
  env: env2,
212
217
  write,
213
- prefix
218
+ prefix,
219
+ timeoutMs: WRANGLER_COMMAND_TIMEOUT_MS
214
220
  });
215
221
  if (result.status === 0) {
216
222
  return result;
217
223
  }
218
224
  lastOutput = [result.stderr?.trim(), result.stdout?.trim()].filter(Boolean).join("\n");
219
- if (attempt === 3 || !isTransientWranglerOutput(lastOutput)) {
225
+ if (attempt === WRANGLER_TRANSIENT_MAX_ATTEMPTS || !isTransientWranglerOutput(lastOutput)) {
220
226
  throw new Error(lastOutput || `wrangler ${args.join(" ")} failed`);
221
227
  }
228
+ const retryDelayMs = wranglerTransientRetryDelayMs(attempt);
222
229
  writeTreeseedBootstrapLine(
223
230
  write,
224
231
  { ...prefix, stage: "retry" },
225
- `Wrangler command hit a transient failure; retrying in ${2 * attempt}s...`,
232
+ `Wrangler command hit a transient failure; retrying in ${Math.round(retryDelayMs / 1e3)}s...`,
226
233
  "stderr"
227
234
  );
228
- await sleep(2e3 * attempt);
235
+ await sleep(retryDelayMs);
229
236
  }
230
237
  throw new Error(lastOutput || `wrangler ${args.join(" ")} failed`);
231
238
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.12.22",
3
+ "version": "0.12.23",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -154,6 +154,7 @@ __WORKING_DIRECTORY_BLOCK__ web:
154
154
  done
155
155
 
156
156
  - name: Run web workflow action
157
+ timeout-minutes: 30
157
158
  shell: bash
158
159
  run: |
159
160
  set -euo pipefail