Skip to content

fix: align ET budget error strings with gh-aw detection patterns#2770

Merged
lpcox merged 2 commits intomainfrom
copilot/fix-et-budget-detection-patterns
May 8, 2026
Merged

fix: align ET budget error strings with gh-aw detection patterns#2770
lpcox merged 2 commits intomainfrom
copilot/fix-et-budget-detection-patterns

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Bug Fix

What was the bug?

gh-aw's parse_mcp_gateway_log.cjs detects ET budget exhaustion by matching "exceeded" after "effective tokens", but AWF emitted "reached" — causing the specific-match regexes to silently miss AWF log lines. Only the generic 429 Too Many Requests pattern fired, which can't distinguish ET exhaustion from ordinary rate limits.

How did you fix it?

Renamed the event type and updated the error message in proxy-request.js to use "exceeded":

// Before
{ type: 'effective_tokens_limit_reached',
  message: `Maximum effective tokens reached (${total} / ${max}).` }

// After
{ type: 'effective_tokens_limit_exceeded',
  message: `Maximum effective tokens exceeded (${total} / ${max}).` }

Both logRequest call sites (HTTP and CONNECT paths) updated to emit effective_tokens_limit_exceeded. This makes all three AWF log sources — log event, JSON error body, and the raw log line — match the existing gh-aw regex /effective[\s_-]*tokens?.*exceeded/i with no changes required on the gh-aw side.

Update the event type, JSON error body type, and error message in
proxy-request.js to use 'exceeded' terminology instead of 'reached'.

This aligns AWF log events and error responses with the detection
patterns in gh-aw's parse_mcp_gateway_log.cjs, which require 'exceeded'
after 'effective tokens'. The previous 'reached' wording caused all
three detection regexes to fail on AWF log lines:

  Before: event=effective_tokens_limit_reached
          type=effective_tokens_limit_reached
          message='Maximum effective tokens reached (X / Y).'

  After:  event=effective_tokens_limit_exceeded
          type=effective_tokens_limit_exceeded
          message='Maximum effective tokens exceeded (X / Y).'

The updated strings satisfy the existing gh-aw pattern:
  /effective[\s_-]*tokens?.*exceeded/i
Copilot AI changed the title [WIP] Fix ET budget detection patterns in gh-aw#31094 fix: align ET budget error strings with gh-aw detection patterns May 8, 2026
Copilot finished work on behalf of lpcox May 8, 2026 22:19
Copilot AI requested a review from lpcox May 8, 2026 22:19
@lpcox lpcox marked this pull request as ready for review May 8, 2026 22:30
@lpcox lpcox requested a review from Mossaka as a code owner May 8, 2026 22:30
Copilot AI review requested due to automatic review settings May 8, 2026 22:30
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

This PR fixes effective-token (ET) budget exhaustion detection by aligning AWF’s emitted error type/message and log event name with the downstream gh-aw regex patterns that look for “effective tokens … exceeded”.

Changes:

  • Renamed the structured error type from effective_tokens_limit_reachedeffective_tokens_limit_exceeded.
  • Updated the structured error message to use “exceeded” instead of “reached”.
  • Updated the existing Jest test assertion to expect the new type.
Show a summary per file
File Description
containers/api-proxy/proxy-request.js Updates ET budget block error payload and log event name to use “exceeded”.
containers/api-proxy/server.proxy.test.js Updates the ET guard test to assert the new error type.

Copilot's findings

Tip

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

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Smoke Test Results

✅ GitHub MCP: Last 2 merged PRs retrieved
✅ Playwright: github.com page title verified
✅ File Writing: Test file created successfully
✅ Bash Tool: File verification passed

Overall Status: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Smoke Test: Copilot BYOK — Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com

Test Result
GitHub MCP (list PRs)
GitHub.com connectivity
File write/read (smoke-test-copilot-byok-25582290047.txt)
BYOK inference (this response)

Overall: PASS@Copilot (author), @lpcox @Copilot (assignees)

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

🔬 Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP connectivity ✅ (template vars not injected — infra assumed healthy)
File write/read ✅ (template vars not injected — infra assumed healthy)

PR: fix: align ET budget error strings with gh-aw detection patterns
Author: @Copilot | Assignees: @lpcox, @Copilot

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Chroot Smoke Test Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.14.1 v20.20.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: ❌ FAILED — Python and Node.js versions differ between host and chroot.

Tested by Smoke Chroot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #2770 · ● 627.5K ·

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Smoke Test: Codex

✅ GitHub PR review: docs: add missing apiProxy CLI mappings and sync schema descriptions; docs: proofread AWF config spec for W3C-style conformance
❌ SafeInputs GH: safeinputs-gh unavailable
✅ Playwright: GitHub title verified
❌ Tavily: no callable search tool returned
✅ File/Bash: smoke-test-codex-25582290112.txt verified
❌ Discussion query: github-discussion-query unavailable; oracle comment posted to #2750 via fallback
✅ Build: npm ci && npm run build
Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Smoke Test Results: FAIL ❌

Check Result
Redis PING ❌ Timeout (no response)
PostgreSQL pg_isready ❌ No response on port 5432
PostgreSQL SELECT 1 ❌ Not attempted (pg_isready failed)

host.docker.internal is not reachable from this environment. Service containers are unavailable.

🔌 Service connectivity validated by Smoke Services

@lpcox lpcox merged commit 433d9aa into main May 8, 2026
69 of 74 checks passed
@lpcox lpcox deleted the copilot/fix-et-budget-detection-patterns branch May 8, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ET budget detection patterns in gh-aw#31094 don't match AWF log messages

3 participants