@@ -402,7 +402,11 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => {
402402
403403 // A stand-in for the Grok CLI: `--version` and `models` print canned text,
404404 // and `agent stdio` execs the mock ACP agent so `initialize` returns model metadata.
405- const writeFakeGrokCli = ( input : { readonly modelsOutput : string ; readonly acp : boolean } ) =>
405+ const writeFakeGrokCli = ( input : {
406+ readonly modelsOutput : string ;
407+ readonly acp : boolean ;
408+ readonly updateLogPath ?: string ;
409+ } ) =>
406410 Effect . gen ( function * ( ) {
407411 const fs = yield * FileSystem . FileSystem ;
408412 const dir = yield * fs . makeTempDirectoryScoped ( { prefix : "t3code-grok-probe-" } ) ;
@@ -411,6 +415,14 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => {
411415 directory : dir ,
412416 name : "grok" ,
413417 source : [
418+ ...( input . updateLogPath
419+ ? [
420+ 'import { appendFileSync as appendUpdateAttempt } from "node:fs";' ,
421+ 'if (process.env.GROK_DISABLE_AUTOUPDATER !== "1") {' ,
422+ ` appendUpdateAttempt(${ JSON . stringify ( input . updateLogPath ) } , "update\\n");` ,
423+ "}" ,
424+ ]
425+ : [ ] ) ,
414426 'if (process.argv[2] === "--version") {' ,
415427 ' process.stdout.write("grok 1.0.13\\n");' ,
416428 " process.exit(0);" ,
@@ -426,21 +438,29 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => {
426438 } ) ;
427439 } ) ;
428440
429- it . effect ( "reports ready with ACP-discovered models when logged in " , ( ) =>
441+ it . effect ( "reports ready with ACP-discovered models without running startup updates " , ( ) =>
430442 Effect . gen ( function * ( ) {
431- const snapshot = yield * Effect . scoped (
443+ const environment = { ...process . env , XAI_API_KEY : "" , GROK_DISABLE_AUTOUPDATER : "0" } ;
444+ const { snapshot, updateRan } = yield * Effect . scoped (
432445 Effect . gen ( function * ( ) {
446+ const fs = yield * FileSystem . FileSystem ;
447+ const dir = yield * fs . makeTempDirectoryScoped ( { prefix : "t3code-grok-updater-" } ) ;
448+ const updateLogPath = NodePath . join ( dir , "updates.log" ) ;
433449 const grokPath = yield * writeFakeGrokCli ( {
434450 modelsOutput : LOGGED_IN_MODELS_OUTPUT ,
435451 acp : true ,
452+ updateLogPath,
436453 } ) ;
437- return yield * checkGrokProviderStatus (
454+ const snapshot = yield * checkGrokProviderStatus (
438455 decodeGrokSettings ( { enabled : true , binaryPath : grokPath } ) ,
439- { ... process . env , XAI_API_KEY : "" } ,
456+ environment ,
440457 ) ;
458+ return { snapshot, updateRan : yield * fs . exists ( updateLogPath ) } ;
441459 } ) ,
442460 ) ;
443461
462+ expect ( updateRan ) . toBe ( false ) ;
463+ expect ( environment . GROK_DISABLE_AUTOUPDATER ) . toBe ( "0" ) ;
444464 expect ( snapshot . status ) . toBe ( "ready" ) ;
445465 expect ( snapshot . version ) . toBe ( "1.0.13" ) ;
446466 expect ( snapshot . auth ) . toEqual ( {
0 commit comments