Skip to content

Accept a call's messages after its token expires - #7339

Merged
rdimitrov merged 9 commits into
mainfrom
vmcp-call-binding-4-after-exp
Nov 27, 2026
Merged

rdimitrov merged 9 commits into
mainfrom
vmcp-call-binding-4-after-exp

Conversation

@rdimitrov

@rdimitrov rdimitrov commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

A call-bound access token (an RFC 9396 authorization_details entry of type https://toolhive.dev/mcp_tool_call) may start one call before its exp. A tool call can run longer than its token lives. Today, every message the client sends for that call after exp gets the token validator's 401. The client then cannot cancel the call, answer an elicitation, reconnect the stream that carries the call's messages, or end its session. Issue #7062 asks that, for such tokens, exp limit only when a call can start.

This PR implements that last open piece of the issue as an opt-in for Go embedders only. vmcp serve and the operator keep exp strict and have no setting to change it.

  • Strict by default. exp stays strict, as RFC 7519 section 4.1.4, RFC 9068 section 4 and the MCP authorization text require. Once a call-bound token expires, every request with it gets 401, including the call's own cancellation, replies, GET and DELETE.

  • Go-only opt-in. An embedder sets callbinding.Config.ExpiredTokenAdmission, a list of {Issuer, ClientID, Grace} entries:

    binding, err := callbinding.New(callbinding.Config{
    	ExpiredTokenAdmission: []callbinding.ExpiredTokenAdmission{
    		{Issuer: "https://as.example.com", ClientID: "agent-gateway", Grace: 2 * time.Minute},
    	},
    })
    • Matching: an entry matches a token whose iss and client_id claims equal its Issuer and ClientID exactly. The azp claim is not read.
    • Window: the entry's Grace, measured from the token's exp. A 30-second token with a one-minute grace gets one minute, not 30. The maximum call duration (callbinding.Config.MaxCallDuration, 30 minutes by default) stays the upper limit.
    • Validation: callbinding.New refuses an empty Issuer or ClientID, a Grace that is not positive or exceeds the maximum call duration, and two entries for the same issuer and client.
  • What a matching token may send after exp, within its grace, on the session of the tool call it started, while the call is open:

    • a notifications/cancelled for the call's JSON-RPC ID;
    • a JSON-RPC response, such as an elicitation answer;
    • a GET or DELETE on that session.

    Everything else gets 401: a new call, a list, initialize, ping, a cancellation for another ID, or another session. A list-call token and a Modern call (which has no session) have no messages after exp.

  • Once the call has ended, or has reached the maximum call duration, a matching token within its grace is answered on the call's session as before exp, and nothing is dispatched:

    • its cancellation and a JSON-RPC response get 202, since a receiver may ignore a cancellation for a finished request;
    • a GET or DELETE gets 403 no_open_call with a JSON-RPC error.

    A 401 there would make a go-sdk v1.8.0 client fail its connection over a cancellation that merely raced the call's end. That client also fails the connection on a JSON-RPC error that has no id (which is what a notification would get), so a cancellation must get 202.

  • pkg/auth gets two validator options:

    • WithExpiredTokenAdmission(maxAge, admit), opt-in. When a JWT fails validation because of its exp alone, it checks the token again on everything else (signature, iss, aud, nbf, subject restriction). It then requires exp to be less than maxAge in the past and asks the callback. Opaque tokens never qualify. An admitted identity is marked (Identity.AdmittedAfterExpiry) and gets no upstream tokens. So a logout or a revoked upstream session does not stop an open call's cancellation, replies, GET or DELETE until the grace ends.
    • WithStrictExpiry(), which states the default.

    MCPServer proxies set neither.

  • Wiring:

    • callbinding.New(cfg) builds a *callbinding.Binding, which the vMCP's call-binding check and the token validator share. The server takes it as CallBinding. The incoming auth factory takes it through a new optional argument, factory.WithCallBinding(b), which gives the validator Binding.TokenValidatorOption().
    • With no ExpiredTokenAdmission entry, that option is auth.WithStrictExpiry(), so exp is strict by construction.
    • The vmcp command wires the Binding but sets no list. The wiring is explicit, not context-based, because of .claude/rules/vmcp-anti-patterns.md rule 1.
    • With entries but a validator that never got the option, the vMCP logs one WARN when a call-bound tool call starts. Serve refuses a Binding that New did not build.
  • Checks in three places:

    • The binding's callback admits a POST, GET or DELETE only when all of these hold: the token carries a tool-call entry; its iss and client_id match a list entry within that entry's grace; its iss and jti have a call in this replica's record; and the request names that call's session. It never reads the request body.
    • The call-binding middleware checks the list and grace again, because the validator and the server are wired separately. It then checks whether the call is open and what the message is. It forwards only the open call's own messages, answers an ended call's as above, and refuses everything else with 401 token_expired.
    • As a backstop, core admission (authorizeToolCall, authorizeResourceRead, authorizePromptGet) refuses marked identities. This covers the pre-dispatch gates on both revisions and dispatch.
  • A Legacy call stays open while it dispatches. This applies whether or not the list is set. go-sdk keeps a Legacy tool call running after the client closes its POST, and a go-sdk client closes the POST before it sends notifications/cancelled. Before this PR, the call was marked ended as soon as the POST returned, so that cancellation got no_open_call and could not reach the running call. Now the Legacy dispatch marks itself running (Binding.BeginDispatch), and the request's return defers to it (Binding.EndCall). The last dispatch ends the call. Enforce list-call tokens at the vMCP #7325 deferred this case to this change.

  • Audit: an admitted request's event carries metadata.extra.admitted_after_expiry and the entry's operation_id. This includes the sse_connection stream-open event of a GET.

  • Docs: updated docs/arch/10, docs/arch/vmcp-library.md (with an embedder upgrade table), docs/authz.md and docs/middleware.md.

Closes #7062

Type of change

  • New feature

Test plan

  • Unit tests (task test): race runs of ./pkg/auth/... ./pkg/vmcp/... ./pkg/audit/... ./pkg/mcp/toolcalldetails/... ./cmd/thv-operator/pkg/vmcpconfig/... ./cmd/thv-operator/api/... ./cmd/thv-operator/controllers/... pass (71 packages)
  • Linting (task lint-fix): task lint reports 0 issues; task docs produces no changes; the operator's generated files are unchanged from main
  • Manual testing (described below)

What the new tests cover:

  • pkg/auth/token_expired_admission_test.go:
    • A callback refusal gives byte-for-byte the strict validator's 401.
    • An admitted token marks the identity, and no upstream tokens are loaded.
    • Each of these gets the strict 401 without the callback being asked: a bad signature, wrong iss or aud, future nbf, subject restriction, missing exp, exp older than maxAge, or an opaque token.
    • WithStrictExpiry after WithExpiredTokenAdmission is strict.
    • Invalid option arguments are refused.
  • pkg/vmcp/callbinding/shared_test.go:
    • New and ValidateExpiredTokenAdmission.
    • AdmitExpiredToken's cases: no list, issuer or client not listed, azp-only client, the grace boundary, list calls (including one whose end the record missed), ended calls on and off the call's session, a Modern call, another session, a failing record, and a zero Binding. Its record runs on the admission check's clock, so the fixed times never go stale.
    • WithinExpiredTokenGrace.
    • EndCall deferring to running dispatches.
  • pkg/vmcp/server/call_binding_expiry_test.go: a stand-in validator calls the real Binding.AdmitExpiredToken.
    • Without a list, everything after exp gets 401.
    • With an entry, the open call's messages pass until the grace and are refused at it.
    • A non-matching issuer or client, or an azp-only client, gets 401.
    • After exp, only the open call's own messages pass.
    • For an ended call within the grace: 202 for its cancellation and a response, 403 no_open_call for a GET or DELETE, and 401 for anything else. Nothing is dispatched. Another session and past the grace still get 401.
    • A cancellation after exp stops the call, and a DELETE after exp cancels it.
    • The maximum call duration bounds the window.
    • List and Modern calls have no messages after exp. A replica sharing a record that missed a list call's end still refuses its session's GET and DELETE.
    • The stream-open audit event of a GET after exp carries both fields.
    • A marked identity can't start a call or a session.
    • The unwired-validator WARN.
  • pkg/vmcp/server/call_binding_idjag_expiry_integration_test.go: real AS-1 and AS-2 with 2-second access tokens, in front of a vMCP whose production OIDC validator shares the server's Binding.
    • Without a list, exp is strict.
    • With an entry, the call's cancellation gets 202 and must reach the backend before the call's own deadline. Then a GET gets 403 no_open_call and a repeated cancellation gets 202.
    • An elicitation question asked after exp is received on a stream opened after exp, and answered.
  • pkg/vmcp/core/core_checks_test.go and pkg/audit/auditor_test.go.

Manual end-to-end run on separate processes. AS-1 and AS-2 run on pkg/authserver/runner with the call type registered, and AS-2 issues 10-second access tokens. Two vMCP replicas sit in front of two real MCP backends whose tools outlive the token. The full check list is in the run report.

  • vmcp serve at this head:
    • Strict after exp: the call's cancellation, a reply, GET and DELETE get the validator's 401, as do a list-call token's GET, DELETE and response. A cancellation before exp reaches the backend.
    • A config file that still contains incomingAuth.expiredTokenAdmission is refused at startup: field expiredTokenAdmission not found in type config.IncomingAuthConfig.
  • An embedded vMCP with ExpiredTokenAdmission set in Go (Grace: 1m), within the grace:
    • The call's cancellation gets 202 and the backend sees it.
    • Elicitation: the GET stream is opened after exp, the question arrives, the answer gets 202, and the call completes.
    • go-sdk style: close the POST, then GET and cancel. The call ends.
    • A DELETE ends the session and cancels the call.
    • A new call, a list, ping and a cancellation for another ID get 401. The other replica gets 401.
    • Ended calls get 202 or 403 as described.
  • Embedded, past the grace: the open call's cancellation, a reply, GET and DELETE get the validator's 401.
  • A go-sdk StreamableClientTransport connection: within the grace, its cancellation and a response for an ended call are accepted, and the connection stays usable. Past the grace, the cancellation gets 401 and go-sdk fails the connection.
  • Earlier run, at the previous head (when the list was still a config key): the same checks passed, plus non-matching clientId or issuer entries (401), audit fields on admitted requests including the sse_connection event, denial_reason: token_expired on call-binding refusals, and refusal of invalid lists at startup.

Changes

File Change
pkg/auth/token.go, pkg/auth/identity.go WithExpiredTokenAdmission, WithStrictExpiry, ExpiredToken, ExpiredTokenAdmitter; Identity.AdmittedAfterExpiry; no upstream tokens for admitted identities
pkg/vmcp/callbinding/admission.go ExpiredTokenAdmission, ValidateExpiredTokenAdmission, WithinExpiredTokenGrace, AdmitsExpiredTokens
pkg/vmcp/callbinding/shared.go, binding.go Binding and New; AdmitExpiredToken, TokenValidatorOption (strict without a list), OpenCall, EndCall, BeginDispatch; Config.ExpiredTokenAdmission
pkg/vmcp/server/call_binding.go After-exp path (serveAfterExpiry, serveEndedCallAfterExpiry); a Legacy call stays open while it dispatches; unwired-validator WARN
pkg/vmcp/server/serve_handlers.go The Legacy tools/call dispatch marks itself running
pkg/vmcp/server/serve.go, server.go CallBinding is now a *callbinding.Binding; Serve refuses one New did not build
pkg/vmcp/auth/factory/incoming.go WithCallBinding option for NewIncomingAuthMiddleware
pkg/vmcp/cli/serve.go One Binding for the validator and the server, with no admission list
pkg/vmcp/core/core_checks.go, core_calls.go Admission refuses identities admitted after expiry
pkg/audit/auditor.go, mcp_events.go admitted_after_expiry and operation_id metadata, also on stream-open events
docs/... Architecture, library, authz and middleware pages
*_test.go Unit, server, core, audit and AS-1 → AS-2 → vMCP tests

Does this introduce a user-facing change?

For vmcp serve and operator users, only in one place:

  • Legacy cancellation before exp: a cancellation sent after the client closed the call's POST used to get 403 no_open_call while the call kept running. It now reaches the call.
  • No new configuration: what an expired call-bound token gets after exp does not change. It still gets 401.

For Go embedders:

Before After
ServerConfig.CallBinding: callbinding.Config{...} b, err := callbinding.New(callbinding.Config{...}), then ServerConfig.CallBinding: b
factory.NewIncomingAuthMiddleware(ctx, cfg, ...) factory.NewIncomingAuthMiddleware(ctx, cfg, ..., factory.WithCallBinding(b)) with the same b. The trailing argument is variadic, so existing call sites compile.
  • The CallBinding field has not been in a release yet.
  • An embedder that wants admission after exp sets callbinding.Config.ExpiredTokenAdmission.
  • Admitted requests are audited with admitted_after_expiry: true and operation_id.

Special notes for reviewers

  • Embedder-only, per review: there is no CRD field or vMCP config key. The consumer embeds the vMCP and sets the list in Go. A public field can be added if an operator-managed deployment needs one.
  • client_id only: an entry reads the client_id claim alone, not callbinding.ClientID, which falls back to azp. client_id names the client the token was issued to, not the one presenting it. The list limits which tokens get the grace; which clients can be issued a call entry belongs to the authorization server's grant policy.
  • Sender-constrained tokens: once DPoP or mTLS binding exists (stacklok/mecatl#3003), admission after exp is expected to require the proof as well. The list is where that would be switched on.
  • Ended calls within the grace: the validator lets them through on the call's own session, so the middleware can answer. Nothing new is dispatched. The answers are 202 or 403, and other sessions and calls stay unreachable.
    • I chose the answers from what go-sdk v1.8.0 keeps the connection for. A non-2xx answer to a POST keeps the connection only if its body decodes as a JSON-RPC error response, and an error with no id doesn't decode. A standalone GET keeps the connection on a non-SSE answer. Close ignores the DELETE status.
    • A response sent before exp with no open call still gets 403 with a null id, which go-sdk treats as a broken connection. That predates this PR.
  • Deviation from the issue, GET and DELETE: the issue says GET and DELETE are refused after exp. This PR admits them for a matching token, on the open call's session only. The vMCP sends a backend's elicitation on the session's standalone GET stream, so a client whose stream dropped needs GET to receive the question. DELETE starts nothing, and since Cancel a session's open calls when its client deletes it #7341 it cancels the session's open calls. A stream is checked only when it opens.
  • Callback scope: the callback decides from method, headers, claims and the record, and never reads the body. The middleware, which has the parsed request, checks the message kind.
  • Any response is a shortcut: accepting any JSON-RPC response on an open call's session is the named shortcut until vMCP: bind sessions to the client, acting agent, and delegated-access marker, not just the user #6888, as before exp.
  • Per replica: the default record is in memory, so a message sent to another replica after exp gets 401. That does not widen the single-use gap (vMCP: one single-use record shared by all replicas for call-bound access tokens #7261).
  • Single use is unchanged before exp.
  • Size: this is above the 400-line / 10-file guideline, because vMCP: accept an access token for the one call its authorization_details names, once #7062 asks for this piece to ship as one security-reviewed change. The pkg/auth options could be split out if reviewers prefer.

🤖 Generated with Claude Code

rdimitrov and others added 3 commits November 26, 2026 17:38
A call-bound token's exp now limits only when a call can start. A tool
call that outlives its token keeps, on its session and while it is open
and younger than the maximum call duration, its cancellation, JSON-RPC
responses such as elicitation answers, and GET and DELETE. Nothing else
is accepted after exp.

The token validator gets an opt-in option, WithExpiredTokenAdmission,
that checks an expired JWT again on everything but exp, bounds its age,
and asks a callback. callbinding.Binding is shared by the validator and
the vMCP's call-binding check: the server takes it as CallBinding and
the auth factory through WithCallBinding. Admitted identities are
marked, get no upstream tokens, are refused any call by the core and
the authorization gate, and are audited with admitted_after_expiry and
the call's operation ID.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refuse a CallBinding that callbinding.New did not build, log the
admitter's record failures at DEBUG, document that a stream opened
after exp outlives the call, and bound the elicitation test's wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closing a Legacy call's POST returns its request but not its dispatch,
and a go-sdk client closes the POST before it cancels. The call now
stays open while its dispatch runs on the replica, so the cancellation,
before or after exp, still reaches it; the last dispatch ends the call.

Binding now owns opening and ending calls (OpenCall, EndCall,
BeginDispatch) instead of exposing its record and returned set. Core
admission refuses identities admitted after expiry, so both gates and
dispatch hold the backstop. A request that crosses exp goes to the
after-exp path. Docs cover the library API, the audit keys and the
validator option.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the size/XL Extra large PR: 1000+ lines changed label Nov 26, 2026
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.97041% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.71%. Comparing base (7d1ef06) to head (663ff8c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/vmcp/cli/serve.go 0.00% 7 Missing ⚠️
pkg/vmcp/server/call_binding.go 94.04% 5 Missing ⚠️
pkg/auth/token.go 92.59% 4 Missing ⚠️
pkg/vmcp/callbinding/shared.go 99.20% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7339      +/-   ##
==========================================
+ Coverage   82.60%   82.71%   +0.10%     
==========================================
  Files         943      946       +3     
  Lines       96943    97298     +355     
==========================================
+ Hits        80082    80479     +397     
+ Misses      16856    16814      -42     
  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.

@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 26, 2026

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read through the after-exp path and want to raise one thing about how it ships, not about how it's built.

Accepting an expired JWT goes against RFC 7519 section 4.1.4, RFC 9068 section 4, and the MCP authorization text that says an expired token gets a 401. I think the problem in "vMCP: accept an access token for the one call its authorization_details names, once" is real, so I'm not arguing to drop it. But as written it is on for every thv vmcp serve with OIDC incoming auth, there is no switch, and the window is a fixed 30 minutes (DefaultMaxCallDuration, pkg/vmcp/callbinding/binding.go:63) whatever the token's own lifetime was. For a token that lives about 30 seconds, and a client that needs about a minute to answer an elicitation, that is a 30x extension the issuer never chose.

What I'd suggest: default off, with an operator list of (issuer, client_id, grace). An empty list means strict exp.

  • TokenValidatorOption (shared.go:177) returns a no-op option when the list is empty, so exp stays strict by construction and WithCallBinding (incoming.go:283) needs no change.
  • Match on the client_id claim only. callbinding.ClientID also falls back to azp (binding.go:198), so this needs its own read. Note that client_id names the client the token was issued to, not the one presenting it, and on an authorization server shared by several clients it limits which tokens get the window, not which clients can be issued a call entry. That part is for the AS grant hook.
  • Check the list in AdmitExpiredToken (shared.go:204), after b.Token(...), and again in serveAfterExpiry (pkg/vmcp/server/call_binding.go:407), since the validator and the server are wired separately. Use the entry's grace instead of maxCallDuration for the window; the validator's maxAge can stay as the ceiling.
  • Leave the pre-exp dispatch tracking (BeginDispatch/EndCall) alone.

Done looks like: with no list configured, a call-bound token past exp gets 401 on every request; with a matching entry, today's behaviour, bounded by that entry's grace. serve.go:396 builds the binding with no operator input today, so this is the first knob. The config path is yours to pick.

Sender-constraining these tokens is planned, tracked as Bind gateway access tokens to the caller's key (DPoP or mTLS). Once it exists, I'd expect after-exp admission to require the proof as well, and the list is where that would be switched on.

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Four small things, inline. The first one will start failing on a fixed date in January, so it's worth fixing in this PR. The rest tighten behaviour that is easy to miss.

Comment thread pkg/vmcp/callbinding/shared_test.go Resolved
Comment thread pkg/vmcp/server/call_binding.go Resolved
Comment thread pkg/audit/auditor.go Resolved
Comment thread docs/authz.md Resolved
After-exp admission was on for every vMCP with OIDC incoming auth, with a
fixed 30-minute window whatever the token's own lifetime. It is now off by
default: once a call-bound token expires, every request with it gets 401.

Operators opt in with incomingAuth.expiredTokenAdmission (on a
VirtualMCPServer, spec.incomingAuth.expiredTokenAdmission), a list of
{issuer, clientId, grace} entries matched against the token's iss and
client_id claims (azp is not read). A matching token's call messages are
accepted for the entry's grace after exp, still bounded by the call being
open and by the maximum call duration. Without an entry the validator
option is auth.WithStrictExpiry, so exp is strict by construction; the
call-binding middleware checks the list and grace again, as the two are
wired separately. The vMCP, callbinding.New and the operator's converter
refuse an empty issuer or client, a grace that is not positive or exceeds
the maximum call duration, and duplicate entries.

The after-exp DELETE test now expects the DELETE to cancel the open call,
as main does since sessions cancel their open calls on delete.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 27, 2026
- A list-call token has no messages after exp even when the record could
  not mark the list call ended: the binding's callback and the
  call-binding check now refuse a list entry by its type, for GET and
  DELETE as for a response.
- The stream-open audit event of a GET admitted after exp carries
  admitted_after_expiry and operation_id, as other events do.
- The admission unit test gives its in-memory record the clock it gives
  the admission check, so its fixed times never fall behind the real
  clock.
- docs/authz.md says the messages are accepted until the call ends (its
  request has returned and its dispatch has finished) or has run for the
  maximum call duration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 27, 2026
@rdimitrov

rdimitrov commented Nov 27, 2026 •

Copy link
Copy Markdown
Member Author

Thanks, adopted in 868c4aa and narrowed to Go only in 3b0c118, per the follow-up review. Admission after exp is off by default, and only an embedder can turn it on.

  • Strict by default. Without configuration, a call-bound token gets 401 on every request once it expires, including its call's cancellation, replies, GET and DELETE. Binding.TokenValidatorOption returns a new auth.WithStrictExpiry() when the list is empty, so WithCallBinding is unchanged. A no-op option can't be written outside pkg/auth, because the options type is unexported.
  • Opt-in list, Go only. An embedder sets callbinding.Config.ExpiredTokenAdmission, a list of {Issuer, ClientID, Grace} entries. There is no vMCP config key and no VirtualMCPServer field, so vmcp serve and the operator are always strict. An entry matches the token's iss and client_id exactly; azp is not read, since callbinding.ClientID's fallback isn't used.
  • Window. The entry's Grace, measured from exp. The validator's maxAge and MaxCallDuration stay the upper limit. callbinding.New refuses a grace that is not positive or exceeds the maximum call duration, an empty issuer or client, and duplicates.
  • Checked twice. In AdmitExpiredToken after b.Token(...), and again in serveAfterExpiry.
  • Unchanged: the dispatch tracking before exp (BeginDispatch/EndCall).
  • Docs: docs/arch/10, docs/authz.md and docs/arch/vmcp-library.md describe the Go option, and note that DPoP or mTLS binding (Bind gateway access tokens to the caller's key (DPoP or mTLS) mecatl#3003) is expected to plug into the same list.

New tests:

  • no list gives 401 on every request after exp;
  • a matching entry is admitted until its grace and refused at it;
  • another issuer, another client, or an azp-only client gets 401;
  • callbinding.New validation of the list;
  • an AS-1 → AS-2 → vMCP chain test showing the production validator stays strict without a list.

The existing tests that rely on admission now configure an entry. I also merged main (#7338, #7341). The DELETE-after-exp test now expects the DELETE to cancel the open call, as #7341 does.

🤖 Addressed by Claude Code

@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 27, 2026

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The opt-in and the fixes from the last round look right to me, thanks for turning them around so fast. Four things inline: one is a request to pull back the CRD field, the others are a go-sdk behaviour I'd like a second look at, a test that can pass without cancelling, and a docs sentence.

Comment thread pkg/vmcp/server/call_binding.go Resolved
Comment thread docs/middleware.md Resolved
- Remove spec.incomingAuth.expiredTokenAdmission from the CRD and the
  operator's converter, and incomingAuth.expiredTokenAdmission from the
  vMCP config, so vmcp serve and the operator stay strict with no way to
  opt in. A Go embedder sets callbinding.Config.ExpiredTokenAdmission,
  validated by callbinding.New and checked by the validator and the
  call-binding check as before.
- Within the grace, a matching token on the session of a tool call that
  has ended, or reached the maximum call duration, is answered as before
  exp and never dispatched: its cancellation and a JSON-RPC response get
  202, a GET or DELETE 403 no_open_call. A 401 there made go-sdk clients
  fail the connection over a cancellation that raced the call's end. The
  validator's callback now admits such a request on the call's own
  session so the call-binding check can answer it.
- The chain cancellation test fails if the backend does not see the
  cancellation before the call's own deadline.
- Docs: admission is a Go embedder option; admitted requests load no
  upstream tokens, so an upstream logout does not stop an open call's
  messages within the grace; an upgrade table for the embedder API; the
  call-binding settings are callbinding.Config fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 27, 2026
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 27, 2026

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, all four are addressed: the CRD field and config key are gone, an ended call's cancel or response now gets a 202 and its GET or DELETE a 403 no_open_call, the cancel test fails when the backend never sees the cancellation, and the docs say what an admitted request skips.

One nit, not worth another CI run: in docs/arch/vmcp-library.md the sentence starting "List a client only once the authorization servers..." sits on the last row of the new before/after table, so it renders as a third cell. It needs a blank line before it. Could you fix that as a drive-by in your next PR?

@rdimitrov
rdimitrov merged commit a58810e into main Nov 27, 2026
47 checks passed
@rdimitrov
rdimitrov deleted the vmcp-call-binding-4-after-exp branch November 27, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vMCP: accept an access token for the one call its authorization_details names, once

2 participants