Skip to content

Commit 09e4ca6

Browse files
authored
Update safe-output health failure messaging to AI Credits (#37265)
1 parent c8fd5ec commit 09e4ca6

3 files changed

Lines changed: 19 additions & 14 deletions

File tree

actions/setup/js/handle_agent_failure.cjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,16 +1324,18 @@ function buildEffectiveTokensRateLimitErrorContext(hasEffectiveTokensRateLimitEr
13241324
return (
13251325
"\n" +
13261326
renderTemplateFromFile(templatePath, {
1327-
et_spec_link: "https://github.github.com/gh-aw/specs/effective-tokens-specification/",
1328-
token_opt_link: "https://github.com/github/gh-aw/blob/main/.github/aw/token-optimization.md",
1327+
ai_credits_spec_link: "https://github.github.com/gh-aw/specs/ai-credits-specification/",
1328+
cost_management_link: "https://github.github.com/gh-aw/reference/cost-management/",
13291329
usage_line: usageLine,
13301330
budget_line: budgetLine,
13311331
run_line: runLine,
13321332
et_table_section: etTableSection,
13331333
})
13341334
);
13351335
} catch (error) {
1336-
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");
1336+
throw new Error(
1337+
`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"
1338+
);
13371339
}
13381340
}
13391341

actions/setup/js/handle_agent_failure.test.cjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,14 +2903,15 @@ describe("handle_agent_failure", () => {
29032903
fs.mkdirSync(promptsDir, { recursive: true });
29042904
fs.writeFileSync(
29052905
path.join(promptsDir, "effective_tokens_rate_limit_error.md"),
2906-
"**Effective Token Budget Exhausted**: The run failed due to effective-token budget/rate-limit enforcement in the API proxy.\n\n" +
2906+
"**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" +
29072907
"<details>\n" +
29082908
"<summary>Why this happened and how to optimize</summary>\n\n" +
2909-
"- Learn about [effective tokens]({et_spec_link}).\n" +
2909+
"- Learn about [AI Credits]({ai_credits_spec_link}).\n" +
29102910
"{usage_line}{budget_line}{run_line}\n" +
2911+
"- `max-effective-tokens` is deprecated; use `max-ai-credits` in workflow frontmatter.\n\n" +
29112912
"You can tune this limit with `max-ai-credits` in workflow frontmatter.\n\n" +
29122913
"{et_table_section}\n" +
2913-
"- To optimize this workflow, follow the [token optimization instructions]({token_opt_link}).\n" +
2914+
"- To budget and optimize this workflow, follow the [cost management guidance]({cost_management_link}).\n" +
29142915
"</details>\n"
29152916
);
29162917
process.env.RUNNER_TEMP = tmpDir;
@@ -2956,14 +2957,14 @@ describe("handle_agent_failure", () => {
29562957
expect(result).not.toContain("- Run:");
29572958
});
29582959

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

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

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

29802982
it("includes a collapsible details section for ET computation", () => {
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
**⚠️ Effective Token Budget Exhausted**: The run failed due to effective-token budget/rate-limit enforcement in the API proxy.
1+
**⚠️ 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`.
22

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

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

1011
{et_table_section}
11-
- To optimize this workflow, follow the [token optimization instructions]({token_opt_link}).
12+
- To budget and optimize this workflow, follow the [cost management guidance]({cost_management_link}).
1213
</details>

0 commit comments

Comments
 (0)