Skip to content

fix: handle auth errors gracefully in MCP Gateway Log Analyzer#4878

Merged
lpcox merged 2 commits intomainfrom
copilot/debug-mcp-gateway-log-analyzer
Apr 30, 2026
Merged

fix: handle auth errors gracefully in MCP Gateway Log Analyzer#4878
lpcox merged 2 commits intomainfrom
copilot/debug-mcp-gateway-log-analyzer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

The Log Analyzer agent was calling report_incomplete on 401 Bad Credentials errors from github/gh-aw, causing the conclusion job to create a spurious failure issue on every run where GH_AW_MCP_MULTIREPO_TOKEN lacks access to that repo.

Changes

  • Step 0: Pre-flight Access Check — agent now probes github/gh-aw access with a single lightweight API call before doing any analysis work; fails fast with the right signals rather than discovering the auth error mid-task
  • Auth error handling — on 401/403/404, agent emits missing_data (records what was unavailable and why) then noop (completes gracefully); explicitly forbidden from using report_incomplete for auth failures
  • Guidelines update — new "Access and Authentication Errors" section clarifies the distinction: report_incomplete is reserved for genuine analysis failures, not expired/misconfigured tokens

The lock.yml is untouched — its frontmatter hash remains valid because only the .md body changes, which is imported at runtime via {{#runtime-import}}.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /tmp/go-build183694268/b513/launcher.test /tmp/go-build183694268/b513/launcher.test -test.testlogfile=/tmp/go-build183694268/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W .cfg 9654054/b314/ x_amd64/vet . --gdwarf2 --64 x_amd64/vet 9654�� .cfg ache/go/1.25.9/x-ifaceassert x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet (dns block)
  • invalid-host-that-does-not-exist-12345.com
    • Triggering command: /tmp/go-build183694268/b495/config.test /tmp/go-build183694268/b495/config.test -test.testlogfile=/tmp/go-build183694268/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build183694268/b393/vet.cfg 1.80.0/resolver/dns/dns_resolver.go aw-mcpg/internal/difc/capabilities.go x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet --de�� g_.a --debug-prefix-m-ifaceassert x_amd64/vet -I gzip -I x_amd64/vet (dns block)
  • nonexistent.local
    • Triggering command: /tmp/go-build183694268/b513/launcher.test /tmp/go-build183694268/b513/launcher.test -test.testlogfile=/tmp/go-build183694268/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W .cfg 9654054/b314/ x_amd64/vet . --gdwarf2 --64 x_amd64/vet 9654�� .cfg ache/go/1.25.9/x-ifaceassert x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet (dns block)
  • slow.example.com
    • Triggering command: /tmp/go-build183694268/b513/launcher.test /tmp/go-build183694268/b513/launcher.test -test.testlogfile=/tmp/go-build183694268/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W .cfg 9654054/b314/ x_amd64/vet . --gdwarf2 --64 x_amd64/vet 9654�� .cfg ache/go/1.25.9/x-ifaceassert x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet (dns block)
  • this-host-does-not-exist-12345.com
    • Triggering command: /tmp/go-build183694268/b522/mcp.test /tmp/go-build183694268/b522/mcp.test -test.testlogfile=/tmp/go-build183694268/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s -I .cfg vi4A/zemEcZckQEXwB9lkvi4A x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet .cfg�� 9654054/b395/_pkg_.a ache/go/1.25.9/x64/src/database/sql/driver/driver.go x_amd64/vet --gdwarf-5 g/grpc/balancer/--version -o x_amd64/vet (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 30, 2026 that may be closed by this pull request
When GH_AW_MCP_MULTIREPO_TOKEN does not have access to github/gh-aw,
the agent was calling report_incomplete which triggered creation of a
failure issue. Fix by:

- Adding Step 0 Pre-flight Access Check that tests repo access early
- Instructing agent to use missing_data + noop (not report_incomplete)
  when it encounters 401/403/404 errors on github/gh-aw
- Adding "Access and Authentication Errors" section to guidelines
  reinforcing that auth failures are config issues, not analysis failures

Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/7e198272-aed2-4c77-8d0a-2d2389e005c5

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Debug MCP Gateway Log Analyzer workflow failure fix: handle auth errors gracefully in MCP Gateway Log Analyzer Apr 30, 2026
Copilot AI requested a review from lpcox April 30, 2026 14:06
@lpcox lpcox marked this pull request as ready for review April 30, 2026 14:46
Copilot AI review requested due to automatic review settings April 30, 2026 14:46
@lpcox lpcox merged commit 35fbe98 into main Apr 30, 2026
16 checks passed
@lpcox lpcox deleted the copilot/debug-mcp-gateway-log-analyzer branch April 30, 2026 14:47
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

Updates the MCP Gateway Log Analyzer workflow guidance to avoid treating GitHub access/auth failures (e.g., missing GH_AW_MCP_MULTIREPO_TOKEN access to github/gh-aw) as analysis failures, so the automation exits gracefully instead of generating spurious failure issues.

Changes:

  • Adds a Step 0 pre-flight repo access check using a lightweight list_workflow_runs probe.
  • Specifies new handling for 401/403/404 by emitting missing_data then noop (and explicitly forbids report_incomplete for auth failures).
  • Adds an “Access and Authentication Errors” guidelines section to clarify correct signaling.
Show a summary per file
File Description
.github/workflows/mcp-gateway-log-analyzer.md Adds pre-flight access check + updated guidance for auth/permission failures using missing_data + noop.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

- **DO NOT use `report_incomplete`** — authentication failures are a configuration issue, not an analysis failure.
- Emit `missing_data` with:
- `data_type`: `workflow_runs`
- `reason`: `Authentication failed (401 Bad credentials): GH_AW_MCP_MULTIREPO_TOKEN does not have access to github/gh-aw. The token may be expired or missing the required repository permissions (actions:read).`
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

The suggested missing_data.reason value for the 401 case is much longer than this workflow’s Safe Outputs validation allows (reason maxLength is 256). If the agent emits this verbatim, the safe-outputs handler will reject the output and can cause the run to fail (undoing the goal of graceful auth handling). Please shorten reason to <=256 characters and move the longer explanation into the noop.message (or keep extra detail in context).

Suggested change
- `reason`: `Authentication failed (401 Bad credentials): GH_AW_MCP_MULTIREPO_TOKEN does not have access to github/gh-aw. The token may be expired or missing the required repository permissions (actions:read).`
- `reason`: `Authentication failed (401 Bad credentials): token cannot access github/gh-aw.`

Copilot uses AI. Check for mistakes.
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] MCP Gateway Log Analyzer failed

3 participants