From cdccaf77d93d83220d5bd31035b723819f23cfd0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Jun 2026 17:20:38 +0000 Subject: [PATCH 1/4] fix: ensure daily ET guardrail step never fails activation job and improve conclusion reporting - Wrap all GitHub API calls in check_daily_effective_workflow_guardrail.cjs in a top-level try-catch so transient API errors never fail the activation job step. On error the step logs a warning and exits cleanly with the default daily_effective_workflow_exceeded=false output, letting the agent run rather than producing a confusing activation failure. - Enhance daily_effective_workflow_exceeded.md with progressive disclosure: three
sections covering how to raise the daily limit, what the guardrail is, and how to disable it entirely. - Add {daily_effective_workflow_exceeded_context} placeholder to agent_failure_comment.md so repeat-failure comments include the ET context (previously the context was only present in new-issue bodies). - Update check_daily_effective_workflow_guardrail.test.cjs with a test asserting main() resolves (does not throw) when GitHub API calls fail. - Update handle_agent_failure_daily_effective_workflow.test.cjs to assert the three progressive-disclosure sections are present in the rendered template. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- ...eck_daily_effective_workflow_guardrail.cjs | 287 +++++++++--------- ...aily_effective_workflow_guardrail.test.cjs | 52 ++++ ..._failure_daily_effective_workflow.test.cjs | 5 + actions/setup/md/agent_failure_comment.md | 2 +- .../md/daily_effective_workflow_exceeded.md | 67 +++- 5 files changed, 271 insertions(+), 142 deletions(-) diff --git a/actions/setup/js/check_daily_effective_workflow_guardrail.cjs b/actions/setup/js/check_daily_effective_workflow_guardrail.cjs index 852dfd50b4e..8f625f99b27 100644 --- a/actions/setup/js/check_daily_effective_workflow_guardrail.cjs +++ b/actions/setup/js/check_daily_effective_workflow_guardrail.cjs @@ -296,167 +296,180 @@ async function main() { return; } - const githubClient = createRateLimitAwareGithub(github); - const { owner, repo } = context.repo; - const currentRun = await githubClient.rest.actions.getWorkflowRun({ - owner, - repo, - run_id: context.runId, - }); - const rateLimit = await getCoreRateLimitSnapshot(githubClient); + // Wrap all GitHub API interactions in a top-level try-catch so that transient API + // errors, permission failures, or unexpected exceptions never fail the activation + // job step. A failure here would leave `daily_effective_workflow_exceeded` at its + // default "false" value, which is the safe fallback: the agent is allowed to run + // and the guardrail is effectively bypassed for this invocation rather than causing + // a confusing workflow failure. + try { + const githubClient = createRateLimitAwareGithub(github); + const { owner, repo } = context.repo; + const currentRun = await githubClient.rest.actions.getWorkflowRun({ + owner, + repo, + run_id: context.runId, + }); + const rateLimit = await getCoreRateLimitSnapshot(githubClient); - const workflowID = process.env.GH_AW_WORKFLOW_ID || ""; - const workflowName = process.env.GH_AW_WORKFLOW_NAME || workflowID || "workflow"; - const runUrl = process.env.GH_AW_RUN_URL || currentRun.data.html_url || ""; - const actorLogin = process.env.GITHUB_TRIGGERING_ACTOR || currentRun.data.triggering_actor?.login || currentRun.data.actor?.login || process.env.GITHUB_ACTOR || ""; + const workflowID = process.env.GH_AW_WORKFLOW_ID || ""; + const workflowName = process.env.GH_AW_WORKFLOW_NAME || workflowID || "workflow"; + const runUrl = process.env.GH_AW_RUN_URL || currentRun.data.html_url || ""; + const actorLogin = process.env.GITHUB_TRIGGERING_ACTOR || currentRun.data.triggering_actor?.login || currentRun.data.actor?.login || process.env.GITHUB_ACTOR || ""; - if (!currentRun.data.workflow_id || !actorLogin) { - core.warning("Skipping daily workflow ET guardrail because the current workflow or actor could not be resolved."); - return; - } - - logDailyGuardrail("Resolved current workflow ET guardrail context", { - owner, - repo, - currentRunId: context.runId, - workflowId: currentRun.data.workflow_id, - workflowName, - actorLogin, - threshold, - rateLimitRemaining: rateLimit.remaining, - rateLimitLimit: rateLimit.limit, - }); - const maxInspectableRuns = computeMaxInspectableRuns(rateLimit.remaining); - if (maxInspectableRuns <= 0) { - core.warning(`Skipping daily workflow ET guardrail because the GitHub API rate limit is too low (${rateLimit.remaining} remaining, reserve ${RATE_LIMIT_RESERVE}).`); - return; - } + if (!currentRun.data.workflow_id || !actorLogin) { + core.warning("Skipping daily workflow ET guardrail because the current workflow or actor could not be resolved."); + return; + } - const cutoffMs = Date.now() - DAILY_WORKFLOW_WINDOW_MS; - /** @type {Array<{id:number, html_url:string, created_at:string, conclusion:string}>} */ - const candidateRuns = []; - /** @type {Array} */ - let runs = []; - let page = 1; - let truncatedByRateLimit = false; - while (page <= MAX_WORKFLOW_RUN_PAGES) { - logDailyGuardrail("Querying completed workflow runs", { - workflowId: currentRun.data.workflow_id, - actorLogin, - page, - perPage: 100, - cutoff: new Date(cutoffMs).toISOString(), - }); - const response = await githubClient.rest.actions.listWorkflowRuns({ + logDailyGuardrail("Resolved current workflow ET guardrail context", { owner, repo, - workflow_id: currentRun.data.workflow_id, - actor: actorLogin, - status: "completed", - per_page: 100, - page, - }); - runs = response.data.workflow_runs || []; - logDailyGuardrail("Received workflow runs page", { - page, - runCount: runs.length, - runIds: runs.map(run => run?.id).filter(Boolean), + currentRunId: context.runId, + workflowId: currentRun.data.workflow_id, + workflowName, + actorLogin, + threshold, + rateLimitRemaining: rateLimit.remaining, + rateLimitLimit: rateLimit.limit, }); - if (runs.length === 0) { - break; + const maxInspectableRuns = computeMaxInspectableRuns(rateLimit.remaining); + if (maxInspectableRuns <= 0) { + core.warning(`Skipping daily workflow ET guardrail because the GitHub API rate limit is too low (${rateLimit.remaining} remaining, reserve ${RATE_LIMIT_RESERVE}).`); + return; } - for (const run of runs) { - if (!run || run.id === context.runId) { - continue; + + const cutoffMs = Date.now() - DAILY_WORKFLOW_WINDOW_MS; + /** @type {Array<{id:number, html_url:string, created_at:string, conclusion:string}>} */ + const candidateRuns = []; + /** @type {Array} */ + let runs = []; + let page = 1; + let truncatedByRateLimit = false; + while (page <= MAX_WORKFLOW_RUN_PAGES) { + logDailyGuardrail("Querying completed workflow runs", { + workflowId: currentRun.data.workflow_id, + actorLogin, + page, + perPage: 100, + cutoff: new Date(cutoffMs).toISOString(), + }); + const response = await githubClient.rest.actions.listWorkflowRuns({ + owner, + repo, + workflow_id: currentRun.data.workflow_id, + actor: actorLogin, + status: "completed", + per_page: 100, + page, + }); + runs = response.data.workflow_runs || []; + logDailyGuardrail("Received workflow runs page", { + page, + runCount: runs.length, + runIds: runs.map(run => run?.id).filter(Boolean), + }); + if (runs.length === 0) { + break; } - const createdAtMs = Date.parse(run.created_at || ""); - if (!Number.isFinite(createdAtMs) || createdAtMs < cutoffMs) { - continue; + for (const run of runs) { + if (!run || run.id === context.runId) { + continue; + } + const createdAtMs = Date.parse(run.created_at || ""); + if (!Number.isFinite(createdAtMs) || createdAtMs < cutoffMs) { + continue; + } + candidateRuns.push(run); + if (candidateRuns.length >= maxInspectableRuns) { + truncatedByRateLimit = true; + break; + } } - candidateRuns.push(run); - if (candidateRuns.length >= maxInspectableRuns) { - truncatedByRateLimit = true; + if (candidateRuns.length >= maxInspectableRuns || runs.length < 100) { break; } + page += 1; } - if (candidateRuns.length >= maxInspectableRuns || runs.length < 100) { - break; - } - page += 1; - } - logDailyGuardrail("Prepared candidate workflow runs for artifact inspection", { - candidateRunsCount: candidateRuns.length, - candidateRunIds: candidateRuns.map(run => run.id), - maxInspectableRuns, - truncatedByRateLimit, - }); + logDailyGuardrail("Prepared candidate workflow runs for artifact inspection", { + candidateRunsCount: candidateRuns.length, + candidateRunIds: candidateRuns.map(run => run.id), + maxInspectableRuns, + truncatedByRateLimit, + }); - const artifactClient = await getArtifactClient(); - let totalEffectiveTokens = 0; - /** @type {Array<{id:number, html_url:string, created_at:string, conclusion:string, effective_tokens:number}>} */ - const countedRuns = []; - for (const run of candidateRuns) { - if (countedRuns.length >= maxInspectableRuns) { - truncatedByRateLimit = true; - break; - } - try { - const runEffectiveTokens = await getRunEffectiveTokens(artifactClient, run.id, token, owner, repo); - if (runEffectiveTokens <= 0) { - logDailyGuardrail("Skipping run without ET usage artifact data", { + const artifactClient = await getArtifactClient(); + let totalEffectiveTokens = 0; + /** @type {Array<{id:number, html_url:string, created_at:string, conclusion:string, effective_tokens:number}>} */ + const countedRuns = []; + for (const run of candidateRuns) { + if (countedRuns.length >= maxInspectableRuns) { + truncatedByRateLimit = true; + break; + } + try { + const runEffectiveTokens = await getRunEffectiveTokens(artifactClient, run.id, token, owner, repo); + if (runEffectiveTokens <= 0) { + logDailyGuardrail("Skipping run without ET usage artifact data", { + runId: run.id, + currentEffectiveTokens: totalEffectiveTokens, + threshold, + }); + continue; + } + totalEffectiveTokens += runEffectiveTokens; + countedRuns.push({ + id: run.id, + html_url: run.html_url || "", + created_at: run.created_at || "", + conclusion: run.conclusion || "", + effective_tokens: runEffectiveTokens, + }); + logDailyGuardrail("Updated current ET state", { runId: run.id, + runEffectiveTokens, currentEffectiveTokens: totalEffectiveTokens, threshold, + countedRunIds: countedRuns.map(item => item.id), }); - continue; + } catch (error) { + core.warning(`Failed to inspect token usage for run ${run.id}: ${getErrorMessage(error)}`); } - totalEffectiveTokens += runEffectiveTokens; - countedRuns.push({ - id: run.id, - html_url: run.html_url || "", - created_at: run.created_at || "", - conclusion: run.conclusion || "", - effective_tokens: runEffectiveTokens, - }); - logDailyGuardrail("Updated current ET state", { - runId: run.id, - runEffectiveTokens, - currentEffectiveTokens: totalEffectiveTokens, - threshold, - countedRunIds: countedRuns.map(item => item.id), - }); - } catch (error) { - core.warning(`Failed to inspect token usage for run ${run.id}: ${getErrorMessage(error)}`); } - } - core.setOutput("daily_effective_workflow_total_effective_tokens", String(totalEffectiveTokens)); - core.setOutput("daily_effective_workflow_threshold", String(threshold)); + core.setOutput("daily_effective_workflow_total_effective_tokens", String(totalEffectiveTokens)); + core.setOutput("daily_effective_workflow_threshold", String(threshold)); + + /** @type {{candidateRunsCount:number,inspectedRunsCount:number,truncatedByRateLimit:boolean}} */ + const summaryMeta = { + candidateRunsCount: candidateRuns.length, + inspectedRunsCount: countedRuns.length, + truncatedByRateLimit, + }; + logDailyGuardrail("Completed ET inspection window", { + candidateRunsCount: summaryMeta.candidateRunsCount, + inspectedRunsCount: summaryMeta.inspectedRunsCount, + countedRunIds: countedRuns.map(run => run.id), + currentEffectiveTokens: totalEffectiveTokens, + threshold, + exceeded: totalEffectiveTokens > threshold, + }); - /** @type {{candidateRunsCount:number,inspectedRunsCount:number,truncatedByRateLimit:boolean}} */ - const summaryMeta = { - candidateRunsCount: candidateRuns.length, - inspectedRunsCount: countedRuns.length, - truncatedByRateLimit, - }; - logDailyGuardrail("Completed ET inspection window", { - candidateRunsCount: summaryMeta.candidateRunsCount, - inspectedRunsCount: summaryMeta.inspectedRunsCount, - countedRunIds: countedRuns.map(run => run.id), - currentEffectiveTokens: totalEffectiveTokens, - threshold, - exceeded: totalEffectiveTokens > threshold, - }); + if (totalEffectiveTokens <= threshold) { + await appendDailyEffectiveWorkflowSummary(workflowName, actorLogin, threshold, countedRuns, rateLimit, summaryMeta); + core.info(`Daily workflow ET guardrail not exceeded (${totalEffectiveTokens}/${threshold}).`); + return; + } - if (totalEffectiveTokens <= threshold) { + core.setOutput("daily_effective_workflow_exceeded", "true"); await appendDailyEffectiveWorkflowSummary(workflowName, actorLogin, threshold, countedRuns, rateLimit, summaryMeta); - core.info(`Daily workflow ET guardrail not exceeded (${totalEffectiveTokens}/${threshold}).`); - return; + core.warning(`Daily workflow ET guardrail exceeded for ${workflowName}: ${totalEffectiveTokens}/${threshold}.`); + } catch (error) { + // Treat any unexpected error as a non-blocking skip so the step never fails the + // activation job. The output stays at the default "false", allowing the agent to + // run. The guardrail is effectively bypassed for this invocation. + core.warning(`Daily workflow ET guardrail encountered an unexpected error and will be skipped: ${getErrorMessage(error)}`); } - - core.setOutput("daily_effective_workflow_exceeded", "true"); - await appendDailyEffectiveWorkflowSummary(workflowName, actorLogin, threshold, countedRuns, rateLimit, summaryMeta); - core.warning(`Daily workflow ET guardrail exceeded for ${workflowName}: ${totalEffectiveTokens}/${threshold}.`); } module.exports = { diff --git a/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs b/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs index b85800bd11c..0b6fb218323 100644 --- a/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs +++ b/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs @@ -124,4 +124,56 @@ describe("check_daily_effective_workflow_guardrail", () => { expect(markdown).toContain("Stopped early to preserve GitHub API rate limit headroom"); expect(markdown).not.toContain("Guardrail issue:"); }); + + it("main() does not fail the step when GitHub API calls throw", async () => { + // Simulate a scenario where the GitHub API throws during workflow run lookup. + // The step should catch the error and NOT rethrow it, keeping daily_effective_workflow_exceeded at "false". + const coreOutputs = {}; + const coreWarnings = []; + const mockCore = { + setOutput: (key, value) => { + coreOutputs[key] = value; + }, + info: () => {}, + warning: msg => coreWarnings.push(msg), + }; + + const mockGithub = { + rest: { + rateLimit: { get: async () => { throw new Error("API rate limit exceeded"); } }, + actions: { + getWorkflowRun: async () => { throw new Error("Network error"); }, + listWorkflowRuns: async () => { throw new Error("Unexpected error"); }, + }, + }, + }; + + const mockContext = { + repo: { owner: "test-owner", repo: "test-repo" }, + runId: 42, + }; + + // Inject globals so the module can use them + global.core = mockCore; + global.github = mockGithub; + global.context = mockContext; + + process.env.GH_AW_MAX_DAILY_EFFECTIVE_TOKENS = "1000000"; + process.env.GH_AW_GITHUB_TOKEN = "fake-token"; + + try { + // Should resolve without throwing even though the API calls throw + await expect(exports.main()).resolves.toBeUndefined(); + // The default "false" output must be set + expect(coreOutputs["daily_effective_workflow_exceeded"]).toBe("false"); + // A warning must be emitted describing the error + expect(coreWarnings.some(w => /unexpected error.*skipped/i.test(w))).toBe(true); + } finally { + delete global.core; + delete global.github; + delete global.context; + delete process.env.GH_AW_MAX_DAILY_EFFECTIVE_TOKENS; + delete process.env.GH_AW_GITHUB_TOKEN; + } + }); }); diff --git a/actions/setup/js/handle_agent_failure_daily_effective_workflow.test.cjs b/actions/setup/js/handle_agent_failure_daily_effective_workflow.test.cjs index 9e231e16a51..fdf5c70d3d1 100644 --- a/actions/setup/js/handle_agent_failure_daily_effective_workflow.test.cjs +++ b/actions/setup/js/handle_agent_failure_daily_effective_workflow.test.cjs @@ -25,6 +25,11 @@ describe("handle_agent_failure daily workflow ET context", () => { expect(rendered).toContain("2500"); expect(rendered).toContain("2000"); expect(rendered).not.toContain("Activation Issue:"); + // Progressive disclosure sections + expect(rendered).toContain("How to raise the daily limit"); + expect(rendered).toContain("max-daily-effective-tokens"); + expect(rendered).toContain("What is the daily effective token guardrail"); + expect(rendered).toContain("How to disable this guardrail"); }); it("returns empty string when the guardrail did not trigger", () => { diff --git a/actions/setup/md/agent_failure_comment.md b/actions/setup/md/agent_failure_comment.md index 17571397310..fa8f838e784 100644 --- a/actions/setup/md/agent_failure_comment.md +++ b/actions/setup/md/agent_failure_comment.md @@ -1,3 +1,3 @@ Agent job [{run_id}]({run_url}) failed. -{secret_verification_context}{credential_auth_error_context}{inference_access_error_context}{mcp_policy_error_context}{model_not_supported_error_context}{effective_tokens_rate_limit_error_context}{app_token_minting_failed_context}{lockdown_check_failed_context}{stale_lock_file_failed_context}{assignment_errors_context}{assign_copilot_failure_context}{create_discussion_errors_context}{code_push_failure_context}{repo_memory_validation_context}{push_repo_memory_failure_context}{missing_data_context}{missing_tool_context}{permission_denied_context}{report_incomplete_context}{missing_safe_outputs_context}{engine_failure_context}{timeout_context}{fork_context} +{secret_verification_context}{credential_auth_error_context}{inference_access_error_context}{mcp_policy_error_context}{model_not_supported_error_context}{effective_tokens_rate_limit_error_context}{app_token_minting_failed_context}{lockdown_check_failed_context}{stale_lock_file_failed_context}{daily_effective_workflow_exceeded_context}{assignment_errors_context}{assign_copilot_failure_context}{create_discussion_errors_context}{code_push_failure_context}{repo_memory_validation_context}{push_repo_memory_failure_context}{missing_data_context}{missing_tool_context}{permission_denied_context}{report_incomplete_context}{missing_safe_outputs_context}{engine_failure_context}{timeout_context}{fork_context} diff --git a/actions/setup/md/daily_effective_workflow_exceeded.md b/actions/setup/md/daily_effective_workflow_exceeded.md index 6d192cf57b9..05bd3ecb94d 100644 --- a/actions/setup/md/daily_effective_workflow_exceeded.md +++ b/actions/setup/md/daily_effective_workflow_exceeded.md @@ -1,6 +1,65 @@ -**⚠️ Daily Workflow ET Guardrail Exceeded**: The activation job blocked this workflow because the triggering user already consumed the configured 24-hour effective-token budget for this workflow. +**⚠️ Daily Workflow ET Guardrail Exceeded**: The agent was not started because the triggering user has already consumed the configured 24-hour effective-token budget for this workflow. -- Aggregated 24-hour ET usage: `{total_effective_tokens}` -- Configured threshold: `{threshold}` +- **24h ET usage:** `{total_effective_tokens}` effective tokens +- **Configured threshold:** `{threshold}` effective tokens -Wait for the 24-hour window to age out or raise `max-daily-effective-tokens` in the workflow frontmatter if the higher budget is intentional. +The agent will resume automatically once the 24-hour rolling window resets. No action is required if the current limit is appropriate for your usage. + +
+How to raise the daily limit + +Set `max-daily-effective-tokens` in your workflow frontmatter to a higher value, then recompile: + +```yaml +max-daily-effective-tokens: 5M +``` + +Common suffix shorthands: `K` = thousands, `M` = millions (e.g. `2M` = 2,000,000). + +After editing the workflow source file, regenerate the compiled lock file: + +```bash +gh aw compile +``` + +Commit and push the updated `.lock.yml` file. + +> [!NOTE] +> Raising the limit increases the number of AI inference calls the workflow can make +> per 24-hour window per triggering user. Review your Copilot or model provider billing +> before increasing significantly. + +
+ +
+What is the daily effective token guardrail? + +The `max-daily-effective-tokens` frontmatter option sets a per-user, per-workflow spending cap measured in *effective tokens* — a normalized unit that accounts for the cost of each model call across the 24-hour window before the current run. + +When a triggering user's aggregated effective-token usage across all completed runs of this workflow in the last 24 hours exceeds the threshold, the activation job sets the `daily_effective_workflow_exceeded` output to `true` and the agent job is skipped for that run. The conclusion job still runs and creates this report. + +The guardrail is evaluated at activation time, not retrospectively, so a single very large run that pushes usage over the threshold only blocks *subsequent* runs in the same window — it does not cancel a run that is already in progress. + +
+ +
+How to disable this guardrail + +> [!CAUTION] +> Disabling this guardrail removes the per-user spending cap. Only disable it if you have +> an alternative mechanism for controlling token usage or if the workflow is intentionally +> uncapped. + +Set `max-daily-effective-tokens: -1` in the workflow frontmatter to explicitly disable the guardrail, then recompile: + +```yaml +max-daily-effective-tokens: -1 +``` + +```bash +gh aw compile +``` + +Alternatively, remove the `max-daily-effective-tokens` key entirely to fall back to the enterprise-wide default (if one is configured) or to run with no per-workflow cap. + +
From 7d03622c19513e06bfa2996e50c42d6e03bd98ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Jun 2026 17:21:36 +0000 Subject: [PATCH 2/4] refine: address review feedback on JSDoc and billing note clarity Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../setup/js/check_daily_effective_workflow_guardrail.cjs | 7 +++++++ actions/setup/md/daily_effective_workflow_exceeded.md | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/actions/setup/js/check_daily_effective_workflow_guardrail.cjs b/actions/setup/js/check_daily_effective_workflow_guardrail.cjs index 8f625f99b27..92d664c21b3 100644 --- a/actions/setup/js/check_daily_effective_workflow_guardrail.cjs +++ b/actions/setup/js/check_daily_effective_workflow_guardrail.cjs @@ -276,6 +276,13 @@ async function appendDailyEffectiveWorkflowSummary(workflowName, actorLogin, thr * @returns {Promise} * * Requires github-script globals (`core`, `github`, `context`) provided by setupGlobals(). + * + * Error handling: all GitHub API interactions after the initial guard checks are wrapped + * in a top-level try-catch. Any unexpected error (network failure, permission error, etc.) + * is logged as a warning and the function returns cleanly with `daily_effective_workflow_exceeded` + * left at its default value of `"false"`. This design ensures the step never fails the + * activation job — a guardrail error results in a safe bypass (agent allowed to run) rather + * than a confusing workflow failure that blocks the agent entirely. */ async function main() { core.setOutput("daily_effective_workflow_exceeded", "false"); diff --git a/actions/setup/md/daily_effective_workflow_exceeded.md b/actions/setup/md/daily_effective_workflow_exceeded.md index 05bd3ecb94d..1ac8c8d8f3c 100644 --- a/actions/setup/md/daily_effective_workflow_exceeded.md +++ b/actions/setup/md/daily_effective_workflow_exceeded.md @@ -27,7 +27,8 @@ Commit and push the updated `.lock.yml` file. > [!NOTE] > Raising the limit increases the number of AI inference calls the workflow can make > per 24-hour window per triggering user. Review your Copilot or model provider billing -> before increasing significantly. +> before significantly increasing the threshold (for example, before doubling the current +> value or setting it above 10M tokens).
From 5b8753583ed985b68c57884bf3d89279ed034195 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Jun 2026 18:04:06 +0000 Subject: [PATCH 3/4] Apply remaining changes Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/check_daily_effective_workflow_guardrail.cjs | 1 - 1 file changed, 1 deletion(-) diff --git a/actions/setup/js/check_daily_effective_workflow_guardrail.cjs b/actions/setup/js/check_daily_effective_workflow_guardrail.cjs index 92d664c21b3..5d264e1f4d4 100644 --- a/actions/setup/js/check_daily_effective_workflow_guardrail.cjs +++ b/actions/setup/js/check_daily_effective_workflow_guardrail.cjs @@ -321,7 +321,6 @@ async function main() { const workflowID = process.env.GH_AW_WORKFLOW_ID || ""; const workflowName = process.env.GH_AW_WORKFLOW_NAME || workflowID || "workflow"; - const runUrl = process.env.GH_AW_RUN_URL || currentRun.data.html_url || ""; const actorLogin = process.env.GITHUB_TRIGGERING_ACTOR || currentRun.data.triggering_actor?.login || currentRun.data.actor?.login || process.env.GITHUB_ACTOR || ""; if (!currentRun.data.workflow_id || !actorLogin) { From f7e508b38b9440faac25eddfc3827a72a30fe6ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Jun 2026 18:19:22 +0000 Subject: [PATCH 4/4] fix: format guardrail test for cjs lint Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- ...eck_daily_effective_workflow_guardrail.test.cjs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs b/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs index 0b6fb218323..c86511e80ef 100644 --- a/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs +++ b/actions/setup/js/check_daily_effective_workflow_guardrail.test.cjs @@ -140,10 +140,18 @@ describe("check_daily_effective_workflow_guardrail", () => { const mockGithub = { rest: { - rateLimit: { get: async () => { throw new Error("API rate limit exceeded"); } }, + rateLimit: { + get: async () => { + throw new Error("API rate limit exceeded"); + }, + }, actions: { - getWorkflowRun: async () => { throw new Error("Network error"); }, - listWorkflowRuns: async () => { throw new Error("Unexpected error"); }, + getWorkflowRun: async () => { + throw new Error("Network error"); + }, + listWorkflowRuns: async () => { + throw new Error("Unexpected error"); + }, }, }, };