@@ -383,6 +383,86 @@ it.layer(layerTest)("CodexDriver", (it) => {
383383 ) ,
384384 ) ;
385385
386+ for ( const fixture of [
387+ { name : "a native release behind npm" , tag : "rust-v0.163.0" , status : 200 , expected : "0.163.0" } ,
388+ { name : "an unavailable native channel" , tag : "rust-v0.163.0" , status : 503 , expected : null } ,
389+ { name : "malformed native metadata" , tag : "not-a-version" , status : 200 , expected : null } ,
390+ { name : "a newer native release" , tag : "rust-v0.164.0" , status : 200 , expected : "0.164.0" } ,
391+ {
392+ name : "an explicit release" ,
393+ tag : "rust-v0.164.0" ,
394+ status : 200 ,
395+ expected : null ,
396+ env : { CODEX_RELEASE : "0.162.0" } ,
397+ } ,
398+ {
399+ name : "an alternative installer channel" ,
400+ tag : "rust-v0.164.0" ,
401+ status : 200 ,
402+ expected : null ,
403+ env : { CODEX_INSTALLER_USE_RELEASES_OPENAI_COM : "false" } ,
404+ } ,
405+ ] ) {
406+ it . effect . skipIf ( windowsHost ) ( `checks the standalone channel for ${ fixture . name } ` , ( ) =>
407+ Effect . gen ( function * ( ) {
408+ const fs = yield * FileSystem . FileSystem ;
409+ const home = yield * fs
410+ . makeTempDirectoryScoped ( { prefix : "t3-codex-native-channel-" } )
411+ . pipe ( Effect . flatMap ( ( directory ) => fs . realPath ( directory ) ) ) ;
412+ const binaryPath = NodePath . join ( home , "packages" , "standalone" , "bin" , "codex" ) ;
413+ yield * fs . makeDirectory ( NodePath . dirname ( binaryPath ) , { recursive : true } ) ;
414+ yield * fs . writeFileString ( binaryPath , "#!/bin/sh\n" ) ;
415+ yield * fs . chmod ( binaryPath , 0o755 ) ;
416+ const requests : string [ ] = [ ] ;
417+ const http = HttpClient . make ( ( request ) =>
418+ Effect . sync ( ( ) => {
419+ requests . push ( request . url ) ;
420+ return HttpClientResponse . fromWeb (
421+ request ,
422+ request . url . includes ( "registry.npmjs.org" )
423+ ? Response . json ( { version : "0.164.0" } )
424+ : Response . json ( { tag_name : fixture . tag } , { status : fixture . status } ) ,
425+ ) ;
426+ } ) ,
427+ ) ;
428+ const instance = yield * CodexDriver . create ( {
429+ instanceId : ProviderInstanceId . make ( "codex-native-channel" ) ,
430+ displayName : "Codex channel test" ,
431+ enabled : false ,
432+ environment : [ ] ,
433+ config : { ...CodexDriver . defaultConfig ( ) , binaryPath, homePath : home } ,
434+ } ) . pipe ( Effect . provideService ( HttpClient . HttpClient , http ) ) ;
435+ const capabilities = yield * instance . snapshot . resolveMaintenance ( ) ;
436+ expect ( requests ) . toEqual ( [ ] ) ;
437+ const latest = yield * resolveLatestProviderVersion ( capabilities ) . pipe (
438+ Effect . provideService ( HttpClient . HttpClient , http ) ,
439+ ) ;
440+ expect ( latest ) . toBe ( fixture . expected ) ;
441+ expect ( requests ) . toEqual (
442+ fixture . env ? [ ] : [ "https://releases.openai.com/codex/channels/latest" ] ,
443+ ) ;
444+ expect (
445+ createProviderVersionAdvisory ( {
446+ driver : CodexDriver . driverKind ,
447+ currentVersion : "0.163.0" ,
448+ latestVersion : latest ,
449+ maintenanceCapabilities : capabilities ,
450+ } ) ?. status ,
451+ ) . toBe (
452+ fixture . expected === null
453+ ? "unknown"
454+ : fixture . expected === "0.163.0"
455+ ? "current"
456+ : "behind_latest" ,
457+ ) ;
458+ } ) . pipe (
459+ Effect . provideService ( ChildProcessSpawner . ChildProcessSpawner , noSpawn ) ,
460+ Effect . provideService ( HostProcess . Environment , fixture . env ?? { } ) ,
461+ Effect . scoped ,
462+ ) ,
463+ ) ;
464+ }
465+
386466 for ( const fixture of [
387467 {
388468 name : "leaves mise npm-backend installations manual-only" ,
0 commit comments