pi-agy-provider 1.1.4 → 1.1.6
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/lib/agy-acp-client.ts +5 -2
- package/lib/agy-acp-driver.ts +2 -2
- package/lib/agy-diagnostics.ts +2 -2
- package/lib/agy-driver.ts +2 -2
- package/lib/agy-thoughts.ts +13 -7
- package/package.json +1 -1
package/lib/agy-acp-client.ts
CHANGED
|
@@ -642,6 +642,9 @@ export function extractAcpQuotaSnapshot(response: AcpPromptResponse): AcpQuotaSn
|
|
|
642
642
|
};
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
const ACP_NON_RETRYABLE_QUOTA_RE =
|
|
646
|
+
/\bRESOURCE_EXHAUSTED\b|\bSPEND_CAP_REACHED\b|\b429\b|rate.?limit|spend.?cap|prepaid|weekly.?(?:quota|limit)|\bquota\b/i;
|
|
647
|
+
|
|
645
648
|
/**
|
|
646
649
|
* agy records an exhausted retry (e.g. `503 No capacity`) as an error step and then ends the
|
|
647
650
|
* stream with a normal `end_turn` and no text. Treat that empty turn as the API failure it is.
|
|
@@ -652,7 +655,7 @@ export function acpEmptyTurnApiFailure(
|
|
|
652
655
|
lastApiError: string | undefined,
|
|
653
656
|
): string | undefined {
|
|
654
657
|
if (stopReason !== "end_turn" || responseText.trim() || !lastApiError) return undefined;
|
|
655
|
-
if (
|
|
658
|
+
if (ACP_NON_RETRYABLE_QUOTA_RE.test(lastApiError)) {
|
|
656
659
|
return `Antigravity quota exceeded: request failed after agy gave up retrying (${lastApiError}).`;
|
|
657
660
|
}
|
|
658
661
|
return `Antigravity request failed after agy gave up retrying (${lastApiError}).`;
|
|
@@ -703,7 +706,7 @@ export function formatAcpStopError(
|
|
|
703
706
|
|
|
704
707
|
const ensureNonRetryableRefusal = (msg: string): string =>
|
|
705
708
|
stopReason === "refusal" &&
|
|
706
|
-
|
|
709
|
+
ACP_NON_RETRYABLE_QUOTA_RE.test(msg) &&
|
|
707
710
|
!/quota exceeded/i.test(msg)
|
|
708
711
|
? `Antigravity quota exceeded: ${msg}`
|
|
709
712
|
: msg;
|
package/lib/agy-acp-driver.ts
CHANGED
|
@@ -93,8 +93,8 @@ const LIFECYCLE_LIMIT = 24;
|
|
|
93
93
|
const CANCEL_GRACE_MS = 1_500;
|
|
94
94
|
const TERM_CLOSE_MS = 1_000;
|
|
95
95
|
const MAX_OPEN_SESSIONS = 8;
|
|
96
|
-
const MAX_MODEL_LIVENESS_GRACES =
|
|
97
|
-
const MAX_UPSTREAM_STREAM_GRACES =
|
|
96
|
+
const MAX_MODEL_LIVENESS_GRACES = 12;
|
|
97
|
+
const MAX_UPSTREAM_STREAM_GRACES = 12;
|
|
98
98
|
const MAX_TOOL_LIVENESS_GRACES = 12;
|
|
99
99
|
const PARKED_POLL_MS = 5_000;
|
|
100
100
|
|
package/lib/agy-diagnostics.ts
CHANGED
|
@@ -8,8 +8,8 @@ import which from "which";
|
|
|
8
8
|
import { killAgyTree, trackAgyChild, untrackAgyChild } from "./agy-children.ts";
|
|
9
9
|
|
|
10
10
|
export const MIN_AGY_VERSION = "1.1.22";
|
|
11
|
-
/** Soft target: includes ACP session/cancel fixes (1.5.4+),
|
|
12
|
-
export const RECOMMENDED_AGY_VERSION = "1.5.
|
|
11
|
+
/** Soft target: includes ACP session/cancel fixes (1.5.4+), 1.5.8–1.5.9 ACP auth/error/diff fixes, and 1.5.10 10m stream / 4m rate-limit / ACP background cleanup fixes. */
|
|
12
|
+
export const RECOMMENDED_AGY_VERSION = "1.5.10";
|
|
13
13
|
export function isBelowRecommendedAgy(version: string | undefined): boolean {
|
|
14
14
|
return Boolean(version && valid(version) && !gte(version, RECOMMENDED_AGY_VERSION));
|
|
15
15
|
}
|
package/lib/agy-driver.ts
CHANGED
|
@@ -184,8 +184,8 @@ const TERM_CLOSE_MS = 500;
|
|
|
184
184
|
*/
|
|
185
185
|
const STALL_PARKED_POLL_MS = 10_000;
|
|
186
186
|
const STALL_PARKED_LIMIT = 2;
|
|
187
|
-
const MAX_MODEL_LIVENESS_GRACES =
|
|
188
|
-
const MAX_UPSTREAM_STREAM_GRACES =
|
|
187
|
+
const MAX_MODEL_LIVENESS_GRACES = 12;
|
|
188
|
+
const MAX_UPSTREAM_STREAM_GRACES = 12;
|
|
189
189
|
/**
|
|
190
190
|
* While a tool step is ACTIVE, poll the off-stream transcript this often for a
|
|
191
191
|
* final answer agy is withholding. agy emits nothing on stdout for the whole
|
package/lib/agy-thoughts.ts
CHANGED
|
@@ -44,11 +44,17 @@ const MIN_COMPACTION_CONTEXT_TOKENS = 100_000;
|
|
|
44
44
|
export const AGY_DEFAULT_MAX_RETRY_ATTEMPTS = 10;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Maximum silent TTFB / prefill window (`
|
|
48
|
-
* headers or the first `PLANNER_RESPONSE` step — matches `agy`'s
|
|
49
|
-
* stream idle timeout plus a 30s buffer so internal
|
|
47
|
+
* Maximum silent TTFB / prefill window (`10m30s`) while awaiting upstream HTTP
|
|
48
|
+
* headers or the first `PLANNER_RESPONSE` step — matches `agy 1.5.10`'s `10m0s`
|
|
49
|
+
* stream idle timeout plus a 30s buffer so internal retries fire first.
|
|
50
50
|
*/
|
|
51
|
-
export const UPSTREAM_STREAM_WAIT_WINDOW_MS =
|
|
51
|
+
export const UPSTREAM_STREAM_WAIT_WINDOW_MS = 630_000;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Maximum `Retry-After` backoff tolerated per attempt (`4m`, matching `agy 1.5.10`'s
|
|
55
|
+
* rate-limit wait window).
|
|
56
|
+
*/
|
|
57
|
+
export const MAX_RETRY_WAIT_WINDOW_MS = 240_000;
|
|
52
58
|
|
|
53
59
|
export function resolveAgyRetryLabel(apiError?: string): string {
|
|
54
60
|
if (!apiError) return "Model unavailable";
|
|
@@ -1085,7 +1091,7 @@ export class AgyThoughtTracker {
|
|
|
1085
1091
|
/**
|
|
1086
1092
|
* True when `cli-*.log` / `acp-server-*.log` or SQLite step state shows an
|
|
1087
1093
|
* upstream request or post-step planner call still awaiting its first SQLite
|
|
1088
|
-
* planner step (TTFB / high-effort prefill, up to `agy`'s `
|
|
1094
|
+
* planner step (TTFB / high-effort prefill, up to `agy 1.5.10`'s `10m0s` stream timeout).
|
|
1089
1095
|
*/
|
|
1090
1096
|
get isAwaitingUpstreamStream(): boolean {
|
|
1091
1097
|
const nowMs = this.#now();
|
|
@@ -1574,10 +1580,10 @@ export class AgyThoughtTracker {
|
|
|
1574
1580
|
this.#activeStreamResponseId = undefined;
|
|
1575
1581
|
this.#streamStartMaxIdx = -1;
|
|
1576
1582
|
const parsedMs = parseGlogTimestampMs(line, nowMs);
|
|
1577
|
-
if (isInitialReplay && parsedMs !== undefined && nowMs - parsedMs >
|
|
1583
|
+
if (isInitialReplay && parsedMs !== undefined && nowMs - parsedMs > MAX_RETRY_WAIT_WINDOW_MS) {
|
|
1578
1584
|
continue;
|
|
1579
1585
|
}
|
|
1580
|
-
const delayMs = Math.min(parseGoDurationMs(retryMatch[1]!) ?? 30_000,
|
|
1586
|
+
const delayMs = Math.min(parseGoDurationMs(retryMatch[1]!) ?? 30_000, MAX_RETRY_WAIT_WINDOW_MS);
|
|
1581
1587
|
const sleepEndsAtMs = (parsedMs ?? nowMs) + delayMs;
|
|
1582
1588
|
const attemptFailure = /\battempt (\d+) failed \((.+)\), retrying in/.exec(line);
|
|
1583
1589
|
if (attemptFailure) {
|