Skip to content

Flaky: optimizer search-quality E2E spec is blocking unrelated PRs #6026

Open

Description

@JAORMX

Summary

VirtualMCPServer Optimizer Multi-Backend [It] should return semantically relevant results (search quality) (test/e2e/thv-operator/virtualmcp/virtualmcp_optimizer_multibackend_test.go:304) fails nondeterministically and is currently failing E2E Test Lifecycle on PRs whose diffs cannot possibly affect it.

Observed today: 4 failures in 5 runs, across three unrelated branches — two comment-only changes (#6017, #6025) and one test-only change (#6021). On one commit (17598b9b) it failed, was re-run, and failed again, while the other two kind versions passed the identical commit.

Why it is hard to recognise

Three things conspire to make this look like infrastructure rather than a test:

  1. The job exits with a bare exit code 201 and no test-level annotation, so the GitHub check surface shows nothing actionable. 201 is Ginkgo's interrupted exit code, not a test-failure code.
  2. Three failures are reported, but only one is real. The other two are [INTERRUPTED] collateral from Ginkgo aborting sibling parallel processes:
    [FAIL]        Optimizer Multi-Backend [It] should return semantically relevant results (search quality)
    [INTERRUPTED] Yardstick Base ... should discover a new backend when added to the group
    [INTERRUPTED] Redis-Backed Session Sharing ... [BeforeAll] cross-pod restore
    Ran 142 of 142 Specs — 139 Passed | 3 Failed
    FAIL! - Interrupted by Other Ginkgo Process
    
    Chasing either interrupted spec is a dead end.
  3. Because the two interrupted specs differ run to run, the failure looks like it moves around.

Why the spec is fragile

It asserts semantic ranking: for each of four natural-language queries, find_tool must return a tool whose name contains an expected substring.

{query: "repeat or echo back a message",                     expectMatch: "echo",         backend: "yardstick"},
{query: "retrieve content from a web page or URL",           expectMatch: "fetch",        backend: "gofetch"},
{query: "check security vulnerabilities in open source packages", expectMatch: "vulnerability", backend: "osv"},
{query: "create a pull request on a code repository",        expectMatch: "pull_request", backend: "github"},

That runs against a corpus aggregated from 11 backends (backend1Name…backend11Name: yardstick, fetch, osv, github, terraform, playwright, puppeteer, memory, everything, ida-pro-mcp, pagerduty). The assertion therefore depends on embedding similarity and top-N truncation across hundreds of competing tools — whether the expected tool lands inside the returned window is not a deterministic property. It is additionally timing-sensitive: which backends have completed discovery when the query runs changes the corpus size and therefore the ranking.

So this is asserting a quality property with a correctness assertion.

Unexplained: all four failures were on kindest/node:v1.34.3

Every failure landed on v1.34.3; v1.33.7 and v1.35.1 have not failed once today, including on the same commits. I have no mechanism to offer for that — each version runs in its own job on its own runner, and the suite is identical. With n=4 it may be coincidence, or it may point at resource contention affecting the embedding container on that job. Flagging it as an observation rather than a diagnosis; worth checking whether it holds over a larger sample.

Suggested directions

Not prescribing a fix, since the right call depends on what the spec is meant to guarantee:

  • Assert a weaker, deterministic property — e.g. that results are non-empty and drawn from the expected backend, rather than that a specific tool name ranks in the window.
  • Shrink the corpus for this spec — run search-quality against a small, fixed backend set where ranking is stable, and leave the 11-backend configuration to the specs that are actually about multi-backend aggregation.
  • Mark it as a quality signal, not a gate — if the assertion is inherently probabilistic, it may belong outside the merge-blocking suite.
  • Independently: the exit code 201 opacity is worth addressing so a Ginkgo interruption surfaces the originating failure in the check annotation. That would have saved most of the investigation here.

Evidence

Branch / commit Diff v1.33.7 v1.34.3 v1.35.1
#6017 2d2130bb comment-only — ❌ —
#6017 a1633208 comment-only ✅ ✅ ✅
#6025 17598b9b attempt 1 comment-only ✅ ❌ ✅
#6025 17598b9b attempt 2 (re-run) comment-only ✅ ❌ ✅
#6021 cacddf33 test-only ✅ ❌ ✅

Generated with Claude Code

Activity

  1. added
    needs-triage
    on Jul 27, 2026
  2. JAORMX commented on Jul 27, 2026

    @JAORMX
    CollaboratorAuthor

    Correction: the v1.34.3 correlation does not hold

    The issue above records four failures, all on kindest/node:v1.34.3, and flags the correlation as unexplained. A fifth data point breaks it: on #6030 (4a273ce7), E2E Test Lifecycle (kindest/node:v1.33.7) failed while v1.34.3 passed.

    Updated tally:

    Branch / commit Diff v1.33.7 v1.34.3 v1.35.1
    #6017 2d2130bb comment-only — ❌ —
    #6017 a1633208 comment-only ✅ ✅ ✅
    #6025 17598b9b attempt 1 comment-only ✅ ❌ ✅
    #6025 17598b9b attempt 2 comment-only ✅ ❌ ✅
    #6025 17598b9b attempt 3 comment-only ✅ ✅ ✅
    #6021 cacddf33 attempt 1 test-only ✅ ❌ ✅
    #6021 cacddf33 attempt 2 test-only ✅ ✅ ✅
    #6030 4a273ce7 test-only ❌ ✅ ✅

    So the flake is not version-specific — it just happened to land on v1.34.3 the first four times. Treat the version column as noise and don't go looking for a v1.34.3-specific cause; the nondeterministic search-quality spec described above is the whole explanation. Anyone using that correlation as a starting point would be chasing an artefact of a small sample, which is why I'm correcting it rather than leaving it to be discovered.

    The rest of the diagnosis is unaffected and if anything strengthened: a single spec asserting embedding-ranked relevance over an 11-backend corpus will fail on whichever job happens to draw the unlucky ranking, and the exit code 201 Ginkgo-interrupted signature makes every occurrence look identical and content-free regardless of which job it hits.

    Also worth noting for the same reader: Helm Charts / Lint and Test Helm Charts failed on that same run for an unrelated reason — curl: (35) Recv failure: Connection reset by peer while helm/kind-action downloaded the kind binary, after helm-docs, ct lint and all 66 helm unittest tests had passed. Two independent infrastructure failures on one run is a useful reminder that a red check on this repo needs its log read before it is attributed to a diff.

  3. 01men commented on Oct 23, 2026

    @01men

    The version correlation correction is the right call, and it generalises: any 4-sample correlation on a nondeterministic spec is going to look causal about a third of the time. I want to add one dimension the thread hasn't covered, because I've run into the same shape and the fix I'd reach for first isn't on the suggested-directions list.

    The spec isn't just asserting the wrong category — it's asserting a category that has no stable pass/fail boundary at all.

    "Correctness" assertions fail when a boolean flips. "Quality" assertions decay continuously: today the expected tool ranks 1st of 200, next month it ranks 40th because someone added a backend with 300 similar tools, and nothing broke. A binary gate over a continuous quantity will always eventually be red or always eventually be useless — the only question is which comes first.

    So "mark it as a quality signal, not a gate" is correct, but the hard part is that a signal nobody reads is also useless. Here's the shape that worked for us, offered as one option rather than a prescription:

    1. Move it out of the merge path, but keep it on every commit — with a recorded number, not a boolean.

    Instead of expectMatch substring matching, record the rank of the expected tool (and the corpus size at query time) and assert only that the metric is reported. Then publish the series. A rank that drifts from 2 → 8 over three weeks is visible and actionable; the same drift expressed as pass/fail is invisible until it flips and then looks like a sudden regression.

    You already have the pieces for this: the spec knows the backend set, so corpus size is derivable, and rank is strictly more informative than "was it in the window."

    2. If you want a gate anyway, gate the variance, not the value.

    A flaky quality spec is telling you something real: the ranking is unstable for this corpus. So assert stability across repeated queries within one run — e.g. run the same four queries 5 times and require the returned top-1 to be identical. Deterministic corpora produce stable embeddings; if they don't, that's a genuine finding about the embedding container or the corpus, and it fails deterministically for a real reason instead of randomly for an unexplained one.

    That also explains your v1.34.3 observation better than the version does: resource contention on one job is exactly the mechanism that would make repeated rankings disagree with themselves. A stability assertion surfaces it as "the same query returned two different orderings" — a diagnosis — rather than as an interrupted Ginkgo run.

    3. Bound the quarantine so it can't become permanent.

    Whichever route you take, the practical risk is that the spec gets skipped and nobody comes back. Two constraints I'd attach:

    • The quarantine expires on a date, not on a condition. A skip keyed to "until it's fixed" has no forcing function; a skip keyed to "re-enable 2026-11-15 or delete the spec" does, and deleting is a legitimate outcome.
    • Whichever job runs the quarantined spec must record its result somewhere a human reads weekly — not just in a log nobody opens. Otherwise you've converted a noisy signal into a silent one, which is the worse failure of the two.

    4. The exit code 201 opacity is the highest-leverage fix here, independent of the spec.

    This is worth doing even if the spec is quarantined tomorrow. A CI surface where an interrupted run reports collateral [INTERRUPTED] siblings and no originating failure is a tax on every future investigation — the next person sees three failures, none of which is the cause, and starts from zero. Getting Ginkgo's interruption to surface the originating spec name in the check annotation pays for itself on the second occurrence, not the tenth.

    On the "shrink the corpus" option specifically

    I'd be careful with it. Running search-quality against a small fixed backend set makes the test deterministic — and also makes it stop testing the thing that's hard. Ranking over 11 backends with hundreds of competing tools is the actual production condition; a 3-backend corpus tests a regime nobody deploys. If you do shrink it, label it as a unit-level ranking test and keep at least one un-gated multi-backend measurement, so a regression in the real regime still shows up somewhere.

    Not affiliated with the project and not proposing an implementation PR — mostly writing this because "quality vs correctness assertion categories" is a distinction that's cheap to state and expensive to rediscover per spec.

  4. removed
    needs-triage
    on Nov 24, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions