Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions actions/setup/js/handle_agent_failure.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,16 +1324,18 @@ function buildEffectiveTokensRateLimitErrorContext(hasEffectiveTokensRateLimitEr
return (
"\n" +
renderTemplateFromFile(templatePath, {
et_spec_link: "https://github.github.com/gh-aw/specs/effective-tokens-specification/",
token_opt_link: "https://github.com/github/gh-aw/blob/main/.github/aw/token-optimization.md",
ai_credits_spec_link: "https://github.github.com/gh-aw/specs/ai-credits-specification/",
cost_management_link: "https://github.github.com/gh-aw/reference/cost-management/",
usage_line: usageLine,
budget_line: budgetLine,
run_line: runLine,
et_table_section: etTableSection,
})
);
} catch (error) {
throw new Error(`failed to render template at ${templatePath}: ${getErrorMessage(error)}; ` + "verify template syntax and required placeholders: " + "et_spec_link, token_opt_link, usage_line, budget_line, run_line, et_table_section");
throw new Error(
`failed to render template at ${templatePath}: ${getErrorMessage(error)}; ` + "verify template syntax and required placeholders: " + "ai_credits_spec_link, cost_management_link, usage_line, budget_line, run_line, et_table_section"
);
}
}

Expand Down
18 changes: 10 additions & 8 deletions actions/setup/js/handle_agent_failure.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2903,14 +2903,15 @@ describe("handle_agent_failure", () => {
fs.mkdirSync(promptsDir, { recursive: true });
fs.writeFileSync(
path.join(promptsDir, "effective_tokens_rate_limit_error.md"),
"**Effective Token Budget Exhausted**: The run failed due to effective-token budget/rate-limit enforcement in the API proxy.\n\n" +
"**AI Credits Budget Guidance**: The run hit a legacy effective-token rate-limit signal from the API proxy. gh-aw now uses AI Credits (AIC) as the primary cost metric, so migrate per-run budgeting to `max-ai-credits`.\n\n" +
"<details>\n" +
"<summary>Why this happened and how to optimize</summary>\n\n" +
"- Learn about [effective tokens]({et_spec_link}).\n" +
"- Learn about [AI Credits]({ai_credits_spec_link}).\n" +
"{usage_line}{budget_line}{run_line}\n" +
"- `max-effective-tokens` is deprecated; use `max-ai-credits` in workflow frontmatter.\n\n" +
"You can tune this limit with `max-ai-credits` in workflow frontmatter.\n\n" +
"{et_table_section}\n" +
"- To optimize this workflow, follow the [token optimization instructions]({token_opt_link}).\n" +
"- To budget and optimize this workflow, follow the [cost management guidance]({cost_management_link}).\n" +
"</details>\n"
);
process.env.RUNNER_TEMP = tmpDir;
Expand Down Expand Up @@ -2956,14 +2957,14 @@ describe("handle_agent_failure", () => {
expect(result).not.toContain("- Run:");
});

it("includes a link to the ET specification docs", () => {
it("includes a link to the AI Credits specification docs", () => {
const result = buildEffectiveTokensRateLimitErrorContext(true, "10000000", "25000000", "https://example.com/run/1");
expect(result).toContain("https://github.github.com/gh-aw/specs/effective-tokens-specification/");
expect(result).toContain("https://github.github.com/gh-aw/specs/ai-credits-specification/");
});

it("includes a link to the token optimization guide", () => {
it("includes a link to the cost management guide", () => {
const result = buildEffectiveTokensRateLimitErrorContext(true, "10000000", "25000000", "https://example.com/run/1");
expect(result).toContain("https://github.com/github/gh-aw/blob/main/.github/aw/token-optimization.md");
expect(result).toContain("https://github.github.com/gh-aw/reference/cost-management/");
});

it("formats the run URL as a markdown link", () => {
Expand All @@ -2974,7 +2975,8 @@ describe("handle_agent_failure", () => {
it("wraps ET guidance in a collapsible details section", () => {
const result = buildEffectiveTokensRateLimitErrorContext(true, "10000000", "25000000", "https://example.com/run/1");
expect(result).toContain("<summary>Why this happened and how to optimize</summary>");
expect(result).toContain("token optimization instructions");
expect(result).toContain("cost management guidance");
expect(result).toContain("max-ai-credits");
});

it("includes a collapsible details section for ET computation", () => {
Expand Down
7 changes: 4 additions & 3 deletions actions/setup/md/effective_tokens_rate_limit_error.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
**⚠️ Effective Token Budget Exhausted**: The run failed due to effective-token budget/rate-limit enforcement in the API proxy.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot rename file

**⚠️ AI Credits Budget Guidance**: The run hit a legacy effective-token rate-limit signal from the API proxy. gh-aw now uses AI Credits (AIC) as the primary cost metric, so migrate per-run budgeting to `max-ai-credits`.

<details>
<summary>Why this happened and how to optimize</summary>

- Learn about [effective tokens]({et_spec_link}).
- Learn about [AI Credits]({ai_credits_spec_link}).
{usage_line}{budget_line}{run_line}
- `max-effective-tokens` is deprecated; use `max-ai-credits` in workflow frontmatter.
You can tune this limit with `max-ai-credits` in workflow frontmatter.

{et_table_section}
- To optimize this workflow, follow the [token optimization instructions]({token_opt_link}).
- To budget and optimize this workflow, follow the [cost management guidance]({cost_management_link}).
</details>
16 changes: 3 additions & 13 deletions pkg/actionpins/data/action_pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,10 @@
"version": "v4.36.0",
"sha": "7211b7c8077ea37d8641b6271f6a365a22a5fbfa"
},
"github/gh-aw-actions/setup-cli@v0.78.2": {
"repo": "github/gh-aw-actions/setup-cli",
"version": "v0.78.2",
"sha": "268bf92726cb8153337c07166f382ee46e4fd897"
},
"github/gh-aw-actions/setup@v0.78.2": {
"github/gh-aw-actions/setup@v0.76.1": {
"repo": "github/gh-aw-actions/setup",
"version": "v0.78.2",
"sha": "268bf92726cb8153337c07166f382ee46e4fd897"
},
"github/gh-aw/actions/setup-cli@v0.78.2": {
"repo": "github/gh-aw/actions/setup-cli",
"version": "v0.78.2",
"sha": "a7d4043a8224182262356a32931099b76fd332eb"
"version": "v0.76.1",
"sha": "46d564922b082d0db93244972e8005ea6904ee5f"
},
"github/stale-repos@v9.0.14": {
"repo": "github/stale-repos",
Expand Down
16 changes: 3 additions & 13 deletions pkg/workflow/data/action_pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,10 @@
"version": "v4.36.0",
"sha": "7211b7c8077ea37d8641b6271f6a365a22a5fbfa"
},
"github/gh-aw-actions/setup-cli@v0.78.2": {
"repo": "github/gh-aw-actions/setup-cli",
"version": "v0.78.2",
"sha": "268bf92726cb8153337c07166f382ee46e4fd897"
},
"github/gh-aw-actions/setup@v0.78.2": {
"github/gh-aw-actions/setup@v0.76.1": {
"repo": "github/gh-aw-actions/setup",
"version": "v0.78.2",
"sha": "268bf92726cb8153337c07166f382ee46e4fd897"
},
"github/gh-aw/actions/setup-cli@v0.78.2": {
"repo": "github/gh-aw/actions/setup-cli",
"version": "v0.78.2",
"sha": "a7d4043a8224182262356a32931099b76fd332eb"
"version": "v0.76.1",
"sha": "46d564922b082d0db93244972e8005ea6904ee5f"
},
"github/stale-repos@v9.0.14": {
"repo": "github/stale-repos",
Expand Down