Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/cli/audit_agentic_analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ func detectTaskDomain(processedRun ProcessedRun, createdItems []CreatedItemRepor

func buildBehaviorFingerprint(processedRun ProcessedRun, metrics MetricsData, toolUsage []ToolUsageInfo, createdItems []CreatedItemReport, awContext *AwContext) *BehaviorFingerprint {
toolTypes := len(toolUsage)
writeCount := len(createdItems) + processedRun.Run.SafeItemsCount
writeCount := processedRun.Run.SafeItemsCount
if writeCount == 0 {
writeCount = len(createdItems)
}
Comment on lines +167 to +170
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The writeCount “SafeItemsCount with fallback to len(createdItems)” logic is now duplicated here and again in buildAgenticAssessments. Consider extracting a small helper (e.g., deriveWriteCount(processedRun.Run.SafeItemsCount, createdItems)) so the classification logic stays consistent if this heuristic changes (and so other call sites like computeAgenticFraction can reuse the same definition of write actions).

This issue also appears on line 229 of the same file.

See below for a potential fix:

func deriveWriteCount(safeItemsCount int, createdItems []CreatedItemReport) int {
	if safeItemsCount > 0 {
		return safeItemsCount
	}
	return len(createdItems)
}

func buildBehaviorFingerprint(processedRun ProcessedRun, metrics MetricsData, toolUsage []ToolUsageInfo, createdItems []CreatedItemReport, awContext *AwContext) *BehaviorFingerprint {
	toolTypes := len(toolUsage)
	writeCount := deriveWriteCount(processedRun.Run.SafeItemsCount, createdItems)

Copilot uses AI. Check for mistakes.
Comment on lines +167 to +170
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s no unit test asserting the intended behavior change (avoid double-counting when both createdItems and SafeItemsCount are populated). Adding a focused test that covers cases like (SafeItemsCount>0, createdItems non-empty) and (SafeItemsCount==0, createdItems non-empty) would help prevent regressions in ActuationStyle/ResourceProfile classification and assessment evidence.

Copilot uses AI. Check for mistakes.

executionStyle := "directed"
switch {
Expand Down Expand Up @@ -223,7 +226,10 @@ func buildAgenticAssessments(processedRun ProcessedRun, metrics MetricsData, too
assessments := make([]AgenticAssessment, 0, 4)
toolTypes := len(toolUsage)
frictionEvents := len(processedRun.MissingTools) + len(processedRun.MCPFailures) + len(processedRun.MissingData)
writeCount := len(createdItems) + processedRun.Run.SafeItemsCount
writeCount := processedRun.Run.SafeItemsCount
if writeCount == 0 {
writeCount = len(createdItems)
}

if fingerprint.ResourceProfile == "heavy" {
severity := "medium"
Expand Down
Loading