Skip to content

Count empty fallback failures once in Docs MCP agent metrics #1620

Closed

Description

@betegon

One failed runTailorAgent invocation is counted twice when fallback synthesis also returns empty text. The empty-output branch calls trackAgentCall(false) and throws; the enclosing catch calls it again.

Reproduced with the actual installed agent/provider code and mocked empty completions. The Sentry metric callback captured two docs_mcp.agent.call increments with success=false for one invocation. This overstates invocation/failure counts and distorts success-rate monitoring on that path.

The behavior is inherited from the original Worker. Keep this correction separate from the port PR #1597.

Follow-up scope:

  • Let the existing catch record the failure once while preserving the thrown error.
  • Verify exactly one invocation outcome for primary success, fallback success, empty fallback output and generation errors.
  • Retain the separate fallback-attempt and token metrics.

Activity

  1. added
    bug
    MCP
    on Oct 23, 2026
  2. linear-code commented on Oct 23, 2026

    @linear-code
  3. added a commit that references this issue on Oct 24, 2026
    13e3c3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MCPbug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions