Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

The Copilot parser couldn't locate session log files after artifact flattening. The issue was that artifact download structures vary depending on how GitHub Actions handles uploaded paths, and the parser only checked specific expected locations.

Changes

  • logs_parsing.go: Enhanced findAgentLogFile() with robust search strategy

    • Checks agent_output/ directory (pre-flattening, backward compatibility)
    • Strips /tmp/gh-aw/ prefix and checks expected flattened location: sandbox/agent/logs/
    • Added recursive search fallback: Searches entire logDir for session*.log files to handle any artifact structure
  • logs_test.go: Added test cases for Copilot engine

    • Flattened location test
    • Recursive search test for session logs directly in run directory
  • logs_copilot_flattening_integration_test.go: Added comprehensive integration tests

    • Full workflow simulation (download → flatten → parse)
    • Direct flattening test (session logs at root)
    • Multiple session files handling
    • Backward compatibility verification

Example

// Before: Only checked agent_output/
agentOutputDir := filepath.Join(logDir, "agent_output")

// After: Multi-layered search strategy
// 1. Check agent_output/ (backward compatibility)
// 2. Check expected flattened location
const tmpGhAwPrefix = "/tmp/gh-aw/"
if strings.HasPrefix(logFileForParsing, tmpGhAwPrefix) {
    relPath := strings.TrimPrefix(logFileForParsing, tmpGhAwPrefix)
    flattenedDir := filepath.Join(logDir, relPath) // sandbox/agent/logs/
    // Find .log files in flattened directory
}
// 3. Recursive search for session*.log anywhere in logDir (fallback)

The parser now correctly discovers session logs regardless of artifact structure, handling:

  • Pre-flattening location (agent_output/)
  • Expected flattened location (sandbox/agent/logs/)
  • Any artifact structure via recursive search for session*.log files
Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/20704025325/job/59430998166#step:5:1

Make sure the logs file flattening works and the copilot parser is able to find the session file to parse the log.

Try this run:

✓ Downloaded artifacts for run 20701642088 to .github/aw/logs/run-20701642088


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Update findAgentLogFile to check flattened location (sandbox/agent/logs/)
- Strip /tmp/gh-aw/ prefix from engine log path for flattened search
- Add test for copilot engine with flattened location
- Add comprehensive integration tests for flattening workflow
- Tests cover: flattened location, multiple sessions, backward compatibility

Co-authored-by: pelikhan <[email protected]>
Copilot AI changed the title [WIP] Ensure logs file flattening works for copilot parser Fix Copilot parser to find session logs after artifact flattening Jan 5, 2026
Copilot AI requested a review from pelikhan January 5, 2026 03:39
@pelikhan pelikhan marked this pull request as ready for review January 5, 2026 03:47
@pelikhan
Copy link
Contributor

pelikhan commented Jan 5, 2026

@copilot flattening is still not working

Copy link
Contributor Author

Copilot AI commented Jan 5, 2026

@copilot flattening is still not working

Could you provide more details about what's not working? The tests pass, and the flattening logic moves files from agent_outputs/sandbox/agent/logs/ to sandbox/agent/logs/. Are you seeing:

  • Files not being moved?
  • Parser not finding files after flattening?
  • A specific workflow run that's failing?

Having specific examples or error messages would help me debug the issue.

@pelikhan
Copy link
Contributor

pelikhan commented Jan 5, 2026

@copilot the parser is not finding the session log file. Look for session*.log recursively to find where to find it.

- findAgentLogFile now searches recursively for session*.log files as fallback
- Handles cases where artifact structure differs from expected
- Added test for direct flattening (session log at root)
- Added test for recursive search fallback
- Resolves issue where parser couldn't find session logs after flattening

Co-authored-by: pelikhan <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 5, 2026

@copilot the parser is not finding the session log file. Look for session*.log recursively to find where to find it.

Fixed in 96610c8. Added recursive search for session*.log files as a fallback when the expected directory structures aren't found. The parser now searches:

  1. agent_output/ (pre-flattening)
  2. sandbox/agent/logs/ (expected post-flattening)
  3. Entire logDir recursively for session*.log (handles any artifact structure)

This handles cases where gh run download creates different directory structures than expected.

@pelikhan pelikhan merged commit 3b7cddc into main Jan 5, 2026
128 of 130 checks passed
@pelikhan pelikhan deleted the copilot/fix-logs-file-flattening branch January 5, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants