@@ -374,7 +374,13 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
374374 it . effect ( "publishes session metadata and native commands without another health probe" , ( ) =>
375375 Effect . scoped (
376376 Effect . gen ( function * ( ) {
377- const harness = yield * makeHarness ( ) ;
377+ let usageReads = 0 ;
378+ const harness = yield * makeHarness ( {
379+ probeUsage : Effect . sync ( ( ) => {
380+ usageReads ++ ;
381+ return { checkedAt : "2026-01-01T00:00:00.000Z" , windows : [ ] } ;
382+ } ) ,
383+ } ) ;
378384 yield * harness . initialize ;
379385 const nextReady = yield * Stream . toPull (
380386 harness . provider . snapshot . streamChanges . pipe (
@@ -392,6 +398,8 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
392398 auth : { status : "authenticated" , type : "oauth-personal" } ,
393399 supportsTextGeneration : true ,
394400 } ) ;
401+ expect ( snapshot . usageLimits ?. unavailable ?. reason ) . toBe ( "probeFailed" ) ;
402+ expect ( usageReads ) . toBe ( 0 ) ;
395403 expect ( snapshot . models ) . toEqual ( buildAntigravityModelsFromSession ( sessionSetupResult ) ) ;
396404 expect ( snapshot . slashCommands ) . toEqual ( expectedCommands ) ;
397405 expect ( ( yield * harness . provider . snapshotForCwd ( "/workspace" ) ) . slashCommands ) . toEqual (
@@ -718,7 +726,10 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
718726 } ;
719727 const usage = yield * Ref . make ( limits ) ;
720728 const harness = yield * makeHarness ( { probeUsage : Ref . get ( usage ) } ) ;
721- const published = yield * harness . nextPublish ( ( snapshot ) => ! ! snapshot . usageLimits ) ;
729+ const published = yield * harness . nextPublish (
730+ ( snapshot ) =>
731+ snapshot . usageLimits !== undefined && snapshot . usageLimits . unavailable === undefined ,
732+ ) ;
722733 yield * harness . initialize ;
723734 expect ( ( yield * published ) ?. usageLimits ) . toEqual ( limits ) ;
724735 // The second health check is the one the failed background read triggers.
@@ -805,14 +816,17 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
805816 Effect . andThen ( Deferred . await ( readResult ) ) ,
806817 ) ,
807818 } ) ;
808- const published = yield * harness . nextPublish ( ( snapshot ) => ! ! snapshot . usageLimits ) ;
819+ const published = yield * harness . nextPublish (
820+ ( snapshot ) =>
821+ snapshot . usageLimits !== undefined && snapshot . usageLimits . unavailable === undefined ,
822+ ) ;
809823 yield * harness . initialize ;
810824 yield * Deferred . await ( readStarted ) ;
811825 yield * harness . provider . onSessionStarted ( started , "/workspace" ) ;
812826 yield * harness . provider . onSessionStarted ( started , "/other" ) ;
813827 const ready = yield * harness . provider . snapshot . getSnapshot ;
814828 expect ( ready ) . toMatchObject ( { status : "ready" , auth : { status : "authenticated" } } ) ;
815- expect ( ready . usageLimits ) . toBeUndefined ( ) ;
829+ expect ( ready . usageLimits ?. unavailable ?. reason ) . toBe ( "probeFailed" ) ;
816830 expect ( yield * Ref . get ( reads ) ) . toBe ( 1 ) ;
817831 const limits = {
818832 checkedAt : "2026-10-09T12:00:00.000Z" ,
@@ -838,7 +852,10 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
838852 Deferred . succeed ( oldReadStarted , undefined ) . pipe ( Effect . andThen ( Effect . never ) ) ,
839853 ) ;
840854 const harness = yield * makeHarness ( { probeUsage : Ref . get ( usage ) . pipe ( Effect . flatten ) } ) ;
841- const published = yield * harness . nextPublish ( ( snapshot ) => ! ! snapshot . usageLimits ) ;
855+ const published = yield * harness . nextPublish (
856+ ( snapshot ) =>
857+ snapshot . usageLimits !== undefined && snapshot . usageLimits . unavailable === undefined ,
858+ ) ;
842859 yield * harness . initialize ;
843860 yield * Deferred . await ( oldReadStarted ) ;
844861 yield * Ref . set ( usage , Effect . succeed ( newLimits ) ) ;
@@ -853,7 +870,7 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
853870 } satisfies ServerProviderUsageLimits ;
854871 yield * Ref . set ( usage , Effect . succeed ( failed ) ) ;
855872 const republished = yield * harness . nextPublish (
856- ( snapshot ) => snapshot . usageLimits ?. unavailable ?. reason === "probeFailed" ,
873+ ( snapshot ) => snapshot . usageLimits ?. checkedAt === failed . checkedAt ,
857874 ) ;
858875 yield * harness . provider . onSignedIn ;
859876 expect ( ( yield * harness . provider . snapshot . getSnapshot ) . usageLimits ) . toBeUndefined ( ) ;
0 commit comments