Skip to content

Add actions job log buffer and profiler #866

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

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

mattdholloway
Copy link
Contributor

@mattdholloway mattdholloway commented Aug 13, 2025

Extends the get_job_logs tool and other parts of the MCP server that rely on downloading Actions job log data. The new functionality ensures memory leaks do not occur by using a 'sliding window' buffer to only have 5MB of the log in memory at a time as it reads the entire log. This then allows for a tail step after this that retains the correct amount of lines within the final window before completion.

Closes: https://github.com/github/copilot-agent-services/issues/375

@mattdholloway mattdholloway marked this pull request as ready for review August 13, 2025 12:56
@mattdholloway mattdholloway requested a review from a team as a code owner August 13, 2025 12:56
@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 12:56
Copilot

This comment was marked as outdated.

@mattdholloway mattdholloway requested a review from Copilot August 15, 2025 14:16
Copilot

This comment was marked as outdated.

@mattdholloway mattdholloway changed the title Add actions job log buffer Add actions job log buffer and profiler Aug 15, 2025
@mattdholloway mattdholloway requested a review from Copilot August 15, 2025 15:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds performance profiling capabilities and memory-efficient log processing for GitHub Actions job logs. The main purpose is to prevent memory leaks when processing large log files by implementing a sliding window buffer approach.

  • Introduces a new profiler package for monitoring memory usage and execution time
  • Replaces direct memory reading with a ring buffer implementation that maintains a 5MB sliding window
  • Updates job log processing to use the new buffer system with configurable tail line limits

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/profiler/profiler.go New profiler package providing memory and performance monitoring capabilities
pkg/buffer/buffer.go New ring buffer implementation for memory-efficient log processing
pkg/github/actions.go Updated job log processing to use the new buffer system and profiling
pkg/github/actions_test.go Added tests for memory usage comparison and buffer functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

}

return int64(after) - int64(before)
}
Copy link
Preview

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

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

The function safeMemoryDelta needs documentation explaining its purpose and the edge cases it handles for uint64 to int64 conversion overflow protection.

Copilot uses AI. Check for mistakes.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

1 participant