@@ -12,6 +12,7 @@ import * as Fiber from "effect/Fiber";
1212import * as Layer from "effect/Layer" ;
1313import * as PubSub from "effect/PubSub" ;
1414import * as Ref from "effect/Ref" ;
15+ import * as Result from "effect/Result" ;
1516import * as Schema from "effect/Schema" ;
1617import * as Scope from "effect/Scope" ;
1718import * as Sink from "effect/Sink" ;
@@ -22,6 +23,7 @@ import {
2223 EnvironmentId ,
2324 ClaudeSettings ,
2425 CodexSettings ,
26+ GrokSettings ,
2527 DEFAULT_SERVER_SETTINGS ,
2628 PROVIDER_WORKSPACE_SNAPSHOT_TTL_MS ,
2729 ProviderDriverKind ,
@@ -40,6 +42,7 @@ import { applyServerSettingsPatch } from "@t3tools/shared/serverSettings";
4042
4143import { checkCodexProviderStatus , type CodexAppServerProviderSnapshot } from "./CodexProvider.ts" ;
4244import { checkClaudeProviderStatus } from "./ClaudeProvider.ts" ;
45+ import { checkGrokProviderStatus } from "./GrokProvider.ts" ;
4346import * as BackgroundPolicy from "../background/BackgroundPolicy.ts" ;
4447import * as AntigravityInstallation from "./AntigravityInstallation.ts" ;
4548import * as ModelManifest from "./ModelManifest.ts" ;
@@ -80,6 +83,7 @@ const disabledDefaultSlots = (
8083 ) ;
8184
8285const defaultClaudeSettings : ClaudeSettings = Schema . decodeSync ( ClaudeSettings ) ( { } ) ;
86+ const defaultGrokSettings : GrokSettings = Schema . decodeSync ( GrokSettings ) ( { enabled : true } ) ;
8387const defaultCodexSettings : CodexSettings = Schema . decodeSync ( CodexSettings ) ( { } ) ;
8488const decodeCodexSettings = Schema . decodeSync ( CodexSettings ) ;
8589const disabledCodexSettings : CodexSettings = Schema . decodeSync ( CodexSettings ) ( {
@@ -597,6 +601,7 @@ it.layer(
597601 const killCalls = yield * Ref . make ( 0 ) ;
598602 const statusFiber = yield * checkCodexProviderStatus ( defaultCodexSettings ) . pipe (
599603 Effect . provide ( layerHangingScopedSpawner ( killCalls ) ) ,
604+ Effect . result ,
600605 Effect . forkChild ,
601606 ) ;
602607
@@ -605,16 +610,44 @@ it.layer(
605610 yield * Effect . yieldNow ;
606611
607612 const status = yield * Fiber . join ( statusFiber ) ;
608- assert . strictEqual ( status . status , "error" ) ;
613+ assert . strictEqual ( Result . isFailure ( status ) , true ) ;
609614 assert . strictEqual (
610- status . message ,
611- "Timed out while checking Codex app-server provider status. " ,
615+ Result . isFailure ( status ) ? status . failure . _tag : null ,
616+ "ProviderProbeTimeoutError " ,
612617 ) ;
613618 assert . strictEqual ( yield * Ref . get ( killCalls ) , 1 ) ;
614619 } ) ,
615620 ) ;
616621 } ) ;
617622
623+ it . effect . each ( [ "Claude Agent" , "Grok" ] as const ) (
624+ "closes the %s version probe scope on timeout" ,
625+ ( provider ) =>
626+ Effect . gen ( function * ( ) {
627+ const killCalls = yield * Ref . make ( 0 ) ;
628+ const check = Effect . gen ( function * ( ) {
629+ if ( provider === "Grok" ) {
630+ return yield * checkGrokProviderStatus ( defaultGrokSettings ) ;
631+ }
632+ return yield * checkClaudeProviderStatus ( defaultClaudeSettings ) ;
633+ } ) ;
634+ const statusFiber = yield * check . pipe (
635+ Effect . provide ( layerHangingScopedSpawner ( killCalls ) ) ,
636+ Effect . flip ,
637+ Effect . forkChild ,
638+ ) ;
639+
640+ yield * Effect . yieldNow ;
641+ yield * TestClock . adjust ( "4 seconds" ) ;
642+ const timeout = yield * Fiber . join ( statusFiber ) ;
643+ assert . strictEqual ( timeout . _tag , "ProviderProbeTimeoutError" ) ;
644+ assert . strictEqual ( timeout . provider , provider ) ;
645+ assert . strictEqual ( timeout . timeoutMs , 4_000 ) ;
646+ assert . strictEqual ( timeout . installed , true ) ;
647+ assert . strictEqual ( yield * Ref . get ( killCalls ) , 1 ) ;
648+ } ) ,
649+ ) ;
650+
618651 describe ( "ProviderRegistry.layer" , ( ) => {
619652 it ( "stores workspace skills and commands without changing machine metadata" , ( ) => {
620653 const provider = {
0 commit comments