File tree Expand file tree Collapse file tree
src/github/copilotRemoteAgent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -335,11 +335,12 @@ export class ChatSessionContentBuilder {
335335 // Skip if content is empty (running state)
336336 } else {
337337 if ( delta . content ) {
338- if ( ! delta . content . startsWith ( '<pr_title>' ) ) {
338+ if ( ! delta . content . startsWith ( '<pr_title>' ) && ! delta . content . startsWith ( '<error>' ) ) {
339339 currentResponseContent += delta . content ;
340340 }
341341 }
342342
343+ const isError = delta . content ?. startsWith ( '<error>' ) ;
343344 if ( delta . tool_calls ) {
344345 // Add any accumulated content as markdown first
345346 if ( currentResponseContent . trim ( ) ) {
@@ -353,6 +354,15 @@ export class ChatSessionContentBuilder {
353354 responseParts . push ( toolPart ) ;
354355 }
355356 }
357+
358+ if ( isError ) {
359+ const toolPart = new vscode . ChatToolInvocationPart ( 'Command' , 'command' ) ;
360+ // Remove <error> at the start and </error> at the end
361+ const cleaned = ( delta . content ?? '' ) . replace ( / ^ \s * < e r r o r > \s * / i, '' ) . replace ( / \s * < \/ e r r o r > \s * $ / i, '' ) ;
362+ toolPart . invocationMessage = cleaned ;
363+ toolPart . isError = true ;
364+ responseParts . push ( toolPart ) ;
365+ }
356366 }
357367 }
358368 }
You can’t perform that action at this time.
0 commit comments