-
Notifications
You must be signed in to change notification settings - Fork 367
fix: add engine_counts to logs summary using aw_info.json, preventing false-positive Copilot classification #26359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "servers": { | ||
| "github-agentic-workflows": { | ||
| "command": "gh", | ||
| "args": ["aw", "mcp-server"] | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |||||||
| package cli | ||||||||
|
|
||||||||
| import ( | ||||||||
| "os" | ||||||||
| "path/filepath" | ||||||||
| "testing" | ||||||||
| "time" | ||||||||
| ) | ||||||||
|
|
@@ -908,3 +910,53 @@ func TestDeriveRunClassification(t *testing.T) { | |||||||
| }) | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| // TestBuildLogsDataEngineCountsFromAwInfo verifies that engine_counts in the summary | ||||||||
| // is populated from aw_info.json data (the authoritative engine source), not from | ||||||||
| // lock file string matching. | ||||||||
| func TestBuildLogsDataEngineCountsFromAwInfo(t *testing.T) { | ||||||||
| createRunDir := func(engineID string) string { | ||||||||
| dir := t.TempDir() | ||||||||
| awInfo := `{"engine_id":"` + engineID + `","engine_name":"Test","workflow_name":"test","created_at":"2024-01-01T00:00:00Z"}` | ||||||||
| if err := os.WriteFile(filepath.Join(dir, "aw_info.json"), []byte(awInfo), 0600); err != nil { | ||||||||
| t.Fatalf("Failed to write aw_info.json: %v", err) | ||||||||
| } | ||||||||
|
Comment on lines
+919
to
+923
|
||||||||
| return dir | ||||||||
| } | ||||||||
|
|
||||||||
| claudeDir := createRunDir("claude") | ||||||||
| claudeDir2 := createRunDir("claude") | ||||||||
| copilotDir := createRunDir("copilot") | ||||||||
|
|
||||||||
| processedRuns := []ProcessedRun{ | ||||||||
| {Run: WorkflowRun{DatabaseID: 1, WorkflowName: "wf-claude-1", LogsPath: claudeDir}}, | ||||||||
| {Run: WorkflowRun{DatabaseID: 2, WorkflowName: "wf-claude-2", LogsPath: claudeDir2}}, | ||||||||
| {Run: WorkflowRun{DatabaseID: 3, WorkflowName: "wf-copilot", LogsPath: copilotDir}}, | ||||||||
| } | ||||||||
|
|
||||||||
| data := buildLogsData(processedRuns, "/tmp/logs", nil) | ||||||||
|
||||||||
| data := buildLogsData(processedRuns, "/tmp/logs", nil) | |
| outputDir := t.TempDir() | |
| data := buildLogsData(processedRuns, outputDir, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
engineCountsis allocated unconditionally even when no runs haveaw_info.json/engine_id. This is a minor but easy-to-avoid allocation: declare it asvar engineCounts map[string]intand initialize it lazily the first time anagentIDis encountered (and keep the existinglen(engineCounts) > 0guard, sincelen(nil)is 0).