@@ -325,14 +325,15 @@ describe("native u64 fields advertised as number (#2316)", () => {
325325 . toBe ( '{"timeout_ms":"120000"}' ) ;
326326 } ) ;
327327
328- test ( "a field NOT on the allowlist keeps its float even when integral" , ( ) => {
329- // Deliberate scope proof: only names with a captured u64 rejection are repaired.
328+ test ( "Cursor's sibling field stays unchanged even with wait identity" , ( ) => {
329+ // Cursor uses yield_time_ms (underscore), not wait's yield-time_ms (hyphen).
330+ // Keep this explicit scope proof from #2316: field names are never broadened globally.
330331 const others = {
331332 type : "object" ,
332333 properties : { yield_time_ms : { type : "number" } , priority : { type : "number" } } ,
333334 } ;
334335 const raw = '{"yield_time_ms":60000.0,"priority":2.0}' ;
335- expect ( coerceIntegerToolArguments ( raw , others ) ) . toBe ( raw ) ;
336+ expect ( coerceIntegerToolArguments ( raw , others , "wait" ) ) . toBe ( raw ) ;
336337 } ) ;
337338
338339 test ( "the namespaced wait_agent call is repaired through the real bridge" , async ( ) => {
@@ -363,3 +364,77 @@ describe("native u64 fields advertised as number (#2316)", () => {
363364 } ) ;
364365} ) ;
365366
367+ const CODEX_DESKTOP_WAIT_SCHEMA = {
368+ type : "object" ,
369+ properties : {
370+ "yield-time_ms" : { type : "number" } ,
371+ max_tokens : { type : "number" } ,
372+ } ,
373+ } ;
374+
375+ const WAIT_SCOPE_SCHEMAS = new Map < string , Record < string , unknown > > ( [
376+ [ "wait" , CODEX_DESKTOP_WAIT_SCHEMA ] ,
377+ [ "other_tool" , CODEX_DESKTOP_WAIT_SCHEMA ] ,
378+ [ "cursor_wait" , CODEX_DESKTOP_WAIT_SCHEMA ] ,
379+ ] ) ;
380+
381+ const WAIT_SCOPE_NAMESPACE_MAP = new Map ( [
382+ [ "cursor_wait" , { namespace : "cursor" , name : "wait" } ] ,
383+ ] ) ;
384+
385+ const WAIT_SCOPE_EVENTS : AdapterEvent [ ] = [
386+ { type : "tool_call_start" , id : "call_wait" , name : "wait" } ,
387+ { type : "tool_call_delta" , arguments : '{"yield-time_ms":120000.0,"max_tokens":8000.0}' } ,
388+ { type : "tool_call_end" , id : "call_wait" } ,
389+ { type : "tool_call_start" , id : "call_fractional" , name : "wait" } ,
390+ { type : "tool_call_delta" , arguments : '{"yield-time_ms":1.5,"max_tokens":1.5}' } ,
391+ { type : "tool_call_end" , id : "call_fractional" } ,
392+ { type : "tool_call_start" , id : "call_other" , name : "other_tool" } ,
393+ { type : "tool_call_delta" , arguments : '{"yield-time_ms":120000.0,"max_tokens":8000.0}' } ,
394+ { type : "tool_call_end" , id : "call_other" } ,
395+ { type : "tool_call_start" , id : "call_namespaced" , name : "cursor_wait" } ,
396+ { type : "tool_call_delta" , arguments : '{"yield-time_ms":120000.0,"max_tokens":8000.0}' } ,
397+ { type : "tool_call_end" , id : "call_namespaced" } ,
398+ { type : "done" } ,
399+ ] ;
400+
401+ describe ( "Codex Desktop wait native integers (#2443)" , ( ) => {
402+ const expectedCalls = [
403+ { name : "wait" , namespace : undefined , arguments : '{"yield-time_ms":120000,"max_tokens":8000}' } ,
404+ { name : "wait" , namespace : undefined , arguments : '{"yield-time_ms":1.5,"max_tokens":1.5}' } ,
405+ { name : "other_tool" , namespace : undefined , arguments : '{"yield-time_ms":120000.0,"max_tokens":8000.0}' } ,
406+ { name : "wait" , namespace : "cursor" , arguments : '{"yield-time_ms":120000.0,"max_tokens":8000.0}' } ,
407+ ] ;
408+
409+ test ( "streaming bridge scopes the repair to the bare wait tool" , async ( ) => {
410+ const frames = await collectSse ( bridgeToResponsesSSE (
411+ replay ( WAIT_SCOPE_EVENTS ) ,
412+ "grok-4.6" ,
413+ WAIT_SCOPE_NAMESPACE_MAP ,
414+ undefined ,
415+ undefined ,
416+ undefined ,
417+ 2_000 ,
418+ { toolParameterSchemas : WAIT_SCOPE_SCHEMAS } ,
419+ ) ) ;
420+ const calls = frames
421+ . filter ( frame => frame . event === "response.output_item.done" )
422+ . map ( frame => frame . data . item as Record < string , unknown > )
423+ . filter ( item => item . type === "function_call" )
424+ . map ( item => ( { name : item . name , namespace : item . namespace , arguments : item . arguments } ) ) ;
425+
426+ expect ( calls ) . toEqual ( expectedCalls ) ;
427+ } ) ;
428+
429+ test ( "non-streaming bridge scopes the repair to the bare wait tool" , ( ) => {
430+ const body = buildResponseJSON ( WAIT_SCOPE_EVENTS , "grok-4.6" , {
431+ toolNsMap : WAIT_SCOPE_NAMESPACE_MAP ,
432+ toolParameterSchemas : WAIT_SCOPE_SCHEMAS ,
433+ } ) as Record < string , unknown > ;
434+ const calls = ( body . output as Record < string , unknown > [ ] )
435+ . filter ( item => item . type === "function_call" )
436+ . map ( item => ( { name : item . name , namespace : item . namespace , arguments : item . arguments } ) ) ;
437+
438+ expect ( calls ) . toEqual ( expectedCalls ) ;
439+ } ) ;
440+ } ) ;
0 commit comments