Skip to content

Degrade transient optional list failures in Modern enumeration - #6348

Open
lorenzozanee wants to merge 5 commits into
stacklok:mainfrom
lorenzozanee:fix/vmcp-health-optional-list-429
Open

Degrade transient optional list failures in Modern enumeration#6348
lorenzozanee wants to merge 5 commits into
stacklok:mainfrom
lorenzozanee:fix/vmcp-health-optional-list-429

Conversation

@lorenzozanee

Copy link
Copy Markdown

Summary

A reachable Modern backend can be marked unavailable when an optional capability enumeration (resources/templates/list, resources/list or prompts/list) returns a transient HTTP 429. The 429 is classified as transient in the Modern layer, but the enumeration treated every error other than -32601 as fatal, so the transient failure surfaced as ErrBackendUnavailable and flipped the backend to unhealthy/degraded even though initialize and tools/list had succeeded. With several VirtualMCPServers probing the same rate-limited backend, aggregate Ready flips to False (BackendsDegraded).

A transient failure on an optional list now degrades to an empty result (with a WARN) instead of failing the whole enumeration. tools/list stays fatal: a backend that cannot list its tools is genuinely unavailable. The existing -32601 not-implemented degradation is unchanged.

Fixes #6347

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

The regression tests fail on the base commit with the exact error from the report ("backend unavailable: failed to list resource templates ... modern backend returned a transient error: HTTP 429") and pass with the fix; the affected vmcp packages are green.

Special notes for reviewers

This fix targets the Modern path reported in #6347. The Legacy path still treats a 429 on optional enumeration as fatal; detecting the transient class there would require reaching into go-sdk internals and is left for a follow-up. This is orthogonal to #6246 (partialFailureMode wiring), which does not touch error classification.

A rate-limited Modern backend that answers an optional capability
enumeration (resources/list, resources/templates/list or prompts/list)
with a transient HTTP 429 was misclassified as ErrBackendUnavailable,
flipping a reachable backend to unhealthy/degraded and aggregate
Ready=false even though initialize and tools/list succeeded.

Degrade a transient failure on an optional list to an empty result
instead of failing the whole enumeration. tools/list stays fatal; the
-32601 not-implemented degradation is unchanged.

Fixes stacklok#6347

Signed-off-by: lorenzozanee <wyz0707@proton.me>
reyortiz3
reyortiz3 previously approved these changes Aug 17, 2026
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.77%. Comparing base (d278b33) to head (3918e29).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6348      +/-   ##
==========================================
+ Coverage   77.75%   77.77%   +0.02%     
==========================================
  Files         750      750              
  Lines       72601    72610       +9     
==========================================
+ Hits        56448    56474      +26     
+ Misses      16148    16131      -17     
  Partials        5        5              

☔ 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.

@reyortiz3

Copy link
Copy Markdown
Collaborator

Hi @lorenzozanee, thanks for submitting this PR! Mind fixing the linting error?

reyortiz3 and others added 2 commits August 21, 2026 16:09
Extract the three nearly-identical optional-list degradation switches in
modernEnumerate into a single modernListOptional helper, dropping the
function's cyclomatic complexity back under the gocyclo threshold (15).
Behavior is unchanged: a transient list failure degrades with a WARN, a
-32601 degrades only for resources/templates/list (mirroring the Legacy
path), and tools/list stays fatal.
@lorenzozanee

Copy link
Copy Markdown
Author

Hi @reyortiz3 — thanks for the heads-up. The gocyclo lint error is fixed in be4f4217: the three near-identical optional-list degradation switches in modernEnumerate are now extracted into a single modernListOptional helper, which drops the function's cyclomatic complexity from 16 back to 12 (< the 15 threshold).

Behavior is unchanged — a transient list failure still degrades with a WARN, -32601 still degrades only for resources/templates/list (mirroring the Legacy path), and tools/list stays fatal.

I verified locally with the same golangci-lint version CI pins (v2.12.2): full-repo golangci-lint run ./... is clean, and the pkg/vmcp tests (including the enumeration tests) pass.

One note: the branch merged main in the meantime, which brought in workflow file changes (e.g. the new skills-build.yml / skills-keyless-signing-e2e.yml), so the latest run is sitting at "action_required" pending approval. Could you approve the workflow runs so the checks can execute? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(vmcp): HTTP 429 listing resource templates marks a backend unavailable

2 participants