Skip to content

[Bug] False-Positive Channel Health Failure for MS Teams on Expired Delegated Token #106566

Description

@aniruddhaadak80

Summary / Problem Statement

In extensions/msteams/src/probe.ts, probeMSTeams checks delegated authentication state. If the cached delegated token is expired, the function reports ok: false, marking the channel unhealthy. However, since the MS Teams client automatically refreshes expired tokens on the next API usage, an expired token does not mean the connection is broken, leading to false-positive health failures.

Detailed Technical Context

  • Vulnerable Code Location: extensions/msteams/src/probe.ts
  • Mechanics:
    const isExpired = !isFutureDateTimestampMs(tokens.expiresAt);
    delegatedAuth = {
      ok: !isExpired, // Fails health check if expired
      scopes: tokens.scopes,
      userPrincipalName: tokens.userPrincipalName,
      ...(isExpired ? { error: "token expired (will auto-refresh on next use)" } : {}),
    };
  • This triggers false alerts in the channel monitoring system even if the refresh token is valid.

Impact Analysis

  • Unnecessary alert spam and channel restarts for MS Teams connectors.
  • False positive alarms in monitoring dashboards.

Proposed Solution

  1. Check if the refresh token is present when the access token is expired.
  2. Mark the probe as ok: true if the token is expired but has a valid refresh token.

Affected File References

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions