Skip to content

Flaky integration test: inspectorClient-timeout-diagnostics 'emits connectionDiagnosticsChange' reads an undefined GET log entry #2580

Closed

Description

@cliffhall

Problem

clients/web/src/test/integration/mcp/inspectorClient-timeout-diagnostics.test.ts > InspectorClient request-timeout diagnostics (#2318) > emits connectionDiagnosticsChange as the state moves, and counts stream events fails intermittently:

TypeError: Cannot read properties of undefined (reading 'timestamp')
 ❯ inspectorClient-timeout-diagnostics.test.ts:279:24
    277|         .find((entry) => entry.method === "GET")!;
    278|       expect(stream.openedAt).toBe(
    279|         getEntryAtOpen.timestamp.getTime() + (getEntryAtOpen.duration …

Reproduce

On current v2/main (9393237), running the file alone fails roughly 2 runs in 3 on a loaded machine:

cd clients/web
for i in 1 2 3; do npx vitest run --project integration src/test/integration/mcp/inspectorClient-timeout-diagnostics.test.ts; done

It also went red in a full npm run local:gate for an unrelated TUI-only change (#2436).

Likely cause (unverified)

The FetchRequestLogState is constructed after connectTo(...) resolves, so the notification-stream GET can be dispatched/logged before the log subscribes; find(... method === "GET")! then returns undefined and the non-null assertion hides it. Constructing the log before connecting, or waiting on the GET entry rather than asserting it, should make it deterministic (per #1596: fix with an awaited condition, never headroom).

Expected

The test passes deterministically.

Activity

  1. added this to the v2.10.0 milestone on Oct 5, 2026
  2. added
    bugSomething isn't working
    v2Issues and PRs for v2
    on Oct 5, 2026
  3. self-assigned this
    on Oct 7, 2026
  4. cliffhall commented on Oct 7, 2026

    @cliffhall
    MemberAuthor

    Shipped in #2612 (merged to v2/main).

  5. added a commit that references this issue on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv2Issues and PRs for v2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions