@@ -12,69 +12,69 @@ import (
1212 "github.com/github/gh-aw/pkg/workflow"
1313)
1414
15- var copilotAgentLog = logger .New ("cli:copilot_agent" )
15+ var copilotCodingAgentLog = logger .New ("cli:copilot_agent" )
1616
17- // CopilotAgentDetector contains heuristics to detect if a workflow run was executed by GitHub Copilot coding agent
18- type CopilotAgentDetector struct {
17+ // CopilotCodingAgentDetector contains heuristics to detect if a workflow run was executed by GitHub Copilot coding agent
18+ type CopilotCodingAgentDetector struct {
1919 runDir string
2020 verbose bool
2121 workflowPath string // Optional: workflow file path from GitHub API (e.g., .github/workflows/copilot-swe-agent.yml)
2222}
2323
24- // NewCopilotAgentDetector creates a new detector for GitHub Copilot coding agent runs
25- func NewCopilotAgentDetector (runDir string , verbose bool ) * CopilotAgentDetector {
26- return & CopilotAgentDetector {
24+ // NewCopilotCodingAgentDetector creates a new detector for GitHub Copilot coding agent runs
25+ func NewCopilotCodingAgentDetector (runDir string , verbose bool ) * CopilotCodingAgentDetector {
26+ return & CopilotCodingAgentDetector {
2727 runDir : runDir ,
2828 verbose : verbose ,
2929 }
3030}
3131
32- // NewCopilotAgentDetectorWithPath creates a detector with workflow path hint
33- func NewCopilotAgentDetectorWithPath (runDir string , verbose bool , workflowPath string ) * CopilotAgentDetector {
34- return & CopilotAgentDetector {
32+ // NewCopilotCodingAgentDetectorWithPath creates a detector with workflow path hint
33+ func NewCopilotCodingAgentDetectorWithPath (runDir string , verbose bool , workflowPath string ) * CopilotCodingAgentDetector {
34+ return & CopilotCodingAgentDetector {
3535 runDir : runDir ,
3636 verbose : verbose ,
3737 workflowPath : workflowPath ,
3838 }
3939}
4040
41- // IsGitHubCopilotAgent uses heuristics to determine if this run was executed by GitHub Copilot coding agent
41+ // IsGitHubCopilotCodingAgent uses heuristics to determine if this run was executed by GitHub Copilot coding agent
4242// (not the Copilot CLI engine or agentic workflows)
43- func (d * CopilotAgentDetector ) IsGitHubCopilotAgent () bool {
44- copilotAgentLog .Printf ("Detecting if run is GitHub Copilot coding agent: %s" , d .runDir )
43+ func (d * CopilotCodingAgentDetector ) IsGitHubCopilotCodingAgent () bool {
44+ copilotCodingAgentLog .Printf ("Detecting if run is GitHub Copilot coding agent: %s" , d .runDir )
4545
4646 // If aw_info.json exists, this is an agentic workflow, NOT a GitHub Copilot coding agent run
4747 awInfoPath := filepath .Join (d .runDir , "aw_info.json" )
4848 if _ , err := os .Stat (awInfoPath ); err == nil {
49- copilotAgentLog .Print ("Found aw_info.json - this is an agentic workflow, not a GitHub Copilot coding agent" )
49+ copilotCodingAgentLog .Print ("Found aw_info.json - this is an agentic workflow, not a GitHub Copilot coding agent" )
5050 return false
5151 }
5252
5353 // Heuristic 1: Check workflow path if provided (most reliable hint from GitHub API)
5454 if d .hasAgentWorkflowPath () {
55- copilotAgentLog .Print ("Detected copilot-swe-agent in workflow path" )
55+ copilotCodingAgentLog .Print ("Detected copilot-swe-agent in workflow path" )
5656 return true
5757 }
5858
5959 // Heuristic 2: Check for agent-specific log patterns
6060 if d .hasAgentLogPatterns () {
61- copilotAgentLog .Print ("Detected agent log patterns" )
61+ copilotCodingAgentLog .Print ("Detected agent log patterns" )
6262 return true
6363 }
6464
6565 // Heuristic 3: Check for agent-specific artifacts
6666 if d .hasAgentArtifacts () {
67- copilotAgentLog .Print ("Detected agent artifacts" )
67+ copilotCodingAgentLog .Print ("Detected agent artifacts" )
6868 return true
6969 }
7070
71- copilotAgentLog .Print ("No GitHub Copilot coding agent indicators found" )
71+ copilotCodingAgentLog .Print ("No GitHub Copilot coding agent indicators found" )
7272 return false
7373}
7474
7575// hasAgentWorkflowPath checks if the workflow path indicates a Copilot coding agent run
7676// The workflow ID is always "copilot-swe-agent" for GitHub Copilot coding agent runs
77- func (d * CopilotAgentDetector ) hasAgentWorkflowPath () bool {
77+ func (d * CopilotCodingAgentDetector ) hasAgentWorkflowPath () bool {
7878 if d .workflowPath == "" {
7979 return false
8080 }
@@ -97,7 +97,7 @@ func (d *CopilotAgentDetector) hasAgentWorkflowPath() bool {
9797}
9898
9999// hasAgentLogPatterns checks log files for patterns specific to GitHub Copilot coding agent
100- func (d * CopilotAgentDetector ) hasAgentLogPatterns () bool {
100+ func (d * CopilotCodingAgentDetector ) hasAgentLogPatterns () bool {
101101 // Patterns that indicate GitHub Copilot coding agent (not Copilot CLI)
102102 agentPatterns := []* regexp.Regexp {
103103 regexp .MustCompile (`(?i)github.*copilot.*agent` ),
@@ -141,7 +141,7 @@ func (d *CopilotAgentDetector) hasAgentLogPatterns() bool {
141141}
142142
143143// hasAgentArtifacts checks for artifacts specific to GitHub Copilot coding agent runs
144- func (d * CopilotAgentDetector ) hasAgentArtifacts () bool {
144+ func (d * CopilotCodingAgentDetector ) hasAgentArtifacts () bool {
145145 // Check for agent-specific artifact patterns
146146 agentArtifacts := []string {
147147 "copilot-agent-output" ,
@@ -180,10 +180,10 @@ func readLogHeader(path string, maxBytes int) (string, error) {
180180 return string (buffer [:n ]), nil
181181}
182182
183- // ParseCopilotAgentLogMetrics extracts metrics from GitHub Copilot coding agent logs
183+ // ParseCopilotCodingAgentLogMetrics extracts metrics from GitHub Copilot coding agent logs
184184// This is different from Copilot CLI logs and requires specialized parsing
185- func ParseCopilotAgentLogMetrics (logContent string , verbose bool ) workflow.LogMetrics {
186- copilotAgentLog .Printf ("Parsing GitHub Copilot coding agent log metrics: %d bytes" , len (logContent ))
185+ func ParseCopilotCodingAgentLogMetrics (logContent string , verbose bool ) workflow.LogMetrics {
186+ copilotCodingAgentLog .Printf ("Parsing GitHub Copilot coding agent log metrics: %d bytes" , len (logContent ))
187187
188188 var metrics workflow.LogMetrics
189189 var maxTokenUsage int
@@ -231,7 +231,7 @@ func ParseCopilotAgentLogMetrics(logContent string, verbose bool) workflow.LogMe
231231 currentSequence = append (currentSequence , toolName )
232232
233233 if verbose {
234- copilotAgentLog .Printf ("Found tool call: %s" , toolName )
234+ copilotCodingAgentLog .Printf ("Found tool call: %s" , toolName )
235235 }
236236 }
237237 }
@@ -261,7 +261,7 @@ func ParseCopilotAgentLogMetrics(logContent string, verbose bool) workflow.LogMe
261261 metrics .TokenUsage = maxTokenUsage
262262 metrics .Turns = turns
263263
264- copilotAgentLog .Printf ("Parsed metrics: tokens=%d, cost=$%.4f, turns=%d" ,
264+ copilotCodingAgentLog .Printf ("Parsed metrics: tokens=%d, cost=$%.4f, turns=%d" ,
265265 metrics .TokenUsage , metrics .EstimatedCost , metrics .Turns )
266266
267267 return metrics
0 commit comments