Optimize workflows based on live log analysis: MCP pagination and JSON parsing #3293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Live analysis of 11 workflow runs identified two actionable failure patterns: MCP response size limit exceeded (75k+ tokens from
list_pull_requests) and JSON parsing errors from Unicode symbols in npm output.Changes
Created shared pagination guidance
.github/workflows/shared/mcp-pagination.md: Documents 25k token limit, pagination patterns for GitHub API toolsperPageexamples for PRs, issues, search operationsUpdated smoke-claude workflow
imports: [shared/mcp-pagination.md]toolsets: [repos, pull_requests](was wildcard)max-turns: 15Enhanced cli-version-checker
npm view package --json 2>/dev/null | jq -r '.version'Expected impact
Original prompt
This section details on the original issue you should resolve
<issue_title>[q] Workflow optimizations based on live log analysis</issue_title>
<issue_description># Q Workflow Optimization Report
Issues Found (from live data)
Analysis Overview
Issue #1: MCP Response Size Limits (Claude Engine)
Severity: Medium
Affected Workflows: Smoke Claude
Run IDs Analyzed: 19103049716, 19114358281
Log Evidence:
MCP tool "list_pull_requests" response (75897 tokens) exceeds maximum allowed tokens (25000)MCP tool "pull_request_read" response (31675 tokens) exceeds maximum allowed tokens (25000)Root Cause: Large result sets from GitHub API calls exceed the 25k token limit for MCP tool responses, forcing workflows to use pagination reactively rather than proactively.
Impact: Workflows must retry with pagination parameters, adding extra turns and API calls.
Issue #2: JSON Parsing Errors (Copilot Engine)
Severity: Low-Medium
Affected Workflows: CLI Version Checker, Q
Run IDs Analyzed: 19106334374, 19102935260
Log Evidence:
Unexpected token 'W', "When fetch"... is not valid JSONUnexpected token 'ℹ', "ℹ Timeout "... is not valid JSONUnexpected token '⚠', "⚠ pip pack"... is not valid JSONRoot Cause: Tool outputs (npm, bash commands) include informational messages with Unicode symbols (ℹ, ⚠, ✓) before or after JSON content.
Impact: Parsing failures require additional error handling and retry logic.
Issue #3: Network Unreachable (IPv6)
Severity: Low (Infrastructure)
Affected Workflows: Changeset Generator, Smoke Copilot
Run IDs: 19114358285, 19114358286
Log Evidence:
sending to ICMPv6 packet to [2606:4700::6810:1d22]: (101) Network is unreachableNote: Infrastructure-related, not addressable via workflow configuration.
Changes Made
1. Created Shared MCP Pagination Guidance (.github/workflows/shared/mcp-pagination.md)
Purpose: Provide reusable best practices for avoiding MCP response size errors
Content:
perPageparameter effectivelyBenefits:
2. Updated Smoke Claude (.github/workflows/smoke-claude.md)
Changes:
imports: [shared/mcp-pagination.md]for pagination guidancetoolsets: [repos, pull_requests]instead of wildcardmax-turns: 15to prevent excessive iterationsExpected Improvements:
3. Enhanced CLI Version Checker (.github/workflows/cli-version-checker.md)
Changes:
grep -vto filter informational messagesjqfor reliable JSON extractionnpm view ... 2>/dev/nullExpected Improvements:
Validation
All modified workflows were validated:
Note: .lock.yml files will be generated automatically after merge via standard compilation process.
Expected Impact
Performance Improvements
Reliability Improvements
References
Log Analysis Files
/tmp/gh-aw/aw-mcp/logs/run-*/run_summary.json/tmp/gh-aw/aw-mcp/logs/run-*/detection.logSpecific Runs Investigated
💡 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.