Skip to content

optimize: reduce token usage in three high-consumption workflows#31582

Merged
pelikhan merged 3 commits into
mainfrom
copilot/optimize-token-usage-in-workflows
May 11, 2026
Merged

optimize: reduce token usage in three high-consumption workflows#31582
pelikhan merged 3 commits into
mainfrom
copilot/optimize-token-usage-in-workflows

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

✨ Enhancement

Three workflows were identified (via run IDs 25686395186, 25686664431, 25686664489) as disproportionately high token consumers due to uncapped continuation loops and live API calls inside the agent loop.

What does this improve?

  • test-quality-sentinelmax-continuations: 40 → 15 (~63% worst-case reduction)
  • mattpocock-skills-reviewer — adds max-continuations: 10; PR diff and metadata are now pre-fetched into /tmp/gh-aw/agent/ before the agent starts, eliminating redundant live gh pr diff/gh pr view calls inside the loop
  • contribution-check — adds max-continuations: 20 as a hard engine-level cap, complementing the existing 50-turn soft limit in the prompt to guard against subagent retry runaway

Implementation approach:

  • mattpocock-skills-reviewer: new Pre-fetch PR diff pre-agent step writes pr-diff.patch + pr-meta.json to disk; Step 1 of the agent prompt updated to read these files instead of making API calls
  • All three engine configs now carry explicit max-continuations ceilings
  • .lock.yml files auto-regenerated; all three workflows compile with 0 errors

Copilot AI and others added 2 commits May 11, 2026 21:07
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 [WIP] Optimize token usage in high-consumption workflows optimize: reduce token usage in three high-consumption workflows May 11, 2026
Copilot AI requested a review from pelikhan May 11, 2026 21:11
@pelikhan pelikhan marked this pull request as ready for review May 11, 2026 21:40
Copilot AI review requested due to automatic review settings May 11, 2026 21:40
@pelikhan pelikhan merged commit 2f9810f into main May 11, 2026
@pelikhan pelikhan deleted the copilot/optimize-token-usage-in-workflows branch May 11, 2026 21:40
Copy link
Copy Markdown
Contributor

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

Reduces worst-case token consumption in three high-usage agentic workflows by capping continuation loops and removing redundant live GitHub API calls from inside an agent loop.

Changes:

  • Add/adjust engine.max-continuations ceilings for test-quality-sentinel, mattpocock-skills-reviewer, and contribution-check.
  • Add a pre-agent-steps PR prefetch step to mattpocock-skills-reviewer that writes PR metadata + full diff to /tmp/gh-aw/agent/, and update the prompt to read those files instead of calling gh pr view/diff.
  • Regenerate .lock.yml files and update action pin data to include github/gh-aw-actions/setup@v0.71.5.
Show a summary per file
File Description
pkg/workflow/data/action_pins.json Adds pin entry for github/gh-aw-actions/setup@v0.71.5 to support compiled workflow actions.
pkg/actionpins/data/action_pins.json Mirrors the same new action pin in the actionpins package dataset.
.github/workflows/test-quality-sentinel.md Lowers Copilot continuation ceiling to reduce worst-case runaway cost.
.github/workflows/test-quality-sentinel.lock.yml Regenerated compilation output reflecting new continuation cap (--max-autopilot-continues 15).
.github/workflows/mattpocock-skills-reviewer.md Adds max-continuations: 10 and prefetches PR diff/meta before the agent; prompt updated to read local files.
.github/workflows/mattpocock-skills-reviewer.lock.yml Regenerated compilation output including new prefetch step and continuation cap (--max-autopilot-continues 10).
.github/workflows/issue-arborist.lock.yml Regenerated compilation output (includes Codex harness argument formatting updates).
.github/workflows/contribution-check.md Adds max-continuations: 20 to cap Copilot continuations at the engine level.
.github/workflows/contribution-check.lock.yml Regenerated compilation output reflecting the new continuation cap (--max-autopilot-continues 20).

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 9/9 changed files
  • Comments generated: 0

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.

[q] optimize: reduce token usage in high-consumption workflows

3 participants