-
Notifications
You must be signed in to change notification settings - Fork 355
fix: behavior_fingerprint inconsistency between logs and audit tools for the same run
#23420
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 |
|---|---|---|
|
|
@@ -683,6 +683,21 @@ func downloadRunArtifactsConcurrent(ctx context.Context, runs []WorkflowRun, out | |
| } | ||
| result.Metrics = metrics | ||
|
|
||
| // Update run with metrics so fingerprint computation uses the same data | ||
| // as the audit tool, which also derives these fields from extracted log metrics. | ||
| result.Run.TokenUsage = metrics.TokenUsage | ||
| result.Run.EstimatedCost = metrics.EstimatedCost | ||
| result.Run.Turns = metrics.Turns | ||
| result.Run.LogsPath = runOutputDir | ||
|
|
||
| // Calculate duration and billable minutes from GitHub API timestamps. | ||
| // This mirrors the identical computation in audit.go so that | ||
| // processedRun.Run.Duration is consistent across both tools. | ||
| if !result.Run.StartedAt.IsZero() && !result.Run.UpdatedAt.IsZero() { | ||
| result.Run.Duration = result.Run.UpdatedAt.Sub(result.Run.StartedAt) | ||
| result.Run.ActionMinutes = math.Ceil(result.Run.Duration.Minutes()) | ||
| } | ||
|
Comment on lines
+693
to
+699
|
||
|
|
||
| // Analyze access logs if available | ||
| accessAnalysis, accessErr := analyzeAccessLogs(runOutputDir, verbose) | ||
| if accessErr != 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.
This “sync run fields from extracted metrics” mapping is now duplicated in several places (e.g., pkg/cli/audit.go:266-277, pkg/cli/audit_comparison.go:175-181, and here). Consider centralizing it into a helper to reduce the chance of future drift between tools (this bug was caused by a divergence like that).