MCPcopy Create free account
hub / github.com/github/gh-aw / updateMostRecentToolWithDuration

Method updateMostRecentToolWithDuration

pkg/workflow/codex_logs.go:202–211  ·  view source on GitHub ↗

updateMostRecentToolWithDuration updates the tool with maximum duration Since we can't perfectly correlate duration lines with specific tool calls in Codex logs, we approximate by updating any tool that doesn't have a duration yet, or updating the max

(toolCallMap map[string]*ToolCallInfo, duration time.Duration)

Source from the content-addressed store, hash-verified

200// Since we can't perfectly correlate duration lines with specific tool calls in Codex logs,
201// we approximate by updating any tool that doesn't have a duration yet, or updating the max
202func (e *CodexEngine) updateMostRecentToolWithDuration(toolCallMap map[string]*ToolCallInfo, duration time.Duration) {
203 // Find a tool that either has no duration yet or can be updated with a larger duration
204 for _, toolInfo := range toolCallMap {
205 if toolInfo.MaxDuration == 0 || duration > toolInfo.MaxDuration {
206 toolInfo.MaxDuration = duration
207 // Only update one tool per duration line to avoid over-attribution
208 break
209 }
210 }
211}
212
213// extractOutputSizeFromResult extracts output size from success/failure result lines
214// Returns the character count of the output content if found, 0 otherwise

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected