@@ -50,6 +50,58 @@ func removeClaudeReportTaskToolCall(msg string) (string, []string) {
5050 return strings .TrimLeft (strings .Join (lines , "\n " ), "\n " ), toolCallMessages
5151}
5252
53+ func removeCodexReportTaskToolCall (msg string ) (string , []string ) {
54+ lines := strings .Split (msg , "\n " )
55+
56+ toolCallStartIdx := - 1
57+
58+ // Store all tool call start and end indices [[start, end], ...]
59+ var toolCallIdxs [][]int
60+
61+ for idx := 0 ; idx < len (lines ); idx ++ {
62+ line := strings .TrimSpace (lines [idx ])
63+
64+ // Check for tool call start (requires looking at next line)
65+ if idx + 1 < len (lines ) {
66+ nextLine := strings .TrimSpace (lines [idx + 1 ])
67+ if strings .Replace (line , " " , "" , - 1 ) == "•Called" && strings .Contains (nextLine , "Coder.coder_report_task" ) {
68+ toolCallStartIdx = idx
69+ }
70+ }
71+
72+ // Check for tool call end
73+ if toolCallStartIdx != - 1 && line == "{\" message\" : \" Thanks for reporting!\" }" {
74+ // Find the end of trailing empty lines after tool call
75+ endIdx := idx + 1
76+ for endIdx < len (lines ) && strings .TrimSpace (lines [endIdx ]) == "" {
77+ endIdx ++
78+ }
79+ toolCallIdxs = append (toolCallIdxs , []int {toolCallStartIdx , endIdx })
80+
81+ // Reset to find the next tool call
82+ toolCallStartIdx = - 1
83+ }
84+ }
85+
86+ // If no tool calls found, return original message
87+ if len (toolCallIdxs ) == 0 {
88+ return strings .TrimRight (msg , "\n " ), []string {}
89+ }
90+
91+ toolCallMessages := make ([]string , 0 )
92+
93+ // Remove tool calls from the message
94+ for i := len (toolCallIdxs ) - 1 ; i >= 0 ; i -- {
95+ idxPair := toolCallIdxs [i ]
96+ start , end := idxPair [0 ], idxPair [1 ]
97+
98+ toolCallMessages = append (toolCallMessages , strings .Join (lines [start :end ], "\n " ))
99+
100+ lines = append (lines [:start ], lines [end :]... )
101+ }
102+ return strings .TrimRight (strings .Join (lines , "\n " ), "\n " ), toolCallMessages
103+ }
104+
53105func FormatToolCall (agentType AgentType , message string ) (string , []string ) {
54106 switch agentType {
55107 case AgentTypeClaude :
@@ -59,7 +111,7 @@ func FormatToolCall(agentType AgentType, message string) (string, []string) {
59111 case AgentTypeAider :
60112 return message , []string {}
61113 case AgentTypeCodex :
62- return message , [] string {}
114+ return removeCodexReportTaskToolCall ( message )
63115 case AgentTypeGemini :
64116 return message , []string {}
65117 case AgentTypeCopilot :
0 commit comments