Open
Conversation
Update skill documentation to teach the agent proper 429 retry-after header handling across all three Cost Management rate-limit headers: - x-ms-ratelimit-microsoft.costmanagement-qpu-retry-after - x-ms-ratelimit-microsoft.costmanagement-entity-retry-after - x-ms-ratelimit-microsoft.costmanagement-tenant-retry-after The agent must check whichever headers are present, take the maximum retry-after value, and not retry until that duration has elapsed. Skill doc changes: - Add rate limit thresholds table to cost-query and cost-forecast guardrails - Add 'Handling 429 Responses' section with all-headers guidance - Fix 429 retry rows in error-handling.md to reference all 3 headers - Add per-scope rate limit warnings in workflow files - Add rate-limit best practice to SKILL.md, bump version to 1.1.0 Test changes: - Reduce RUNS_PER_PROMPT from 5 to 3 to lower rate limit pressure - Lower invocationRateThreshold from 0.8 to 0.6 (2/3 must pass) - Add new 429 response-quality test for rate limit handling Resolves AB#37441409 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the azure-cost skill documentation and tests to reduce Cost Management API rate-limit flakiness (429s), ensure requests use a ClientType header for improved throttling bucketing/telemetry, and correct filter schema casing to match the Cost Query API.
Changes:
- Document improved 429 handling: read all
x-ms-ratelimit-microsoft.costmanagement-*-retry-afterheaders and wait for the maximum. - Add
--headers "ClientType=GitHubCopilotForAzure"toaz restexamples and reinforce the requirement in workflows/skill guidance. - Update filter JSON schema/examples from PascalCase to lowercase, and reduce integration test repetitions/thresholds to stay under per-scope limits.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/azure-cost/integration.test.ts | Lowers runs/thresholds to reduce rate-limit-driven integration test flakiness. |
| plugin/skills/azure-cost/SKILL.md | Bumps skill version and adds best-practice guidance for ClientType + 429 retry headers. |
| plugin/skills/azure-cost/cost-query/workflow.md | Adds ClientType header to az rest examples and expands 429 guidance. |
| plugin/skills/azure-cost/cost-query/request-body-schema.md | Fixes filter schema casing to lowercase keys per API docs. |
| plugin/skills/azure-cost/cost-query/guardrails.md | Adds rate-limit threshold table and clarifies 429 handling / header semantics. |
| plugin/skills/azure-cost/cost-query/examples.md | Updates example filter JSON casing (tags/name/operator/values). |
| plugin/skills/azure-cost/cost-query/error-handling.md | Updates 429 retry strategy to check all retry-after headers. |
| plugin/skills/azure-cost/cost-optimization/workflow.md | Adds explicit guidance to include ClientType header and respect per-scope throttling. |
| plugin/skills/azure-cost/cost-forecast/workflow.md | Adds ClientType header to az rest example. |
| plugin/skills/azure-cost/cost-forecast/guardrails.md | Adds rate-limit thresholds and 429 handling guidance for Forecast API. |
| plugin/skills/azure-cost/cost-forecast/error-handling.md | Updates 429 retry strategy to check all retry-after headers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Addresses three issues with the azure-cost skill across 11 files:
The skill had a 40% integration test failure rate caused by Cost Management API 429 responses. The agent was not properly waiting between requests,
violating the per-scope limit of 4 requests/minute.
Changes:
per-tenant, per-client-type)
longest value
0.8→0.6 to stay within per-scope limits
Added --headers "ClientType=GitHubCopilotForAzure" to all az rest commands in cost-query, cost-forecast, and cost-optimization workflows. This enables
per-client-type rate-limit bucketing (2,000 req/min) and telemetry attribution for requests originating from GitHub Copilot.
Fixed filter JSON property names from PascalCase → lowercase to match the official Query API docs (
https://learn.microsoft.com/en-us/rest/api/cost-management/query/usage?view=rest-cost-management-2023-11-01):
Updated in request-body-schema.md, examples.md, and guardrails.md.
Checklist
1.1.0)
Related Issues