Skip to content

Flaky: TestForwarding_*_RealBackend time out waiting for forwarded notifications under CI load #5962

Closed

Description

@JAORMX

Summary

The real-backend forwarding integration tests in pkg/vmcp/server/forwarding_realbackend_integration_test.go intermittently fail on CI with a timeout waiting for a forwarded, server-initiated notification. They pass reliably (in milliseconds) locally, but under the full-suite parallel -race + -coverpkg=./... load on the shared CI runner the round trip occasionally exceeds the test's fixed wait deadline.

Symptom

forwarding_realbackend_integration_test.go:326: timed out waiting for notifications/message notification

(analogous failures for notifications/progress, etc.)

Affected tests

All use the shared downstreamClient.waitNotification helper, which relies on a hardcoded time.After(...) deadline:

  • TestForwarding_Progress_RealBackend — waits for notifications/progress
  • TestForwarding_Logging_RealBackend — waits for notifications/message
  • (same helper is used by the Elicitation/Sampling variants)

Root cause

waitNotification (forwarding_realbackend_integration_test.go:206) blocks on a fixed deadline for an async, server-initiated notification relayed backend → vMCP → downstream client. Under CI's parallel -race load that relay can take several seconds; when it exceeds the deadline the test fails.

A likely contributing factor (noted in #5941): notifCh is filled by a non-blocking send that drops on a full buffer, so a slow consumer can miss a notification entirely rather than merely wait longer.

Impact

Intermittent red on the required Tests / Test Go Code check, which blocks unrelated PRs and forces re-runs.

Suggested fixes (pick one / combine)

  1. Wait until the caller's context deadline instead of a separate hardcoded time.After: the callers already use a 20s context.WithTimeout, so waitNotification should select on ctx.Done() rather than an independent (shorter) timer — one source of truth, and it fails cleanly when the context actually expires.
  2. Raise both the per-test context and the wait deadline generously (e.g. 60s) — real-backend integration tests are inherently slower under -race.
  3. Make the notification capture robust: give notifCh enough buffer (or drain it in a goroutine) so a transient slow consumer cannot drop a notification via the non-blocking send.

References

Generated with Claude Code

Activity

  1. added
    needs-triage
    on Jul 24, 2026
  2. added a commit that references this issue on Jul 25, 2026
    bd855dd
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

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions