Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions pkg/cli/logs_orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ func DownloadWorkflowLogs(ctx context.Context, workflowName string, count int, s
}

// Build structured logs data
logsOrchestratorLog.Printf("Building logs data from %d processed runs (continuation=%t)", len(processedRuns), continuation != nil)
logsData := buildLogsData(processedRuns, outputDir, continuation)

// Write summary file if requested (default behavior unless disabled with empty string)
Expand Down Expand Up @@ -804,6 +805,7 @@ func normalizeSafeOutputType(safeOutputType string) string {

// runContainsSafeOutputType checks if a run's agent_output.json contains a specific safe output type
func runContainsSafeOutputType(runDir string, safeOutputType string, verbose bool) (bool, error) {
logsOrchestratorLog.Printf("Checking run for safe output type: dir=%s, type=%s", runDir, safeOutputType)
// Normalize the type for comparison (convert dashes to underscores)
normalizedType := normalizeSafeOutputType(safeOutputType)

Expand Down
2 changes: 2 additions & 0 deletions pkg/parser/schedule_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (p *ScheduleParser) parseInterval() (string, error) {
if len(p.tokens) < 2 {
return "", errors.New("invalid interval format, expected 'every N unit' or 'every Nunit'")
}
scheduleLog.Printf("Parsing interval schedule: tokens=%v", p.tokens)

// Check if "on weekdays" suffix is present at the end
hasWeekdaysSuffix := p.hasWeekdaysSuffix()
Expand Down Expand Up @@ -275,6 +276,7 @@ func (p *ScheduleParser) parseBase() (string, error) {
}

baseType := p.tokens[0]
scheduleLog.Printf("Parsing base schedule: type=%s, tokens=%v", baseType, p.tokens)
var minute, hour, day, month, weekday string

// Default time is 00:00
Expand Down
5 changes: 5 additions & 0 deletions pkg/workflow/checkout_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type CheckoutManager struct {
// NewCheckoutManager creates a new CheckoutManager pre-loaded with user-supplied
// CheckoutConfig entries from the frontmatter.
func NewCheckoutManager(userCheckouts []*CheckoutConfig) *CheckoutManager {
checkoutManagerLog.Printf("Creating checkout manager with %d user checkout config(s)", len(userCheckouts))
cm := &CheckoutManager{
index: make(map[checkoutKey]int),
}
Expand Down Expand Up @@ -172,6 +173,7 @@ func (cm *CheckoutManager) GetDefaultCheckoutOverride() *resolvedCheckout {
// (additional) checkouts — those that target a specific path other than the root.
// The caller is responsible for emitting the default workspace checkout separately.
func (cm *CheckoutManager) GenerateAdditionalCheckoutSteps(getActionPin func(string) string) []string {
checkoutManagerLog.Printf("Generating additional checkout steps from %d configured entries", len(cm.ordered))
var lines []string
for _, entry := range cm.ordered {
// Skip the default checkout (handled separately)
Expand All @@ -180,6 +182,7 @@ func (cm *CheckoutManager) GenerateAdditionalCheckoutSteps(getActionPin func(str
}
lines = append(lines, generateCheckoutStepLines(entry, getActionPin)...)
}
checkoutManagerLog.Printf("Generated %d additional checkout step(s)", len(lines))
return lines
}

Expand All @@ -199,6 +202,7 @@ func (cm *CheckoutManager) GenerateDefaultCheckoutStep(
getActionPin func(string) string,
) []string {
override := cm.GetDefaultCheckoutOverride()
checkoutManagerLog.Printf("Generating default checkout step: trialMode=%t, hasOverride=%t", trialMode, override != nil)

var sb strings.Builder
sb.WriteString(" - name: Checkout repository\n")
Expand Down Expand Up @@ -363,6 +367,7 @@ func ParseCheckoutConfigs(raw any) ([]*CheckoutConfig, error) {
if raw == nil {
return nil, nil
}
checkoutManagerLog.Printf("Parsing checkout configuration: type=%T", raw)

// Try single object first
if singleMap, ok := raw.(map[string]any); ok {
Expand Down
5 changes: 5 additions & 0 deletions pkg/workflow/claude_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func (e *ClaudeEngine) isClaudeResultPayload(line string) bool {

// extractClaudeResultMetrics extracts metrics from Claude result payload
func (e *ClaudeEngine) extractClaudeResultMetrics(line string) LogMetrics {
claudeLogsLog.Print("Extracting metrics from Claude result payload")
var metrics LogMetrics

trimmed := strings.TrimSpace(line)
Expand Down Expand Up @@ -136,6 +137,7 @@ func (e *ClaudeEngine) extractClaudeResultMetrics(line string) LogMetrics {
// Note: Duration extraction is handled in the main parsing logic where we have access to tool calls
// This is because we need to distribute duration among tool calls

claudeLogsLog.Printf("Extracted Claude result metrics: tokens=%d, cost=$%.4f, turns=%d", metrics.TokenUsage, metrics.EstimatedCost, metrics.Turns)
return metrics
}

Expand Down Expand Up @@ -317,6 +319,9 @@ func (e *ClaudeEngine) parseClaudeJSONLog(logContent string, verbose bool) LogMe
// Finalize tool calls and sequences using shared helper
FinalizeToolCallsAndSequence(&metrics, toolCallMap, currentSequence)

claudeLogsLog.Printf("Parsed %d log entries: tokens=%d, cost=$%.4f, turns=%d, tool_types=%d",
len(logEntries), metrics.TokenUsage, metrics.EstimatedCost, metrics.Turns, len(metrics.ToolCalls))

if verbose && len(metrics.ToolSequences) > 0 {
totalTools := 0
for _, seq := range metrics.ToolSequences {
Expand Down
5 changes: 5 additions & 0 deletions pkg/workflow/frontmatter_extraction_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ func (c *Compiler) addZizmorIgnoreForWorkflowRun(yamlStr string) string {
if !strings.Contains(yamlStr, "workflow_run:") {
return yamlStr
}
frontmatterLog.Print("Adding zizmor ignore annotation for workflow_run trigger")

lines := strings.Split(yamlStr, "\n")
var result []string
Expand Down Expand Up @@ -551,6 +552,7 @@ func (c *Compiler) addZizmorIgnoreForWorkflowRun(yamlStr string) string {
func (c *Compiler) extractPermissions(frontmatter map[string]any) string {
permissionsValue, exists := frontmatter["permissions"]
if !exists {
frontmatterLog.Print("No permissions field found in frontmatter")
return ""
}

Expand Down Expand Up @@ -612,6 +614,7 @@ func (c *Compiler) extractExpressionFromIfString(ifString string) string {

// extractCommandConfig extracts command configuration from frontmatter including name and events
func (c *Compiler) extractCommandConfig(frontmatter map[string]any) (commandNames []string, commandEvents []string) {
frontmatterLog.Print("Extracting command configuration from frontmatter")
// Check new format: on.slash_command or on.slash_command.name (preferred)
// Also check legacy format: on.command or on.command.name (deprecated)
if onValue, exists := frontmatter["on"]; exists {
Expand Down Expand Up @@ -641,6 +644,7 @@ func (c *Compiler) extractCommandConfig(frontmatter map[string]any) (commandName

// Check if command is a string (shorthand format)
if commandStr, ok := commandValue.(string); ok {
frontmatterLog.Printf("Extracted command name (shorthand): %s", commandStr)
return []string{commandStr}, nil // nil means default (all events)
}
// Check if command is a map with a name key (object format)
Expand All @@ -666,6 +670,7 @@ func (c *Compiler) extractCommandConfig(frontmatter map[string]any) (commandName
events = ParseCommandEvents(eventsValue)
}

frontmatterLog.Printf("Extracted command config: names=%v, events=%v", names, events)
return names, events
}
}
Expand Down