Skip to content

Commit 214e6dd

Browse files
committed
don't format beads
1 parent 8d546c0 commit 214e6dd

File tree

3 files changed

+64
-61
lines changed

3 files changed

+64
-61
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ build/
1515

1616
# DevContainer configuration (should not be reformatted)
1717
.devcontainer/devcontainer.json
18+
19+
.beads/
20+
.github/aw/

pkg/cli/copilot_token_extraction_test.go

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -169,46 +169,46 @@ func TestCopilotTokenExtractionWithNoUsageData(t *testing.T) {
169169
// TestCopilotTokenExtractionWithRealLogData tests token extraction with actual log data
170170
// from workflow run 20696085597 (Smoke Copilot test)
171171
func TestCopilotTokenExtractionWithRealLogData(t *testing.T) {
172-
// This test validates real log data if available
173-
realLogPath := "/tmp/run-20696085597/sandbox/agent/logs/session-dd1eedf4-2b6d-4373-942c-1447d5a6e00a.log"
172+
// This test validates real log data if available
173+
realLogPath := "/tmp/run-20696085597/sandbox/agent/logs/session-dd1eedf4-2b6d-4373-942c-1447d5a6e00a.log"
174174

175-
// Skip if real log is not available
176-
if _, err := os.Stat(realLogPath); os.IsNotExist(err) {
177-
t.Skip("Real log file from run 20696085597 not available")
178-
}
175+
// Skip if real log is not available
176+
if _, err := os.Stat(realLogPath); os.IsNotExist(err) {
177+
t.Skip("Real log file from run 20696085597 not available")
178+
}
179179

180-
tempDir := t.TempDir()
180+
tempDir := t.TempDir()
181181

182-
// Create aw_info.json with copilot engine
183-
awInfoContent := `{"engine_id": "copilot"}`
184-
awInfoPath := filepath.Join(tempDir, "aw_info.json")
185-
err := os.WriteFile(awInfoPath, []byte(awInfoContent), 0644)
186-
require.NoError(t, err)
182+
// Create aw_info.json with copilot engine
183+
awInfoContent := `{"engine_id": "copilot"}`
184+
awInfoPath := filepath.Join(tempDir, "aw_info.json")
185+
err := os.WriteFile(awInfoPath, []byte(awInfoContent), 0644)
186+
require.NoError(t, err)
187187

188-
// Copy real log to temp directory structure
189-
logDir := filepath.Join(tempDir, "sandbox", "agent", "logs")
190-
err = os.MkdirAll(logDir, 0755)
191-
require.NoError(t, err)
188+
// Copy real log to temp directory structure
189+
logDir := filepath.Join(tempDir, "sandbox", "agent", "logs")
190+
err = os.MkdirAll(logDir, 0755)
191+
require.NoError(t, err)
192192

193-
realLogContent, err := os.ReadFile(realLogPath)
194-
require.NoError(t, err)
193+
realLogContent, err := os.ReadFile(realLogPath)
194+
require.NoError(t, err)
195195

196-
logPath := filepath.Join(logDir, "session-test.log")
197-
err = os.WriteFile(logPath, realLogContent, 0644)
198-
require.NoError(t, err)
196+
logPath := filepath.Join(logDir, "session-test.log")
197+
err = os.WriteFile(logPath, realLogContent, 0644)
198+
require.NoError(t, err)
199199

200-
// Extract metrics
201-
metrics, err := extractLogMetrics(tempDir, false)
202-
require.NoError(t, err, "extractLogMetrics should succeed with real log data")
200+
// Extract metrics
201+
metrics, err := extractLogMetrics(tempDir, false)
202+
require.NoError(t, err, "extractLogMetrics should succeed with real log data")
203203

204-
// Verify token extraction from real log
205-
// The real log from run 20696085597 contains approximately 530k tokens
206-
// (528.7k input + 1.9k output based on the summary in agent-stdio.log)
207-
assert.Greater(t, metrics.TokenUsage, 500000,
208-
"Should extract at least 500k tokens from real Smoke Copilot log")
204+
// Verify token extraction from real log
205+
// The real log from run 20696085597 contains approximately 530k tokens
206+
// (528.7k input + 1.9k output based on the summary in agent-stdio.log)
207+
assert.Greater(t, metrics.TokenUsage, 500000,
208+
"Should extract at least 500k tokens from real Smoke Copilot log")
209209

210-
assert.Less(t, metrics.TokenUsage, 600000,
211-
"Should extract less than 600k tokens (reasonable upper bound)")
210+
assert.Less(t, metrics.TokenUsage, 600000,
211+
"Should extract less than 600k tokens (reasonable upper bound)")
212212

213-
t.Logf("Successfully extracted %d tokens from real workflow run 20696085597", metrics.TokenUsage)
213+
t.Logf("Successfully extracted %d tokens from real workflow run 20696085597", metrics.TokenUsage)
214214
}

pkg/cli/logs_report.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,17 @@ func buildLogsData(processedRuns []ProcessedRun, outputDir string, continuation
242242
// Filters out single words, common words, and other garbage that shouldn't be tools
243243
func isValidToolName(toolName string) bool {
244244
name := strings.TrimSpace(toolName)
245-
245+
246246
// Filter out empty names
247247
if name == "" || name == "-" {
248248
return false
249249
}
250-
250+
251251
// Filter out single character names
252252
if len(name) == 1 {
253253
return false
254254
}
255-
255+
256256
// Filter out common English words that are likely from error messages
257257
commonWords := map[string]bool{
258258
"calls": true, "to": true, "for": true, "the": true, "a": true, "an": true,
@@ -262,25 +262,25 @@ func isValidToolName(toolName string) bool {
262262
"Testing": true, "multiple": true, "launches": true, "command": true, "invocation": true,
263263
"with": true, "from": true, "by": true, "at": true, "in": true, "on": true,
264264
}
265-
265+
266266
if commonWords[name] {
267267
return false
268268
}
269-
269+
270270
// Tool names should typically contain underscores, hyphens, or be camelCase
271271
// or be all lowercase. Single words without these patterns are suspect.
272272
hasUnderscore := strings.Contains(name, "_")
273273
hasHyphen := strings.Contains(name, "-")
274274
hasCapital := strings.ToLower(name) != name
275-
276-
// If it's a single word with no underscores/hyphens and is lowercase and short,
275+
276+
// If it's a single word with no underscores/hyphens and is lowercase and short,
277277
// it's likely a fragment
278278
words := strings.Fields(name)
279279
if len(words) == 1 && !hasUnderscore && !hasHyphen && len(name) < 10 && !hasCapital {
280280
// Could be a fragment - be conservative and reject if it's a common word
281281
return false
282282
}
283-
283+
284284
return true
285285
}
286286

@@ -298,12 +298,12 @@ func buildToolUsageSummary(processedRuns []ProcessedRun) []ToolUsageSummary {
298298

299299
for _, toolCall := range metrics.ToolCalls {
300300
displayKey := workflow.PrettifyToolName(toolCall.Name)
301-
301+
302302
// Filter out invalid tool names
303303
if !isValidToolName(displayKey) {
304304
continue
305305
}
306-
306+
307307
toolRunTracker[displayKey] = true
308308

309309
if existing, exists := toolStats[displayKey]; exists {
@@ -734,7 +734,7 @@ func aggregateLogErrors(processedRuns []ProcessedRun, agg logErrorAggregator) []
734734
// Returns false for internal debug messages, validation logs, JSON fragments, etc.
735735
func isActionableError(message string) bool {
736736
msg := strings.ToLower(message)
737-
737+
738738
// Filter out internal validation/debug messages
739739
debugPatterns := []string{
740740
"validation completed",
@@ -750,13 +750,13 @@ func isActionableError(message string) bool {
750750
"perfect! the",
751751
"failed as expected",
752752
}
753-
753+
754754
for _, pattern := range debugPatterns {
755755
if strings.Contains(msg, pattern) {
756756
return false
757757
}
758758
}
759-
759+
760760
// Filter out JSON fragments and data structures
761761
jsonPatterns := []string{
762762
`"errorCodesToRetry"`,
@@ -766,30 +766,30 @@ func isActionableError(message string) bool {
766766
`"onRequestError"`,
767767
`[{`, `}]`, `"[`,
768768
}
769-
769+
770770
for _, pattern := range jsonPatterns {
771771
if strings.Contains(message, pattern) {
772772
return false
773773
}
774774
}
775-
775+
776776
// Filter out MCP server logs (stderr output)
777-
if strings.Contains(msg, "[mcp server") ||
778-
strings.Contains(msg, "[safeoutputs]") ||
779-
strings.Contains(msg, "send: {\"jsonrpc\"") {
777+
if strings.Contains(msg, "[mcp server") ||
778+
strings.Contains(msg, "[safeoutputs]") ||
779+
strings.Contains(msg, "send: {\"jsonrpc\"") {
780780
return false
781781
}
782-
782+
783783
// Filter out Squid proxy logs
784784
if strings.Contains(msg, "::1:") && strings.Contains(msg, "NONE_NONE:HIER_NONE") {
785785
return false
786786
}
787-
787+
788788
// Filter out tool invocation result logs (these are outputs, not errors)
789789
if strings.HasPrefix(msg, "tool invocation result:") {
790790
return false
791791
}
792-
792+
793793
return true
794794
}
795795

@@ -815,21 +815,21 @@ func buildCombinedErrorsSummary(processedRuns []ProcessedRun) []ErrorSummary {
815815
}
816816

817817
allErrors := aggregateLogErrors(processedRuns, agg)
818-
818+
819819
// Filter out non-actionable errors
820820
var actionableErrors []ErrorSummary
821821
for _, err := range allErrors {
822822
if isActionableError(err.Message) {
823823
actionableErrors = append(actionableErrors, err)
824824
}
825825
}
826-
826+
827827
// Limit to top 20 most common errors to keep output concise
828828
maxErrors := 20
829829
if len(actionableErrors) > maxErrors {
830830
actionableErrors = actionableErrors[:maxErrors]
831831
}
832-
832+
833833
return actionableErrors
834834
}
835835

@@ -922,18 +922,18 @@ func renderLogsConsole(data LogsData) {
922922
// Display concise summary at the end
923923
fmt.Fprintln(os.Stderr, "") // Blank line for spacing
924924
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("✓ Downloaded %d workflow logs to %s", data.Summary.TotalRuns, data.LogsLocation)))
925-
925+
926926
// Show key metrics in a concise format
927927
if data.Summary.TotalErrors > 0 || data.Summary.TotalWarnings > 0 {
928-
fmt.Fprintf(os.Stderr, " %s %d errors, %d warnings across %d runs\n",
928+
fmt.Fprintf(os.Stderr, " %s %d errors, %d warnings across %d runs\n",
929929
console.FormatInfoMessage("•"),
930-
data.Summary.TotalErrors,
930+
data.Summary.TotalErrors,
931931
data.Summary.TotalWarnings,
932932
data.Summary.TotalRuns)
933933
}
934-
934+
935935
if len(data.ToolUsage) > 0 {
936-
fmt.Fprintf(os.Stderr, " %s %d unique tools used\n",
936+
fmt.Fprintf(os.Stderr, " %s %d unique tools used\n",
937937
console.FormatInfoMessage("•"),
938938
len(data.ToolUsage))
939939
}

0 commit comments

Comments
 (0)