Skip to content

Commit 1013093

Browse files
fix(server): derive the Antigravity health timeout from the interval floor
The interval floor exists because the Antigravity probe may keep its ACP process alive for up to its timeout. Keeping both as separate literals lets them drift apart, so the probe now uses the shared constant. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent cb782c2 commit 1013093

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎apps/server/src/provider/Layers/AntigravityProvider.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
ANTIGRAVITY_DEFAULT_MODEL,
3+
MIN_PROVIDER_HEALTH_REFRESH_INTERVAL,
34
ProviderDriverKind,
45
type AntigravitySettings,
56
type ProviderSetupError,
@@ -9,6 +10,7 @@ import {
910
} from "@t3tools/contracts";
1011
import { createModelCapabilities } from "@t3tools/shared/model";
1112
import * as DateTime from "effect/DateTime";
13+
import * as Duration from "effect/Duration";
1214
import * as Effect from "effect/Effect";
1315
import * as Option from "effect/Option";
1416
import * as Predicate from "effect/Predicate";
@@ -32,7 +34,10 @@ import {
3234

3335
const EMPTY_MODEL_CAPABILITIES = createModelCapabilities({ optionDescriptors: [] });
3436
const MAX_WORKSPACE_SNAPSHOTS = 32;
35-
const HEALTH_CHECK_TIMEOUT = "90 seconds";
37+
// The probe spawns the full ACP server, so the refresh interval floor is
38+
// defined as this timeout: a tick can never start while the previous probe's
39+
// process may still be alive.
40+
const HEALTH_CHECK_TIMEOUT = MIN_PROVIDER_HEALTH_REFRESH_INTERVAL;
3641
const SIGN_IN_MESSAGE = "Sign in with Google to use Antigravity.";
3742
const AUTH_UNCHECKED_MESSAGE =
3843
"Antigravity is installed. Google account access is not checked yet.";
@@ -189,7 +194,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
189194
? "Antigravity is not installed or its executable could not be found."
190195
: failure
191196
? "Antigravity could not complete its local health check."
192-
: `Antigravity did not respond to its local health check within ${HEALTH_CHECK_TIMEOUT}.`;
197+
: `Antigravity did not respond to its local health check within ${Duration.toSeconds(HEALTH_CHECK_TIMEOUT)} seconds.`;
193198
const supportsTextGeneration =
194199
initialized !== undefined ? yield* options.supportsTextGeneration : false;
195200
const updatedAt = DateTime.formatIso(yield* DateTime.now);

‎packages/contracts/src/settings.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,9 @@ export const DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL = Duration.seconds(30);
914914
export const DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL = Duration.minutes(5);
915915
/**
916916
* Shortest allowed gap between provider health probes. Zero still disables
917-
* them. Matches the 90 second probe timeout of the slowest process-based
918-
* check (Antigravity spawns its full ACP server), so a short interval cannot
919-
* respawn that process back-to-back.
917+
* them. The slowest process-based probe (Antigravity spawns its full ACP
918+
* server) uses this same value as its timeout, so a tick can never start
919+
* while the previous probe's process may still be alive.
920920
*/
921921
export const MIN_PROVIDER_HEALTH_REFRESH_INTERVAL = Duration.seconds(90);
922922

0 commit comments

Comments
 (0)