@@ -1431,6 +1431,16 @@ describe("OrchestratorMcpService provider resolution", () => {
14311431 models : [ "oc/m12" , "oc/m01" , "oc/m03" , "oc/m04" , "oc/m05" , "oc/m06" , "oc/m07" , "oc/m08" ] ,
14321432 omitted : 3 ,
14331433 } ) ;
1434+ // A word naming the provider matches all its models, so legacy ones stay out.
1435+ assert . deepEqual ( listing ( yield * capabilitiesWith ( "Codex" ) ) , [
1436+ { id : codexInstanceId , models : [ "gpt-6" , "gpt-4" , "gpt-3" , "my-alpha" ] , omitted : 1 } ,
1437+ { id : opencodeInstanceId , models : [ ] , omitted : 0 } ,
1438+ ] ) ;
1439+ assert . deepEqual ( listing ( yield * capabilitiesWith ( "codex gpt 5" ) ) [ 0 ] , {
1440+ id : codexInstanceId ,
1441+ models : [ "gpt-5" ] ,
1442+ omitted : 0 ,
1443+ } ) ;
14341444 } ) ,
14351445 ) ;
14361446
@@ -2694,6 +2704,71 @@ describe("OrchestratorMcpService thread lookup", () => {
26942704 ) ;
26952705} ) ;
26962706
2707+ describe ( "OrchestratorMcpService thread list" , ( ) => {
2708+ const client : McpInvocationScope = {
2709+ environmentId : EnvironmentId . make ( "environment:thread-list" ) ,
2710+ requestNamespace : "client:thread-list" ,
2711+ thread : undefined ,
2712+ client : { sessionId : "thread-list" , label : "Claude Code" , access : "full-access" } ,
2713+ capabilities : new Set ( [ "orchestration" ] ) ,
2714+ issuedAt : 1 ,
2715+ } ;
2716+ const shell = ( id : string , projectId : string , snoozed : boolean ) => ( {
2717+ ...liveThreadShell ( ThreadId . make ( id ) ) ,
2718+ projectId : ProjectId . make ( projectId ) ,
2719+ status : "completed" as const ,
2720+ snoozedUntil : snoozed ? DateTime . makeUnsafe ( "2099-01-01T00:00:00Z" ) : null ,
2721+ } ) ;
2722+ const shells = [
2723+ shell ( "thread:a-snoozed" , "project:a" , true ) ,
2724+ shell ( "thread:a-awake" , "project:a" , false ) ,
2725+ shell ( "thread:b-snoozed" , "project:b" , true ) ,
2726+ ] ;
2727+ const service = layerOrchestratorService . pipe (
2728+ Layer . provide (
2729+ Layer . mergeAll (
2730+ NodeServices . layer ,
2731+ Layer . mock ( ThreadManagementService . ThreadManagementService ) ( {
2732+ listProjectThreads : ( input ) =>
2733+ Effect . succeed (
2734+ shells . filter (
2735+ ( thread ) => input . projectId === undefined || thread . projectId === input . projectId ,
2736+ ) ,
2737+ ) ,
2738+ } ) ,
2739+ ServerSettings . layerTest ( ) ,
2740+ Layer . mock ( ProviderRegistry . ProviderRegistry ) ( { getProviders : Effect . succeed ( [ ] ) } ) ,
2741+ Layer . mock ( ProviderAdapterRegistry . ProviderAdapterRegistryV2 ) ( {
2742+ list : ( ) => Effect . succeed ( [ ] ) ,
2743+ } ) ,
2744+ Layer . mock ( ProjectService . ProjectService ) ( { } ) ,
2745+ Layer . mock ( SecretRequests . SecretRequests ) ( { } ) ,
2746+ Layer . mock ( RemoteDelegation . RemoteDelegation ) ( { } ) ,
2747+ Layer . mock ( ScheduledTaskService . ScheduledTaskService ) ( { } ) ,
2748+ ) ,
2749+ ) ,
2750+ ) ;
2751+
2752+ it . effect ( "lists snoozed threads across every project with allProjects" , ( ) =>
2753+ Effect . gen ( function * ( ) {
2754+ const mcp = yield * OrchestratorMcpService . OrchestratorMcpService ;
2755+ const listed = yield * mcp . listThreads ( client , {
2756+ allProjects : true ,
2757+ projectId : ProjectId . make ( "project:a" ) ,
2758+ snoozed : true ,
2759+ } ) ;
2760+ assert . equal ( listed . projectId , null ) ;
2761+ assert . deepStrictEqual (
2762+ listed . threads . map ( ( thread ) => [ thread . threadId , thread . projectId ] ) ,
2763+ [
2764+ [ "thread:a-snoozed" , "project:a" ] ,
2765+ [ "thread:b-snoozed" , "project:b" ] ,
2766+ ] ,
2767+ ) ;
2768+ } ) . pipe ( Effect . provide ( service ) ) ,
2769+ ) ;
2770+ } ) ;
2771+
26972772describe ( "OrchestratorMcpService thread stop" , ( ) => {
26982773 const driver = ProviderDriverKind . make ( "codex" ) ;
26992774 const instanceId = ProviderInstanceId . make ( "codex" ) ;
0 commit comments