@@ -7833,109 +7833,113 @@ describe("ClaudeAdapterV2 background wake turns", () => {
78337833 ) ;
78347834
78357835 it . effect . each ( [
7836- { requested : undefined , expected : "max" } ,
7837- { requested : "low" , expected : "low" } ,
7838- ] ) ( "records the effort a subagent runs at (Agent effort $requested)" , ( { requested, expected } ) =>
7839- Effect . scoped (
7840- Effect . gen ( function * ( ) {
7841- const harness = yield * makeWakeHarness ;
7842- const now = yield * DateTime . now ;
7843- const toolUseId = "toolu-subagent-effort" ;
7844- const parentSelection = {
7845- instanceId : CLAUDE_TEST_MODEL_SELECTION . instanceId ,
7846- model : "claude-opus-4-6" ,
7847- options : [
7848- { id : "effort" , value : "max" } ,
7849- { id : "fastMode" , value : false } ,
7850- ] ,
7851- } satisfies ModelSelection ;
7852- yield * harness . runtime . startTurn (
7853- makeClaudeTestTurnInput ( {
7854- threadId : harness . threadId ,
7855- providerThread : harness . providerThread ,
7856- now,
7857- attemptId : RunAttemptId . make ( "attempt-subagent-effort" ) ,
7858- text : "Spawn a subagent." ,
7859- attachments : [ ] ,
7860- modelSelection : parentSelection ,
7861- } ) ,
7862- ) ;
7863- for ( const frame of [
7864- claudeSdkFrame ( {
7865- type : "assistant" ,
7866- parent_tool_use_id : null ,
7867- message : {
7868- model : parentSelection . model ,
7869- id : "msg_subagent_effort_launch" ,
7870- type : "message" ,
7871- role : "assistant" ,
7872- content : [
7873- {
7874- type : "tool_use" ,
7875- id : toolUseId ,
7876- name : "Agent" ,
7877- input : {
7878- description : "Research" ,
7879- subagent_type : "general-purpose" ,
7880- model : "opus" ,
7881- ...( requested === undefined ? { } : { effort : requested } ) ,
7882- prompt : "Research the topic." ,
7836+ { agentModel : "opus" , slug : "claude-opus-5-5" , requested : undefined , expected : "max" } ,
7837+ { agentModel : "opus" , slug : "claude-opus-5-5" , requested : "low" , expected : "low" } ,
7838+ // claude-haiku-4-5 offers no effort, so none is sent or shown for it.
7839+ { agentModel : "haiku-4.5" , slug : "claude-haiku-4-5" , requested : undefined , expected : null } ,
7840+ ] ) (
7841+ "records the effort a $agentModel subagent runs at (Agent effort $requested)" ,
7842+ ( { agentModel, slug, requested, expected } ) =>
7843+ Effect . scoped (
7844+ Effect . gen ( function * ( ) {
7845+ const harness = yield * makeWakeHarness ;
7846+ const now = yield * DateTime . now ;
7847+ const toolUseId = "toolu-subagent-effort" ;
7848+ const parentSelection = {
7849+ instanceId : CLAUDE_TEST_MODEL_SELECTION . instanceId ,
7850+ model : "claude-opus-4-6" ,
7851+ options : [
7852+ { id : "effort" , value : "max" } ,
7853+ { id : "fastMode" , value : false } ,
7854+ ] ,
7855+ } satisfies ModelSelection ;
7856+ yield * harness . runtime . startTurn (
7857+ makeClaudeTestTurnInput ( {
7858+ threadId : harness . threadId ,
7859+ providerThread : harness . providerThread ,
7860+ now,
7861+ attemptId : RunAttemptId . make ( "attempt-subagent-effort" ) ,
7862+ text : "Spawn a subagent." ,
7863+ attachments : [ ] ,
7864+ modelSelection : parentSelection ,
7865+ } ) ,
7866+ ) ;
7867+ for ( const frame of [
7868+ claudeSdkFrame ( {
7869+ type : "assistant" ,
7870+ parent_tool_use_id : null ,
7871+ message : {
7872+ model : parentSelection . model ,
7873+ id : "msg_subagent_effort_launch" ,
7874+ type : "message" ,
7875+ role : "assistant" ,
7876+ content : [
7877+ {
7878+ type : "tool_use" ,
7879+ id : toolUseId ,
7880+ name : "Agent" ,
7881+ input : {
7882+ description : "Research" ,
7883+ subagent_type : "general-purpose" ,
7884+ model : agentModel ,
7885+ ...( requested === undefined ? { } : { effort : requested } ) ,
7886+ prompt : "Research the topic." ,
7887+ } ,
78837888 } ,
7884- } ,
7885- ] ,
7886- } ,
7887- uuid : "00000000-0000-4000-8000-000000000211" ,
7888- session_id : WAKE_NATIVE_SESSION ,
7889- } ) ,
7890- claudeSdkFrame ( {
7891- type : "system" ,
7892- subtype : "task_started" ,
7893- task_id : "task-subagent-effort" ,
7894- tool_use_id : toolUseId ,
7895- description : "Research" ,
7896- task_type : "local_agent" ,
7897- uuid : "00000000-0000-4000-8000-000000000212" ,
7898- session_id : WAKE_NATIVE_SESSION ,
7899- } ) ,
7900- // The reply names the model the alias resolved to.
7901- claudeSdkFrame ( {
7902- type : "assistant" ,
7903- parent_tool_use_id : toolUseId ,
7904- message : {
7905- model : "claude-opus-5-5" ,
7906- id : "msg_subagent_effort_observed" ,
7907- type : "message" ,
7908- role : "assistant" ,
7909- content : [ { type : "text" , text : "Researching." } ] ,
7910- } ,
7911- uuid : "00000000-0000-4000-8000-000000000213" ,
7912- session_id : WAKE_NATIVE_SESSION ,
7913- } ) ,
7914- makeResultFrame ( {
7915- uuid : "00000000-0000-4000-8000-000000000214" ,
7916- result : "Spawned the subagent." ,
7917- } ) ,
7918- ] ) {
7919- yield * Queue . offer ( harness . sdkMessages , frame ) ;
7920- }
7921- yield * Queue . take ( harness . terminalReceipts ) ;
7889+ ] ,
7890+ } ,
7891+ uuid : "00000000-0000-4000-8000-000000000211" ,
7892+ session_id : WAKE_NATIVE_SESSION ,
7893+ } ) ,
7894+ claudeSdkFrame ( {
7895+ type : "system" ,
7896+ subtype : "task_started" ,
7897+ task_id : "task-subagent-effort" ,
7898+ tool_use_id : toolUseId ,
7899+ description : "Research" ,
7900+ task_type : "local_agent" ,
7901+ uuid : "00000000-0000-4000-8000-000000000212" ,
7902+ session_id : WAKE_NATIVE_SESSION ,
7903+ } ) ,
7904+ // The reply names the model the alias resolved to.
7905+ claudeSdkFrame ( {
7906+ type : "assistant" ,
7907+ parent_tool_use_id : toolUseId ,
7908+ message : {
7909+ model : slug ,
7910+ id : "msg_subagent_effort_observed" ,
7911+ type : "message" ,
7912+ role : "assistant" ,
7913+ content : [ { type : "text" , text : "Researching." } ] ,
7914+ } ,
7915+ uuid : "00000000-0000-4000-8000-000000000213" ,
7916+ session_id : WAKE_NATIVE_SESSION ,
7917+ } ) ,
7918+ makeResultFrame ( {
7919+ uuid : "00000000-0000-4000-8000-000000000214" ,
7920+ result : "Spawned the subagent." ,
7921+ } ) ,
7922+ ] ) {
7923+ yield * Queue . offer ( harness . sdkMessages , frame ) ;
7924+ }
7925+ yield * Queue . take ( harness . terminalReceipts ) ;
79227926
7923- // The alias is stored as its slug, so the reply is no model change,
7924- // and the parent's fast mode stays with the parent.
7925- const subagentSelection = {
7926- instanceId : parentSelection . instanceId ,
7927- model : "claude-opus-5-5" ,
7928- options : [ { id : "effort" , value : expected } ] ,
7929- } ;
7930- const child = harness . events . find ( ( event ) => event . type === "app_thread.created" ) ;
7931- assert . deepEqual ( child ?. appThread . modelSelection , subagentSelection ) ;
7932- const subagents = harness . events . filter ( ( event ) => event . type === "subagent.updated" ) ;
7933- assert . deepEqual (
7934- subagents . map ( ( event ) => event . subagent . modelSelection ) ,
7935- subagents . map ( ( ) => subagentSelection ) ,
7936- ) ;
7937- } ) . pipe ( Effect . provide ( Layer . merge ( IdAllocator . layer , NodeServices . layer ) ) ) ,
7938- ) ,
7927+ // The alias is stored as its slug, so the reply is no model change,
7928+ // and the parent's fast mode stays with the parent.
7929+ const subagentSelection = {
7930+ instanceId : parentSelection . instanceId ,
7931+ model : slug ,
7932+ ... ( expected === null ? { } : { options : [ { id : "effort" , value : expected } ] } ) ,
7933+ } ;
7934+ const child = harness . events . find ( ( event ) => event . type === "app_thread.created" ) ;
7935+ assert . deepEqual ( child ?. appThread . modelSelection , subagentSelection ) ;
7936+ const subagents = harness . events . filter ( ( event ) => event . type === "subagent.updated" ) ;
7937+ assert . deepEqual (
7938+ subagents . map ( ( event ) => event . subagent . modelSelection ) ,
7939+ subagents . map ( ( ) => subagentSelection ) ,
7940+ ) ;
7941+ } ) . pipe ( Effect . provide ( Layer . merge ( IdAllocator . layer , NodeServices . layer ) ) ) ,
7942+ ) ,
79397943 ) ;
79407944
79417945 it . effect ( "gives a nested subagent its own effort, else the one its owner runs at" , ( ) =>
0 commit comments