Skip to content

Enforce logs cache budgets with selective pruning - #59049

Merged
pelikhan merged 6 commits into
mainfrom
copilot/update-logs-command-cache-size
Sep 7, 2026
Merged

Enforce logs cache budgets with selective pruning#59049
pelikhan merged 6 commits into
mainfrom
copilot/update-logs-command-cache-size

Conversation

Copilot AI commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

logs --max-storage previously stopped downloads once the cache reached its limit without exposing existing usage or reclaiming space. Large non-essential agent artifacts could exhaust the budget despite compact metadata being sufficient for cached analysis.

  • Cache visibility
    • Report total starting cache usage and per-folder sizes.
  • Selective pruning
    • Remove the largest non-essential data from completed runs.
    • Preserve summaries, job metadata, usage data, and other known essentials.
    • Invalidate artifact markers when their underlying data is pruned.
    • Continue downloads when enough space is reclaimed.
  • Jobs metadata resilience
    • Parse paginated jobs responses independently so one malformed page does not discard valid pages.
  • CLI contract
    • Update --max-storage help and MCP schema text to describe pruning behavior.


✨ PR Review Safe Output Test - Run 34069434361

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • clients2.google.com
  • mtalk.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "clients2.google.com"
    - "mtalk.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · claude · sonnet46 · 52.1 AIC · ⌖ 18.4 AIC · ⊞ 7.8K ·
Comment /smoke-claude to run again


pr-sous-chef

Run: https://github.com/github/gh-aw/actions/runs/34079693285

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 28 AIC · ⌖ 8.61 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Copilot AI and others added 4 commits September 6, 2026 23:21
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Prune logs cache within storage budget Enforce logs cache budgets with selective pruning Sep 6, 2026
Copilot AI requested a review from pelikhan September 6, 2026 23:39

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • clients2.google.com
  • mtalk.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "clients2.google.com"
    - "mtalk.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · claude · sonnet46 · 52.1 AIC · ⌖ 18.4 AIC · ⊞ 7.8K
Comment /smoke-claude to run again

Comment thread pkg/cli/logs_command.go
%[1]s logs --timeout 30 --max-github-api-rate-limit -2000 # Keep 2000 core API requests available
%[1]s logs --timeout 30 --max-storage 10240 # Stop new downloads after using 10 GB
%[1]s logs --timeout 30 --max-storage 10240 # Prune cache data and stop downloads at 10 GB

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice improvement! The updated help text clearly describes pruning behavior rather than just stopping downloads. This makes the CLI behavior much more transparent to users.

require.NoError(t, err)
require.Len(t, jobs, 2)
assert.Equal(t, "first", jobs[0].Name)
assert.Equal(t, "last", jobs[1].Name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good test coverage for malformed page handling. The test validates that one bad page does not discard valid pages from other pages - this is an important resilience property.

@pelikhan
pelikhan marked this pull request as ready for review September 7, 2026 02:54
Copilot AI balanced review requested due to automatic review settings September 7, 2026 02:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical concurrency issue and multiple moderate cache-pruning correctness issues remain unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds cache-aware storage budgeting and selective pruning for log downloads, plus resilient paginated jobs parsing.

Changes:

  • Reports cache usage and prunes non-essential artifacts.
  • Preserves essential metadata and manages artifact markers.
  • Parses jobs pages independently and updates CLI documentation.
File summaries
File Review
pkg/cli/mcp_tools_privileged.go Updates MCP storage-budget documentation.
pkg/cli/logs_storage_limit.go Implements cache measurement and pruning. Unresolved: stale usage after cleanup (moderate, 1 vote); unsafe pruning of active multi-target downloads (critical, 2 votes); unconditional marker invalidation causing cache churn (moderate, 1 vote); pruning before filtering/parsing completes (moderate, 1 vote).
pkg/cli/logs_storage_limit_test.go Tests cache sizing and pruning behavior.
pkg/cli/logs_orchestrator_types.go Documents storage-pruning semantics.
pkg/cli/logs_github_api.go Parses paginated jobs responses independently.
pkg/cli/logs_github_api_test.go Tests malformed jobs-page handling.
pkg/cli/logs_command.go Updates CLI help and examples.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 4
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/cli/logs_storage_limit.go Outdated
Comment on lines +211 to +212
for _, folder := range folders {
l.completed[filepath.Join(l.outputDir, folder.name)] = struct{}{}
maxBytes: int64(maxStorageMB) * bytesPerMegabyte,
completed: make(map[string]struct{}),
}
limit.initErr = limit.initialize()
Comment thread pkg/cli/logs_storage_limit.go Outdated
}
l.recordUsage(sizeAfter - sizeBefore)
return downloadErr
pruneErr := l.recordUsage(storagePath, sizeAfter-sizeBefore)
Comment on lines +333 to +334
if err := invalidatePrunedArtifactMarkers(candidate.path, path); err != nil {
return freed, err
@gh-aw-bot

Copy link
Copy Markdown
Collaborator
pr-sous-chef

@copilot Please take the next forward-progress pass on PR #59049.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 28 AIC · ⌖ 8.61 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author
pr-sous-chef
```...

Implemented the cache-pruning correctness fixes and pushed commit $(git rev-parse --short HEAD): multi-target cleanup now precedes limiter initialization, only exact run-* directories are eligible, pruning is deferred until filtering/parsing completes, and workflow-log pruning no longer invalidates unrelated artifact markers. Focused CLI tests and final change-scoped validation pass; parallel validation found no review issues.

Copilot AI requested a review from gh-aw-bot September 7, 2026 03:49
@pelikhan
pelikhan merged commit 73712c9 into main Sep 7, 2026
32 checks passed
@pelikhan
pelikhan deleted the copilot/update-logs-command-cache-size branch September 7, 2026 04:37
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
…amic enclave delegation)

- Add Logs Storage Budget (--max-storage) documenting gh aw logs selective pruning/storage cap (#59049)
- Add Dynamic Enclave Delegation Controller documenting enclaves[].agent.dynamic mode (#59046)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.88.6

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.

4 participants