Skip to content

Deflake vMCP forwarding notification wait - #5941

Merged
JAORMX merged 1 commit into
mainfrom
deflake-vmcp-forwarding-progress
Jul 23, 2026
Merged

Deflake vMCP forwarding notification wait#5941
JAORMX merged 1 commit into
mainfrom
deflake-vmcp-forwarding-progress

Conversation

@JAORMX

@JAORMX JAORMX commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why: TestForwarding_Progress_RealBackend (and its sibling TestForwarding_*_RealBackend tests) flake on CI. waitNotification used a hardcoded 5s deadline while waiting for an async, server-initiated notification relayed backend → vMCP → downstream client. Under the full-suite parallel -race + -coverpkg=./... load on the shared CI runner, that round trip can exceed 5s and the test times out (forwarding_realbackend_integration_test.go:292: timed out waiting for notifications/progress notification) — while it passes in ~30ms locally with no load. Observed failing twice consecutively on an unrelated PR's CI, passing 3/3 locally.

What:

  • Raise waitNotification's deadline from 5s to 15s, with a comment explaining the async/CI-load rationale. It stays under the callers' 20s test context, so a genuine hang still fails cleanly rather than blocking to the context deadline.

Type of change

  • Bug fix

Test plan

  • Unit tests — go test -race -run 'TestForwarding_' ./pkg/vmcp/server/ passes.
  • Linting — task lint reports 0 issues.

Does this introduce a user-facing change?

No. Test-only change.

Special notes for reviewers

  • Surfaced while monitoring an unrelated PR (Send current MCP protocol version in readiness probe #5940, readiness-probe protocol version) whose only red check was this flake. Splitting the fix out here keeps that PR single-scoped; Send current MCP protocol version in readiness probe #5940 will be rebased on top once this lands.
  • The wait channel (notifCh) uses a non-blocking send that drops on a full buffer — not the cause here (the buffer isn't the bottleneck under these tests), so this PR only addresses the timeout. If the tests flake again after this, a follow-up could make the notification capture more robust.

Generated with Claude Code

TestForwarding_Progress_RealBackend (and its sibling forwarding tests)
flaked on CI: waitNotification used a hardcoded 5s deadline for an async,
server-initiated notification relayed backend -> vMCP -> downstream. Under
the full-suite parallel -race load the round trip exceeds 5s and the test
times out, while it passes in milliseconds locally.

Raise the wait deadline to 15s, leaving headroom under the callers' 20s
context so a genuine hang still fails cleanly instead of blocking to the
context deadline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.76%. Comparing base (3441e75) to head (2dc5536).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5941      +/-   ##
==========================================
- Coverage   71.81%   71.76%   -0.06%     
==========================================
  Files         705      705              
  Lines       72164    72164              
==========================================
- Hits        51828    51790      -38     
- Misses      16621    16673      +52     
+ Partials     3715     3701      -14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JAORMX
JAORMX merged commit 4529806 into main Jul 23, 2026
79 of 80 checks passed
@JAORMX
JAORMX deleted the deflake-vmcp-forwarding-progress branch July 23, 2026 13:19
JAORMX added a commit that referenced this pull request Jul 24, 2026
TestForwarding_*_RealBackend intermittently timed out on CI waiting for a
forwarded, server-initiated notification. waitNotification used a hardcoded
time.After deadline (5s originally, 15s after #5941) that sat inside the
per-test context: a timer shorter than the context flaked under the
full-suite parallel -race load (the async backend -> vMCP -> downstream
relay can take many seconds), while a longer one would mask a genuine hang.

Collapse the two deadlines into one: waitNotification now selects on the
caller's ctx.Done() instead of its own timer, and every real-backend
forwarding test shares a single, generous forwardingRealBackendTimeout
(60s) — well under the 10m go-test global timeout, so a real hang still
fails fast with a clear ctx error. notifCh stays buffered at 8; each test
emits and reads a single notification, so drop-on-full is not a factor.

Verified with `go test -race -count=5 -run TestForwarding_ ./pkg/vmcp/server/`.

Closes #5962.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants