@@ -688,11 +688,11 @@ describe("ReadFileTool", () => {
688688 parseSpy . mockRestore ( )
689689 } )
690690
691- it ( "denies batch reads for a queued message response without text" , async ( ) => {
691+ it ( "denies batch reads without feedback text" , async ( ) => {
692692 const task = Object . create ( Task . prototype ) as Task
693693 Object . defineProperty ( task , "cwd" , { value : "/test/workspace" , writable : true } )
694694 Object . assign ( task , createMockTask ( ) )
695- task . ask = vi . fn ( ) . mockResolvedValue ( { response : "messageResponse " , text : undefined , images : undefined } )
695+ task . ask = vi . fn ( ) . mockResolvedValue ( { response : "noButtonClicked " , text : undefined , images : undefined } )
696696 const fileResults = [
697697 { path : "one.ts" , status : "pending" as const , entry : { path : "one.ts" , mode : "slice" as const } } ,
698698 { path : "two.ts" , status : "pending" as const , entry : { path : "two.ts" , mode : "slice" as const } } ,
@@ -703,6 +703,33 @@ describe("ReadFileTool", () => {
703703 expect ( task . say ) . not . toHaveBeenCalledWith ( "user_feedback" , expect . anything ( ) , expect . anything ( ) )
704704 expect ( task . didRejectTool ) . toBe ( true )
705705 } )
706+
707+ it ( "applies individual decisions for a batch read" , async ( ) => {
708+ const task = Object . create ( Task . prototype ) as Task
709+ Object . defineProperty ( task , "cwd" , { value : "/test/workspace" , writable : true } )
710+ Object . assign ( task , createMockTask ( ) )
711+ task . ask = vi . fn ( ) . mockImplementation ( async ( _type , text ) => {
712+ const { batchFiles } = JSON . parse ( text ?? "{}" ) as { batchFiles : Array < { key : string } > }
713+ return {
714+ response : "objectResponse" ,
715+ text : JSON . stringify ( { [ batchFiles [ 0 ] . key ] : true , [ batchFiles [ 1 ] . key ] : false } ) ,
716+ images : undefined ,
717+ }
718+ } )
719+ const fileResults = [
720+ { path : "one.ts" , status : "pending" as const , entry : { path : "one.ts" , mode : "slice" as const } } ,
721+ { path : "two.ts" , status : "pending" as const , entry : { path : "two.ts" , mode : "slice" as const } } ,
722+ ]
723+ const updates = new Map < string , Record < string , unknown > > ( )
724+
725+ await readFileTool [ "requestApproval" ] ( task , fileResults , ( filePath , update ) => {
726+ updates . set ( filePath , update )
727+ } )
728+
729+ expect ( updates . get ( "one.ts" ) ) . toMatchObject ( { status : "approved" } )
730+ expect ( updates . get ( "two.ts" ) ) . toMatchObject ( { status : "denied" } )
731+ expect ( task . didRejectTool ) . toBe ( true )
732+ } )
706733 } )
707734
708735 describe ( "output structure" , ( ) => {
0 commit comments