@@ -401,6 +401,7 @@ it.live.each([
401401 "unsupported" ,
402402 "preparing" ,
403403 "disabled" ,
404+ "archived" ,
404405] as const ) ( "configures the calling thread without losing work: %s" , ( scenario ) =>
405406 Effect . scoped (
406407 Effect . gen ( function * ( ) {
@@ -526,8 +527,26 @@ it.live.each([
526527 } ) ;
527528 yield * worker . drain ( ) ;
528529 }
530+ if ( scenario === "archived" ) {
531+ yield * orchestrator . dispatch ( {
532+ type : "thread.archive" ,
533+ commandId : CommandId . make ( `${ name } :archive` ) ,
534+ threadId,
535+ } ) ;
536+ }
529537 const before = yield * orchestrator . getThreadProjection ( threadId ) ;
530538 const sequence = yield * orchestrator . getThreadEventSequence ( threadId ) ;
539+ if ( scenario === "archived" ) {
540+ assert . isNotNull ( before . thread . archivedAt ) ;
541+ const run = before . runs [ 0 ] ! ;
542+ assert . equal ( run . status , "running" ) ;
543+ assert . isTrue (
544+ before . providerTurns . some (
545+ ( turn ) => turn . runAttemptId === run . activeAttemptId && turn . status === "running" ,
546+ ) ,
547+ ) ;
548+ assert . lengthOf ( starts , 1 ) ;
549+ }
531550 const configure = threads . configureModelSelection ( {
532551 projectId,
533552 threadId,
@@ -536,15 +555,22 @@ it.live.each([
536555 createdBy : "agent" ,
537556 creationSource : "mcp" ,
538557 } ) ;
539- if ( scenario === "unsupported" || scenario === "preparing" || scenario === "disabled" ) {
558+ if (
559+ scenario === "unsupported" ||
560+ scenario === "preparing" ||
561+ scenario === "disabled" ||
562+ scenario === "archived"
563+ ) {
540564 const error = yield * Effect . flip ( configure ) ;
541565 assert . equal (
542566 error . _tag ,
543- scenario === "disabled"
544- ? "ThreadManagementProviderInstanceDisabledError"
545- : scenario === "preparing"
546- ? "ThreadManagementNoSteerableRunError"
547- : "OrchestratorDispatchError" ,
567+ scenario === "archived"
568+ ? "ThreadManagementThreadArchivedError"
569+ : scenario === "disabled"
570+ ? "ThreadManagementProviderInstanceDisabledError"
571+ : scenario === "preparing"
572+ ? "ThreadManagementNoSteerableRunError"
573+ : "OrchestratorDispatchError" ,
548574 ) ;
549575 if ( scenario === "disabled" ) {
550576 assert . deepEqual ( before . runs [ 0 ] ?. modelSelection , selection ) ;
@@ -617,7 +643,7 @@ it.live.each([
617643 CommandReceiptStore . layer . pipe ( Layer . provide ( layerDatabase ) ) ,
618644 ProviderReplayHarness . layerWithRegistry ( { name } , registry , {
619645 databaseLayer : layerDatabase ,
620- runEffectWorker : scenario !== "preparing" ,
646+ runEffectWorker : scenario !== "preparing" && scenario !== "archived" ,
621647 } ) ,
622648 ) ,
623649 ) ,
0 commit comments