File tree Expand file tree Collapse file tree
packages/provider-grok/src/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -696,6 +696,41 @@ describe("XAiAcpExtension", () => {
696696 expect ( extractXAiAcpSubagentUpdate ( toolCall ) ) . toBeUndefined ( ) ;
697697 } ) ;
698698
699+ it ( "keeps the normal tool frame for a command result from a mixed-ID poll" , ( ) => {
700+ // Oracle: review 4325739061 requires the result ID to override requested subagent IDs.
701+ const toolCall : AcpToolCallState = {
702+ toolCallId : "call-mixed-poll" ,
703+ title : "get_command_or_subagent_output" ,
704+ status : "completed" ,
705+ data : {
706+ rawInput : {
707+ variant : "TaskOutput" ,
708+ task_ids : [
709+ "019f44a6-4820-7402-925d-bc862ee711dd" ,
710+ "call-7c835a60-7bf5-4284-a5c7-cf42a4212ece-29" ,
711+ ] ,
712+ } ,
713+ rawOutput : {
714+ type : "TaskOutput" ,
715+ Result : {
716+ task_id : "call-7c835a60-7bf5-4284-a5c7-cf42a4212ece-29" ,
717+ status : "completed" ,
718+ exit_code : 0 ,
719+ output : "done" ,
720+ } ,
721+ } ,
722+ } ,
723+ } ;
724+ expect ( extractXAiAcpSubagentUpdate ( toolCall ) ) . toBeUndefined ( ) ;
725+ expect ( extractXAiBackgroundTaskCompletion ( toolCall ) ) . toEqual ( [
726+ {
727+ taskId : "call-7c835a60-7bf5-4284-a5c7-cf42a4212ece-29" ,
728+ status : "completed" ,
729+ appendOutput : "done" ,
730+ } ,
731+ ] ) ;
732+ } ) ;
733+
699734 it . each ( [ "" , " " ] ) ( "ignores an empty structured task id %j" , ( taskId ) => {
700735 // An empty result is not a completion identity, even with a terminal status.
701736 expect (
Original file line number Diff line number Diff line change @@ -838,6 +838,13 @@ export function extractXAiAcpSubagentUpdate(
838838 const output = xAiToolOutputText ( toolCall ) ;
839839
840840 if ( isXAiGetSubagentOutputTool ( toolCall , rawInput ) ) {
841+ const structuredTaskId = structuredTaskIdFromGetOutputTool ( toolCall ) ;
842+ if (
843+ structuredTaskId !== undefined &&
844+ ! new RegExp ( `^${ XAI_UUID_RE } $` , "i" ) . test ( structuredTaskId )
845+ ) {
846+ return undefined ;
847+ }
841848 const taskIds = taskIdsFromGetOutputTool ( toolCall , rawInput ) ;
842849 const childSessionId =
843850 resultTaskIdFromGetOutputTool ( toolCall , output ) ??
You can’t perform that action at this time.
0 commit comments