perf: optimize secret-digger-claude token usage#1894
Conversation
Address recommendations from #1889 (Claude token optimization report): 1. Disable GitHub MCP tools (github: false) - 52 unused GitHub MCP tools were loaded (~26K tokens/run) - Workflow only uses bash, cache-memory, and safe-outputs - Estimated savings: ~64% cost reduction ($0.51 → ~$0.18/run) 2. Add max-turns: 8 - Claude engine supports max-turns (unlike Copilot) - Enforces hard turn budget to prevent runaway costs 3. Reduce timeout-minutes from 30 to 15 - Typical runs complete in ~5 minutes with 3 turns - Halves the max cost ceiling for failure scenarios 4. Remove duplicate context from user message - Repository, Run ID, Workflow, Engine lines already injected by gh-aw framework into system context Closes #1889 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
Optimizes the secret-digger-claude agent workflow to reduce prompt/tool-schema token overhead and enforce a hard turn/time budget.
Changes:
- Disabled GitHub MCP tooling for this workflow (
tools.github: false) to avoid loading unused tool schemas. - Added an explicit Claude turn cap (
max-turns: 8) and reduced workflow timeout to 15 minutes. - Removed duplicated run-context text and updated the generated lock file to drop GitHub MCP prompt/context and related steps.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/secret-digger-claude.md |
Adds max-turns, disables GitHub MCP tools, reduces timeout, and trims prompt context. |
.github/workflows/secret-digger-claude.lock.yml |
Regenerates the compiled workflow to remove GitHub MCP server/context and reflect the new budgets. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
| BASH_DEFAULT_TIMEOUT_MS: "1800000" # 30 minutes for bash commands | ||
| BASH_MAX_TIMEOUT_MS: "1800000" # 30 minutes max timeout |
There was a problem hiding this comment.
timeout-minutes is now 15, but the engine env still sets BASH_DEFAULT_TIMEOUT_MS / BASH_MAX_TIMEOUT_MS to 30 minutes. This can lead to the agent selecting long-running bash commands that will be terminated by the workflow timeout. Consider lowering the bash timeouts to <= 15 minutes (or increasing timeout-minutes) so tool/runtime limits are aligned.
| BASH_DEFAULT_TIMEOUT_MS: "1800000" # 30 minutes for bash commands | |
| BASH_MAX_TIMEOUT_MS: "1800000" # 30 minutes max timeout | |
| BASH_DEFAULT_TIMEOUT_MS: "900000" # 15 minutes for bash commands | |
| BASH_MAX_TIMEOUT_MS: "900000" # 15 minutes max timeout |
| "type": "http", | ||
| "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT", | ||
| "headers": { | ||
| "Authorization": "$GH_AW_SAFE_OUTPUTS_API_KEY" |
There was a problem hiding this comment.
The Safe Outputs MCP server config no longer includes a guard-policies.write-sink section. In this repo, other workflows configure Safe Outputs with an explicit write-sink allow list (e.g. .github/workflows/security-guard.lock.yml), and removing it may cause Safe Outputs tool calls (like create_issue) to be blocked or behave differently. Please re-add the Safe Outputs guard policy (or confirm/document why it’s safe to omit here).
| "Authorization": "$GH_AW_SAFE_OUTPUTS_API_KEY" | |
| "Authorization": "$GH_AW_SAFE_OUTPUTS_API_KEY" | |
| }, | |
| "guard-policies": { | |
| "write-sink": { | |
| "allow": [ | |
| "create_issue" | |
| ] | |
| } |
🔥 Smoke Test Results — PR #1894
Overall: PASS ✅ Author: @lpcox · No assignees
|
Smoke Test Results✅ GitHub MCP — "ci: disable threat detection in all workflows" / "perf: disable GitHub MCP tools in secret-digger-claude to cut token costs ~64%" Overall: PASS
|
This comment has been minimized.
This comment has been minimized.
Smoke Test: GitHub Actions Services Connectivity ✅All connectivity checks passed:
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
Smoke test report:
|
Summary
Addresses token optimization recommendations from #1889.
Changes
github: false— disables 52 unused GitHub MCP tools (~26K tokens/run, 67% of cache writes)max-turns: 8— hard turn budget (Claude supports this, unlike Copilot)timeout-minutes30 → 15 — typical runs complete in ~5 min / 3 turnsExpected Impact
Verification
After merging, run via
workflow_dispatchand compare token counts in the next token usage report. Target: avg cost/run ≈ $0.18 (±20%).Closes #1889