@@ -8,6 +8,7 @@ import { Anthropic } from "@anthropic-ai/sdk"
88
99import {
1010 providerIdentifiers ,
11+ RooCodeEventName ,
1112 type GlobalState ,
1213 type ProviderSettings ,
1314 type ModelInfo ,
@@ -526,6 +527,48 @@ describe("Cline", () => {
526527 const metadata = requireDefined ( createMessage . mock . calls [ 0 ] ) [ 2 ]
527528 expect ( metadata ?. mode ) . toBe ( "ask" )
528529 } )
530+
531+ it ( "only applies profile changes to the focused task" , async ( ) => {
532+ const parentConfiguration : ProviderSettings = {
533+ ...mockApiConfig ,
534+ apiModelId : "parent-model" ,
535+ rateLimitSeconds : 4 ,
536+ }
537+ const childConfiguration : ProviderSettings = {
538+ ...mockApiConfig ,
539+ apiModelId : "child-model" ,
540+ rateLimitSeconds : 8 ,
541+ }
542+ const activeConfiguration : ProviderSettings = {
543+ ...mockApiConfig ,
544+ apiModelId : "active-model" ,
545+ rateLimitSeconds : 12 ,
546+ }
547+ const parent = new Task ( {
548+ provider : mockProvider ,
549+ apiConfiguration : parentConfiguration ,
550+ taskId : "parent-task" ,
551+ task : "parent task" ,
552+ startTask : false ,
553+ } )
554+ const child = new Task ( {
555+ provider : mockProvider ,
556+ apiConfiguration : childConfiguration ,
557+ taskId : "child-task" ,
558+ task : "child task" ,
559+ startTask : false ,
560+ } )
561+ vi . spyOn ( mockProvider , "getCurrentTask" ) . mockReturnValue ( child )
562+ vi . spyOn ( mockProvider , "getState" ) . mockResolvedValue ( { apiConfiguration : activeConfiguration } )
563+
564+ mockProvider . emit ( RooCodeEventName . ProviderProfileChanged , {
565+ name : "active-profile" ,
566+ provider : activeConfiguration . apiProvider ,
567+ } )
568+
569+ await vi . waitFor ( ( ) => expect ( child . apiConfiguration ) . toEqual ( activeConfiguration ) )
570+ expect ( parent . apiConfiguration ) . toEqual ( parentConfiguration )
571+ } )
529572 } )
530573
531574 describe ( "sayAndCreateMissingParamError" , ( ) => {
0 commit comments