Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 21, 2025

Plan: Add Run Summary File for Logs Caching ✅ Complete

This PR implements a caching mechanism for the logs command to avoid re-processing already downloaded runs.

Implementation Complete ✅

  • Create a new struct type RunSummary to hold all run metadata (artifacts, metrics, errors, etc.)
  • Add run_summary.json file generation after processing each run
  • Include CLI version in the summary file for cache invalidation
  • Modify downloadRunArtifacts to check for existing summary file first
  • Add logic to reload summary from file if version matches
  • Skip re-downloading and re-processing if valid summary exists
  • Add comprehensive unit tests for summary file creation and loading
  • Add integration tests for caching behavior
  • Update code documentation

Key Changes:

  1. New file: Each run folder now has a run_summary.json containing:

    • CLI version
    • Run metadata (ID, status, workflow name, etc.)
    • Metrics (tokens, cost, turns, errors)
    • Artifact inventory
    • Processing timestamp
    • Access analysis, missing tools, MCP failures, job details
  2. Cache invalidation: If CLI version in summary file doesn't match current version, re-process the run

  3. Performance: Avoid re-downloading artifacts and re-parsing logs for already processed runs (~10-100x faster)

How It Works:

  1. First run: Downloads artifacts → Processes logs → Saves run_summary.json
  2. Subsequent runs: Checks for run_summary.json → Validates version → Loads cached data (skips download/processing)
  3. Version update: Detects version mismatch → Reprocesses run with new CLI version

Tests Added:

  • TestSaveAndLoadRunSummary: Basic save/load functionality
  • TestLoadRunSummaryVersionMismatch: Version-based cache invalidation
  • TestLoadRunSummaryMissingFile: Handles missing summary gracefully
  • TestLoadRunSummaryInvalidJSON: Handles corrupted summary files
  • TestListArtifacts: Artifact file inventory
  • TestRunSummaryJSONStructure: JSON marshaling validation
  • TestRunSummaryCachingBehavior: End-to-end caching behavior
  • TestRunSummaryPreventsReprocessing: Verifies redundant processing is prevented
  • TestListArtifactsExcludesSummary: Summary file exclusion from artifacts list

All tests pass ✅

Original prompt

The "logs" command should write a file in each run folder with the summary of the run artifacts, output, errors,... the existence of this file acts as a marker that the run has already been downloaded and processed. Future runs of the logs command can simply reload the file for results. Add the cli version number to invalidate the data if numbers don't match.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 21, 2025 03:49
- Add RunSummary struct to store complete run metadata and analysis
- Implement loadRunSummary/saveRunSummary for cache persistence
- Include CLI version in summary for automatic cache invalidation
- Add listArtifacts to inventory downloaded files
- Update downloadRunArtifacts to check for valid cached summaries
- Modify downloadRunArtifactsConcurrent to create/load summaries
- Add comprehensive unit and integration tests
- Summary file (run_summary.json) acts as marker for processed runs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Create LOGS_CACHING_EXAMPLE.md with usage examples
- Document how caching works (first run, subsequent runs, version updates)
- Explain run_summary.json structure and benefits
- Include manual cache management commands
- Show verbose mode output examples

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add logs command to write summary file for run artifacts Add run summary caching to logs command for faster reprocessing Oct 21, 2025
Copilot AI requested a review from pelikhan October 21, 2025 03:54
@@ -0,0 +1,145 @@
# Logs Command Caching Feature
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot remove file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in commit e7e75cf

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 21, 2025 04:21
@pelikhan pelikhan marked this pull request as ready for review October 21, 2025 04:32
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit 0d9e27f into main Oct 21, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/add-logs-command-summary-file branch October 21, 2025 04:37
github-actions bot added a commit that referenced this pull request Oct 21, 2025
Update CLI and MCP server documentation to reflect recent feature additions:

- Add --timeout option documentation for logs command with caching details
- Add --parse option documentation for audit command
- Add URL support documentation for audit command (cross-repo, GitHub Enterprise)
- Document continuation field in MCP server logs tool for pagination
- Document large output automatic file handling in MCP server (16K token threshold)

These changes document features from PRs #2066, #2064, #2060, #2058, #2052, and #2051.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.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.

2 participants