Skip to content

Align ET budget failure diagnostics with firewall-compiled ET totals#31201

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-q-workflow-failure
May 9, 2026
Merged

Align ET budget failure diagnostics with firewall-compiled ET totals#31201
pelikhan merged 3 commits into
mainfrom
copilot/fix-q-workflow-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

Bug Fix

What was the bug?

Q was reported as ET-budget exhausted (12.2M / 10M) even when firewall-compiled ET state showed usage below budget. The failure path used recomputed ET from token usage/env and could drift from firewall ET compilation, producing false budget-exhaustion diagnostics.

How did you fix it?

  • ET source precedence aligned to firewall state
    • Updated resolveEffectiveTokensFailureState() to resolve ET values in this order:
      1. audit log ET fields
      2. firewall reflect ET fields (sandbox/firewall/awf-reflect.json)
      3. env fallbacks
  • Reflect-file ET parsing added
    • Added parsing of:
      • effective_tokens.total_effective_tokens
      • effective_tokens.max_effective_tokens
    • Normalized parsed values to positive integer strings for consistent comparison logic.
  • Regression coverage for mismatch scenario
    • Added a focused test that reproduces the mismatch case (high env ET + lower firewall ET total) and verifies ET budget exhaustion is suppressed when firewall totals are below max.
const effectiveTokens =
  audit.effectiveTokens ||
  reflect.effectiveTokens ||
  envEffectiveTokens ||
  "";

const maxEffectiveTokens =
  parseMaxEffectiveTokensFromAuditLog() ||
  reflect.maxEffectiveTokens ||
  envMaxEffectiveTokens ||
  "";

Copilot AI linked an issue May 9, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 9, 2026 11:58
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix workflow failure for Q due to token budget exhaustion Align ET budget failure diagnostics with firewall-compiled ET totals May 9, 2026
Copilot AI requested a review from pelikhan May 9, 2026 12:07
@pelikhan pelikhan marked this pull request as ready for review May 9, 2026 12:35
Copilot AI review requested due to automatic review settings May 9, 2026 12:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes misleading “ET budget exhausted” diagnostics by aligning effective-token totals used in the failure path with the AWF firewall-compiled ET state (via awf-reflect.json) rather than potentially-drifting env-derived recomputation.

Changes:

  • Add parsing of effective_tokens.total_effective_tokens and effective_tokens.max_effective_tokens from the firewall reflect file and use it as a fallback source between audit log values and env fallbacks.
  • Update ET failure-state resolution precedence to prefer audit log → reflect file → env.
  • Add a regression test covering the “high env ET, lower firewall reflect ET” mismatch scenario.
Show a summary per file
File Description
actions/setup/js/effective_tokens_context.cjs Adds reflect-file parsing and updates ET source precedence in resolveEffectiveTokensFailureState().
actions/setup/js/handle_agent_failure.test.cjs Adds regression coverage ensuring firewall reflect ET totals suppress false budget-exhaustion signals.
.github/workflows/daily-news.lock.yml Regenerates the Daily News lock workflow with multiple version/step/env updates.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment on lines 66 to +118
@@ -86,6 +86,7 @@ run-name: "Daily News"
env:
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.GH_AW_OTEL_ENDPOINT }}
OTEL_SERVICE_NAME: gh-aw
COPILOT_OTEL_FILE_EXPORTER_PATH: /tmp/gh-aw/copilot-otel.jsonl
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.GH_AW_OTEL_HEADERS }}
GH_AW_OTLP_ENDPOINTS: '[{"url":"${{ secrets.GH_AW_OTEL_ENDPOINT }}","headers":"${{ secrets.GH_AW_OTEL_HEADERS }}"}]'

@@ -105,16 +106,23 @@ jobs:
setup-trace-id: ${{ steps.setup.outputs.trace-id }}
stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}
steps:
- name: Checkout actions folder
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: github/gh-aw
sparse-checkout: |
actions
persist-credentials: false
- name: Setup Scripts
id: setup
uses: github/gh-aw-actions/setup@v0.71.5
uses: ./actions/setup
Comment on lines +646 to +648
run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh"
- name: Download container images
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.40@sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.40@sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280 ghcr.io/github/gh-aw-firewall/squid:0.25.40@sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51 ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959 node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.42 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.42 ghcr.io/github/gh-aw-firewall/squid:0.25.42 ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959 node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f
@pelikhan pelikhan merged commit 9799538 into main May 9, 2026
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-q-workflow-failure branch May 9, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw] Q failed

3 participants