Repository navigation
Let embedders set the Legacy URL fallback text - #7136
Conversation
A Legacy client that did not declare elicitation.url gets an isError result carrying only the elicitation message, so an embedder whose clients have no other way to reach its connect page cannot hand them a link. URLElicitationRequiredError.WithLegacyFallback sets the text vMCP renders for that fallback; LegacyFallback returns it, or Message() when unset. -32042, Modern renderings, Error() and fmt output are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
tgrunnagle
left a comment
There was a problem hiding this comment.
Review
A small, additive feature on the Stable pkg/vmcp package: (*URLElicitationRequiredError).WithLegacyFallback(text) returns an immutable copy whose Legacy isError fallback renders embedder-supplied text, and LegacyFallback() reads it back (defaulting to Message()). conversion.ErrorToToolResult is the only renderer switched over. The approach is sound and minimal: the zero value is unchanged, no interface gains a method, there is no capability query (vmcp-anti-patterns #1 and #8 hold), and Error(), Format, GoString, -32042 and the Modern -32021 and decline renderings still use the elicitation messages. The trade-off the PR documents is that an embedder who writes a link into the text puts that link in front of the model.
Cross-cutting observations
- Renderers outside the diff stay consistent: the Modern decline result (
modern_dispatch.go:638) and the Modern-32021message (modern_dispatch.go:683) still useanswer.Message(), and nothing rebuilds an answer fromElicitations(), so the fallback cannot be dropped by a re-wrap. - The new architecture-doc bullet contradicts the unchanged bullet directly above it (first low finding).
- The "Modern decline does not hand back the link" guarantee is stated in the docs and the PR body, but no test would fail if it regressed (the medium finding).
Findings
| # | Severity | Finding | Location | Raised by |
|---|---|---|---|---|
| 1 | MEDIUM | No test shows the Modern decline result omits the embedder fallback | pkg/vmcp/server/url_elicitation_integration_test.go:710 |
tests |
| 2 | LOW | Architecture doc still says every fallback uses the same Message() text |
docs/arch/10-virtual-mcp-architecture.md:559 |
readability, correctness |
| 3 | LOW | Message() comment contradicts itself after the edit |
pkg/vmcp/url_elicitation.go:173 |
readability |
| 4 | LOW | WithLegacyFallback rebuilds the struct field by field instead of copying it |
pkg/vmcp/url_elicitation.go:206 |
api-design |
| 5 | LOW | Repeated hard-coded fallback host in new tests | pkg/vmcp/server/url_elicitation_integration_test.go:651 |
readability |
| 6 | LOW | Commit subject exceeds the 50-character limit | commit 9a26aba |
readability |
Additional findings
- [LOW] Commit subject exceeds the 50-character limit (commit
9a26aba): "Let an embedder set the Legacy URL elicitation fallback" is 55 characters;CONTRIBUTING.mdandCLAUDE.mdset a 50-character limit. Shorten it, for example "Let embedders set the Legacy URL fallback text" (45), if the commit message is kept on merge. Raised by: readability.
How to test
- Run
task testand expectTestURLElicitationRequiredError_WithLegacyFallback, the newTestErrorToToolResultcase andTestIntegration_Legacy_URLElicitation_EmbedderFallbackto pass. - Deliberately break it: change
urlElicitationFallbackResultinpkg/vmcp/conversion/errors.goback toanswer.Message()and confirm the newTestErrorToToolResultcase and the integration test fail. - Deliberately break the Modern side: change
modern_dispatch.go:638toanswer.LegacyFallback()and note that no test fails; that is the gap in finding 1. - Run
task lint.
Reviewed by dev:review-pr (finders: correctness, readability and conventions, API design, tests). Generated with Claude Code.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7136 +/- ##
==========================================
+ Coverage 81.26% 81.31% +0.05%
==========================================
Files 879 880 +1
Lines 89947 89960 +13
==========================================
+ Hits 73091 73147 +56
+ Misses 16851 16808 -43
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Addresses #7136 review comments: - MEDIUM pkg/vmcp/server/url_elicitation_integration_test.go:710 (4569174107): add a Modern decline case on the fallback-carrying answer - LOW docs/arch/10-virtual-mcp-architecture.md:563 (4569174113): qualify the same-text bullet as the default, here and in vmcp-library.md - LOW pkg/vmcp/url_elicitation.go:173 (4569174122): reword the Message comment as the default text - LOW pkg/vmcp/url_elicitation.go:206 (4569174127): copy the struct in WithLegacyFallback - LOW pkg/vmcp/server/url_elicitation_integration_test.go:651 (4569174154): name the fallback host once per test Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Re the [LOW] commit-subject finding in review 5898696147: I retitled the PR to "Let embedders set the Legacy URL fallback text" (45 characters). The squash merge takes its subject from the title, and rewriting 9a26aba itself would need a force-push. |
tgrunnagle
left a comment
There was a problem hiding this comment.
Review
Incremental review of the one commit since the last review (9a26aba to f38df96). The commit addresses all five inline findings from the previous review: the Modern decline path now has a test that fails if it renders the embedder fallback, the architecture doc and the Message() comment no longer claim every fallback reads the same, WithLegacyFallback copies the struct instead of rebuilding it, and each test names the fallback host once. The change is still small and additive on the Stable pkg/vmcp package, and nothing in the new commit alters runtime behavior beyond the struct copy, which shares no mutable state with the receiver. Two cosmetic nits remain.
Findings
| # | Severity | Finding | Location | Raised by |
|---|---|---|---|---|
| 1 | LOW | Reflowed doc paragraphs left over-long lines inside wrapped prose | docs/arch/10-virtual-mcp-architecture.md:564 |
readability |
| 2 | LOW | Test doc comment became a run-on sentence | pkg/vmcp/server/url_elicitation_integration_test.go:648 |
readability |
Resolved since the last review
- No test shows the Modern decline result omits the embedder fallback (
pkg/vmcp/server/url_elicitation_integration_test.go): the new "Modern decline result omits the fallback" subtest asserts theisErrortext equals the elicitation message and that neither host appears in the result. - Architecture doc still says every fallback uses the same
Message()text (docs/arch/10-virtual-mcp-architecture.md): the bullet now says "by default" and names the LegacyisErrorfallback as the one replaceable text. Message()comment contradicts itself after the edit (pkg/vmcp/url_elicitation.go): the comment now calls it the default text and says only the LegacyisErrortext can be replaced.WithLegacyFallbackrebuilds the struct field by field instead of copying it (pkg/vmcp/url_elicitation.go): it now copies*e, clones the slice and overrideslegacyFallback.- Repeated hard-coded fallback host in new tests (
pkg/vmcp/server/url_elicitation_integration_test.go): each test declaresfallbackHostand uses it in every assertion.
How to test
- Run
task testand expect the threeWithLegacyFallbacktests, including the new Modern decline subtest, to pass. - Deliberately break it: change
modern_dispatch.go:638toanswer.LegacyFallback()and confirm "Modern decline result omits the fallback" fails. - Run
task lint.
Reviewed by dev:review-pr (finders: correctness, readability and conventions, tests). Generated with Claude Code.
Addresses #7136 review comments: - LOW docs/arch/10-virtual-mcp-architecture.md:567 (4574659313): say a rehydrated session, which may have declared elicitation.url, also gets the embedder's Legacy fallback, and qualify the bullet heading - LOW docs/arch/10-virtual-mcp-architecture.md:564 (4575168449): rewrap and tighten the URL-mode bullet and the vmcp-library.md paragraph - LOW pkg/vmcp/server/url_elicitation_integration_test.go:648 (4575168454): split the test doc comment Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
elicitation.url, or whose capabilities vMCP does not know (a rehydrated session), gets anisErrorresult carrying only the elicitation message. For an embedder whose clients have no other way to reach its connect page, that is a dead end: the client is told to reconnect but never told where. vMCP: answer tools/call with a URL-mode elicitation (Modern and fallback) #7022 listed a caller-supplied fallback as "addable later without breaking callers". This PR adds it, keeping the rule that callers get no capability query (vmcp-anti-patterns fix(typo): corrects readme #1 and Start simple hardcoded registry #8). The embedder supplies the text and vMCP still decides the rendering at the render seam.pkg/vmcp:(*URLElicitationRequiredError).WithLegacyFallback(text)returns a copy whose Legacy fallback renderstext, and rejects empty or whitespace-only text.LegacyFallback()returns that text, orMessage()when none is set. Both are additive on the Stable package.conversion.ErrorToToolResultrendersLegacyFallback()instead ofMessage(). Nothing else changes:-32042still carries the elicitation messages, the Modern-32021still tells the client to declareelicitation.url, the Modern decline result does not hand back a link the user declined, andError(),FormatandGoStringnever include the fallback, so code that stringifies the error does not print a link written into it.docs/arch/10-virtual-mcp-architecture.md(render table and a new property) anddocs/arch/vmcp-library.md.Part of #6970. Follow-up to #7114.
Type of change
Test plan
task test)task test-e2e)task lint-fix)go test ./pkg/vmcp/... -count=1passes, andtask lintreports "0 issues." and a clean go vet.TestURLElicitationRequiredError_WithLegacyFallback: by default the fallback isMessage(); empty or whitespace text is rejected; the method returns a copy with the same elicitations andMessage(), leaves the receiver unchanged, and the copy is still found byURLElicitationFromError;Error()and every fmt verb omit the fallback.TestErrorToToolResult: a new case where the embedder fallback replaces the message.TestIntegration_Legacy_URLElicitation_EmbedderFallback, with real go-sdk clients: an undeclared Legacy client gets the embedder text through a directtools/calland through the optimizercall_tool; a declared Legacy client still gets-32042carrying the elicitation message, not the fallback; an undeclared Modern client still gets-32021without the fallback; and a Modern client that declines gets the elicitation message as itsisErrorresult, not the fallback.Does this introduce a user-facing change?
Only for embedders that call
WithLegacyFallback. A Legacy client that cannot receive-32042then sees the embedder's text instead of the elicitation message. Without the call, rendering is unchanged.Special notes for reviewers
elicitation.url. The arch doc says this too. The doc comment and the arch doc say this.elicitation.urlgets-32021, a protocol signal to declare the capability, and an embedder that wants an in-band link on Modern can return its own tool result there, because the request_metacarries the client's capabilities. The Modern decline result must not repeat a link the user declined.WithLegacyFallbackreturns a new answer, so the type stays immutable after construction like the rest of it.🤖 Generated with Claude Code