@juanbenjumea/pi-agy 0.7.2 → 0.7.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.3
4
+
5
+ - Retry health probes once on timeout so cold-start OAuth stampedes no longer fail delegation runs; auth failures, missing binaries, and cancellations still fail fast. Live smoke probe cap raised for the same cold-start reason.
6
+ - Full 282-test gate plus typecheck and package checks pass.
7
+
3
8
  ## 0.7.2
4
9
 
5
10
  - Resolve stderr text when a successful run leaves stdout empty or whitespace-only (ported from upstream 0.3.8/0.3.9), after the terminal-status and permission-denial fail-closed checks so those semantics stand; stdout responses still win over stderr diagnostics.
@@ -29,10 +29,7 @@ export async function runPreflight(
29
29
 
30
30
  const health = healthFresh
31
31
  ? Promise.resolve()
32
- : Promise.all([
33
- checkAgyHealth(cwd, signal, timeoutMs),
34
- checkAgyConnectivity(cwd, signal, timeoutMs),
35
- ]).then(() => undefined);
32
+ : runHealthWithRetry(cwd, signal, timeoutMs).then(() => undefined);
36
33
  const usage = usageFresh ? Promise.resolve(cachedUsage) : checkAgyUsage(cwd, signal, timeoutMs);
37
34
  const [, refreshedUsage] = await Promise.all([health, usage]);
38
35
  if (!healthFresh) cachedAt = Date.now();
@@ -43,6 +40,31 @@ export async function runPreflight(
43
40
  return cachedUsage;
44
41
  }
45
42
 
43
+ /**
44
+ * Health probes with one retry on timeout. Four parallel cold agy spawns
45
+ * can serialize behind a single OAuth refresh past the per-probe cap; the
46
+ * retry almost always lands warm. Only timeouts retry: auth failures,
47
+ * missing binaries, and cancellations fail fast on first attempt.
48
+ */
49
+ async function runHealthWithRetry(
50
+ cwd: string,
51
+ signal: AbortSignal | undefined,
52
+ timeoutMs: number | undefined,
53
+ ): Promise<void> {
54
+ const attempt = (): Promise<void> =>
55
+ Promise.all([
56
+ checkAgyHealth(cwd, signal, timeoutMs),
57
+ checkAgyConnectivity(cwd, signal, timeoutMs),
58
+ ]).then(() => undefined);
59
+ try {
60
+ await attempt();
61
+ } catch (error) {
62
+ if (signal?.aborted) throw error;
63
+ if (!(error instanceof Error) || !/timed out/i.test(error.message)) throw error;
64
+ await attempt();
65
+ }
66
+ }
67
+
46
68
  /** Test helper — reset the in-process cache. */
47
69
  export function resetPreflightCache(): void {
48
70
  cachedAt = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juanbenjumea/pi-agy",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Reliable Antigravity delegation for Pi — quota-aware runs, resumable tasks, repo verification, cancellation, and trustworthy diff summaries.",
5
5
  "type": "module",
6
6
  "license": "MIT",