Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: infer MCP tool-call status from level/error when status field is absent#34061

Merged
pelikhan merged 5 commits into
mainfrom
copilot/deep-report-fix-telemetry-capture
May 22, 2026
Merged

fix: infer MCP tool-call status from level/error when status field is absent#34061
pelikhan merged 5 commits into
mainfrom
copilot/deep-report-fix-telemetry-capture

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

Post-OTel-collector migration, gateway.jsonl entries stopped emitting an explicit "status" string field. The parser blindly copied entry.Status (empty "") into MCPToolCall.Status, which downstream aggregators rendered as "unknown" — breaking error-rate, cost-per-tool, and retry analytics for all 165+ tool calls in the audit.

Changes

pkg/cli/gateway_logs_mcp.goextractToolCallsFromGatewayLog

  • When entry.Status == "", infer "error" if entry.Error != "" or entry.Level == "error", otherwise default to "success":
status := entry.Status
if status == "" {
    if entry.Error != "" || entry.Level == "error" {
        status = "error"
    } else {
        status = "success"
    }
}

pkg/cli/gateway_logs_parsing.goprocessGatewayLogEntry

  • Extend error-tracking predicate to include entry.Level == "error" so TotalErrors/ErrorCount fields aren't under-counted for the new log format:
// before
if entry.Status == "error" || entry.Error != "" {
// after
if entry.Status == "error" || entry.Error != "" || entry.Level == "error" {

Tests

  • TestExtractToolCallsStatusInference: 5 sub-cases — explicit status pass-through, level:"error" inference, error field inference, and level:"info" → success default.
  • TestProcessGatewayLogEntryLevelErrorCounting: verifies error counters increment when only level:"error" is present.

Copilot AI changed the title [WIP] Fix MCP tool-call status=unknown in workflow audit telemetry capture fix: infer MCP tool-call status from level/error when status field is absent May 22, 2026
Copilot AI requested a review from pelikhan May 22, 2026 16:33
@pelikhan pelikhan marked this pull request as ready for review May 22, 2026 17:30
Copilot AI review requested due to automatic review settings May 22, 2026 17: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 updates the MCP gateway log parser to handle post-OTel format drift where gateway.jsonl tool-call entries may omit the "status" field, ensuring tool-call status and error metrics are still computed correctly.

Changes:

  • Infer MCPToolCall.Status as "error" when level:"error" or error is present, otherwise default to "success" when status is absent.
  • Count log entries as errors when level:"error" is present (to avoid under-counting errors with missing status/error fields).
  • Add unit tests covering status inference and level-based error counting.
  • Update GitHub Actions lock/workflow files (includes a schedule change for the developer-docs consolidator workflow).
Show a summary per file
File Description
pkg/cli/gateway_logs_mcp.go Infer per-tool-call status when status is missing.
pkg/cli/gateway_logs_parsing.go Treat level:"error" entries as errors for metrics counting.
pkg/cli/gateway_logs_test.go Add tests for status inference and level-based error counting.
.github/workflows/release.lock.yml Update pinned docker/setup-buildx-action reference.
.github/workflows/developer-docs-consolidator.lock.yml Change schedule to weekly and update lock content.
.github/aw/actions-lock.json Add lock entry for docker/setup-buildx-action@v4.

Copilot's findings

Tip

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

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

Comment on lines +166 to 169
if entry.Status == "error" || entry.Error != "" || entry.Level == "error" {
metrics.TotalErrors++
if entry.ServerName != "" {
server := getOrCreateServer(metrics, entry.ServerName)
Comment on lines 69 to +71
schedule:
- cron: "19 13 * * *"
# Friendly format: daily (scattered)
- cron: "19 13 * * 6"
# Friendly format: weekly (scattered)
@pelikhan pelikhan merged commit 6650c68 into main May 22, 2026
23 checks passed
@pelikhan pelikhan deleted the copilot/deep-report-fix-telemetry-capture branch May 22, 2026 17: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.

[deep-report] Fix MCP tool-call status=unknown telemetry capture in workflow audit

3 participants