@@ -160,6 +160,29 @@ describe('processModelResponse', () => {
160160 expect ( result . hasToolsOrApprovalsToRun ( ) ) . toBe ( true ) ;
161161 } ) ;
162162
163+ it ( 'keeps hosted shell calls pending when status is omitted' , ( ) => {
164+ const shellCall : protocol . ShellCallItem = {
165+ type : 'shell_call' ,
166+ callId : 'call_shell' ,
167+ action : { commands : [ 'echo hi' ] } ,
168+ } ;
169+ const modelResponse : ModelResponse = {
170+ output : [ shellCall ] ,
171+ usage : new Usage ( ) ,
172+ } ;
173+
174+ const shell = shellTool ( {
175+ environment : { type : 'container_auto' } ,
176+ } ) ;
177+ const result = processModelResponse ( modelResponse , TEST_AGENT , [ shell ] , [ ] ) ;
178+
179+ expect ( result . newItems ) . toHaveLength ( 1 ) ;
180+ expect ( result . newItems [ 0 ] ) . toBeInstanceOf ( ToolCallItem ) ;
181+ expect ( result . shellActions ) . toHaveLength ( 0 ) ;
182+ expect ( result . toolsUsed ) . toEqual ( [ 'shell' ] ) ;
183+ expect ( result . hasToolsOrApprovalsToRun ( ) ) . toBe ( true ) ;
184+ } ) ;
185+
163186 it ( 'does not keep hosted shell calls pending when incomplete' , ( ) => {
164187 const shellCall : protocol . ShellCallItem = {
165188 type : 'shell_call' ,
@@ -184,6 +207,30 @@ describe('processModelResponse', () => {
184207 expect ( result . hasToolsOrApprovalsToRun ( ) ) . toBe ( false ) ;
185208 } ) ;
186209
210+ it ( 'does not keep hosted shell calls pending on unknown status values' , ( ) => {
211+ const shellCall : protocol . ShellCallItem = {
212+ type : 'shell_call' ,
213+ callId : 'call_shell' ,
214+ status : 'queued' as any ,
215+ action : { commands : [ 'echo hi' ] } ,
216+ } ;
217+ const modelResponse : ModelResponse = {
218+ output : [ shellCall ] ,
219+ usage : new Usage ( ) ,
220+ } ;
221+
222+ const shell = shellTool ( {
223+ environment : { type : 'container_auto' } ,
224+ } ) ;
225+ const result = processModelResponse ( modelResponse , TEST_AGENT , [ shell ] , [ ] ) ;
226+
227+ expect ( result . newItems ) . toHaveLength ( 1 ) ;
228+ expect ( result . newItems [ 0 ] ) . toBeInstanceOf ( ToolCallItem ) ;
229+ expect ( result . shellActions ) . toHaveLength ( 0 ) ;
230+ expect ( result . toolsUsed ) . toEqual ( [ 'shell' ] ) ;
231+ expect ( result . hasToolsOrApprovalsToRun ( ) ) . toBe ( false ) ;
232+ } ) ;
233+
187234 it ( 'preserves hosted shell output items in processed run items' , ( ) => {
188235 const shellOutput : protocol . ShellCallResultItem = {
189236 type : 'shell_call_output' ,
@@ -239,6 +286,35 @@ describe('processModelResponse', () => {
239286 expect ( result . hasToolsOrApprovalsToRun ( ) ) . toBe ( true ) ;
240287 } ) ;
241288
289+ it ( 'does not keep hosted shell pending on unknown shell_call_output status values' , ( ) => {
290+ const shellOutput : protocol . ShellCallResultItem = {
291+ type : 'shell_call_output' ,
292+ callId : 'call_shell' ,
293+ output : [
294+ {
295+ stdout : 'partial' ,
296+ stderr : '' ,
297+ outcome : { type : 'exit' , exitCode : 0 } ,
298+ } ,
299+ ] ,
300+ providerData : {
301+ status : 'queued' ,
302+ } ,
303+ } ;
304+ const modelResponse : ModelResponse = {
305+ output : [ shellOutput ] ,
306+ usage : new Usage ( ) ,
307+ } ;
308+
309+ const result = processModelResponse ( modelResponse , TEST_AGENT , [ ] , [ ] ) ;
310+
311+ expect ( result . newItems ) . toHaveLength ( 1 ) ;
312+ expect ( result . newItems [ 0 ] ) . toBeInstanceOf ( ToolCallOutputItem ) ;
313+ expect ( result . newItems [ 0 ] . rawItem ) . toEqual ( shellOutput ) ;
314+ expect ( result . toolsUsed ) . toEqual ( [ ] ) ;
315+ expect ( result . hasToolsOrApprovalsToRun ( ) ) . toBe ( false ) ;
316+ } ) ;
317+
242318 it ( 'throws when shell action emitted without shell tool' , ( ) => {
243319 const shellCall : protocol . ShellCallItem = {
244320 type : 'shell_call' ,
0 commit comments