Skip to content

feat(identitybroker): bind each gateway token to its call - #3008

Merged
rdimitrov merged 15 commits into
mainfrom
claude/2727-call-binding-3bac13
Nov 28, 2026
Merged

rdimitrov merged 15 commits into
mainfrom
claude/2727-call-binding-3bac13

Conversation

@rdimitrov

@rdimitrov rdimitrov commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Closes #2727. Removes the #2451 shortcut "the gateway token is not bound to the call or single-use" and adds "the vMCP's single-use record is per replica" (stacklok/toolhive#7261).

What changes

Every gateway token the identity broker obtains is now bound to the one call it was issued for, and the embedded vMCP enforces that binding.

  • ToolHive v0.70.0 (own commit). It has AS-1 signing authorization_details into the ID-JAG, AS-2 copying the entry into the access token, and the vMCP's call binding with after-exp admission opt-in from Go. The other requirement changes are the minimums v0.70.0 needs, synchronized with task deps:sync. Nothing broke at compile time: factory.WithCallBinding is variadic, and Mecatl set no CallBinding before.

  • Call entry at AS-1. The broker sends one https://toolhive.dev/mcp_tool_call entry on every ID-JAG exchange. A tools/call names server, tool (as sent in params.name), arguments_sha256, and operation_id. A tools/list names server and method. AS-1 (as1server) and AS-2 (the embedded ToolHive process) register the call type and nothing else; ToolHive's defaults register none. The redemption carries no authorization_details. The mecatl_operation parameter is gone: the operation travels only in the signed entry (step (7)).

  • Output check (step (8a)). After redemption, the broker compares the token response's authorization_details with the entry it sent, as decoded JSON values. An absent or null member fails the call with INTERNAL call_entry_missing. Any other value, including a repeated member name, fails it with call_entry_mismatch. Neither is retried. The token is discarded, the attempt is not issued, and the decision record carries the result (CallEntryCheck: equal, absent, differs) and the token's (iss, jti).

  • Embedded vMCP wiring (toolhive_process.go). One callbinding.New binding is shared by the server's CallBinding and factory.WithCallBinding:

    • Clients is the broker client (mecatl), so every one of its tokens must carry an entry.
    • MaxCallDuration is 30 minutes, ToolHive's default, set explicitly.
    • ExpiredTokenAdmission has one entry: AS-2's issuer, mecatl, and a grace equal to MaxCallDuration, derived from the same value. The only message Mecatl sends after exp is the call's cancellation, which can come at any point in the call, so a shorter grace would answer a late cancellation 401 and leave the backend's tool running until the maximum. The vMCP admits an expired token only for its open call's own cancellation, reply, GET, or DELETE on that call's session, so the longer grace gives a stolen token little more. Only the test-only AS-2 trust can shorten the maximum, and with it the grace; production code can't set it.
    • Challenge is the incoming validator's (factory.IncomingBearerChallenge).

    The workspace-enrollment login token uses a random client ID, so the binding doesn't touch it.

  • Gateway token lifetime. Unchanged: the ID-JAG lifetime (id_jag_lifetime, 60 seconds by default) caps each gateway token, since AS-2 issues it no longer than the ID-JAG's remaining validity. A per-client lifetime at AS-2 (ToolHive v0.70.0) and an operator setting for it wait for Configure the embedded gateway's authorization server as AS-2 #2533, when AS-2 trusts AS-1 in production; until then they could not take effect. A Shortcut … removed by #2533 marker in as2DelegateClient and a note at each design place that promises a short, configurable V lifetime record the deferral.

  • MCP client: reading the vMCP's refusals.

    • 403 means not run. ToolHive's call binding refuses a mismatched call with HTTP 403 and a JSON-RPC error of code 403 for the request's ID, without an insufficient_scope challenge; its call gate and authz answer the same way. Mecatl's client read that as an unknown outcome. It now reads either form as refused before the call ran: the outcome gateway_refused, not retried, and the claim released. Step (9)'s table names both forms.
    • token_reused means it may have run. ToolHive answers a token that has already started a call with 401 invalid_token naming token_reused. Every other invalid_token still gets one retry with a new token. This one doesn't: the call the token names may already have run with it, for example by a stolen token replayed first, so the client reports token_reused, an unknown outcome that keeps the claim. The design's failure matrix and step (9) say so. The client tells this 401 apart by (token_reused) in the challenge's error_description, which is ToolHive's text, not a contract; a machine-readable reason is requested in vMCP: give call-binding refusals a machine-readable reason toolhive#7362, now a row in the design's ToolHive work list, needed before an external gateway (External gateway: Gateway implementation, operator setup, and end-to-end test #2812).
    • Nothing is presented after the send-by deadline. After exp, ToolHive answers a spent token with token_expired instead of token_reused, which reads as a plain invalid_token and would be retried, so a call someone else already ran with a stolen token could run twice. SendBy used to gate only the first request, so a handshake ending near exp let the tools/call go out after it. The client now writes every handshake request, and the tools/call itself, at least 250ms before SendBy or not at all, checking the tools/call after its argument hash and just before the write. A tools/call not written by then is not sent (authorization_expired), its claim is released, and it is not retried. The margin covers only the time from the check to the vMCP's own exp check, which has no leeway: the embedded vMCP shares Mecatl's clock and is reached in process. 250ms keeps three quarters of the shortest ID-JAG lifetime the broker accepts (1s). A token_expired that still arrives is handled as before, and other invalid_token answers are still retried once. When a failed handshake's closing DELETE comes after the deadline, the handshake's own rejection is kept, so an invalid_token still gets its retry.
  • Argument hash. Mecatl's own RFC 8785 implementation is gone. argumentsSHA256 now sends {} for absent or null arguments and otherwise delegates to the vMCP's own callbinding.ArgumentsSHA256, so the two sides agree by construction.

    • The shared vectors found the reason to switch. bytes.TrimSpace read arguments of only Unicode whitespace as absent, so " null" or a lone vertical tab hashed as {}, while the vMCP refuses them. The absent check now trims only JSON whitespace.
    • The tests read ToolHive's canonical vectors file: testdata/argumenthash/vectors.json is a byte-for-byte copy, checked against the ToolHive module this build uses. Every vector and refusal runs through argumentsSHA256.
    • null arguments hash as {}; the design's step (8) now says so.
    • Arguments with an object whose member names are equal under Unicode simple case folding, such as {"a":1,"A":2} at any depth, are refused as refused_arguments before anything is authorized. The vMCP's request parser refuses them with -32600, although both sides agree on the hash, so they used to get a token for a call that could not run. The check mirrors ToolHive's rule (pkg/mcp/json_ambiguity.go: each rune folded to the smallest rune in its unicode.SimpleFold orbit, as strings.EqualFold compares) and is tested against ToolHive's parser, mcp.DecodeMessage; the shared vectors marked gateway_refuses drive tests that each is refused before authorization.

Review notes from the issue

  • IDJAGRecord now carries Owner (company identity), User (verified user), and UserRecord, as the other broker records do.
  • AuthorizeCall records an invalid request as refused, naming only the calling workload, as OpenSession, RegisterAgent, and ReportDelegation do.
  • TestAS2LetsTheBrokerClientExchangeItsGatewayToken now also asserts that the broker client cannot exchange a call-bound gateway token. The shortcut it records narrows to entry-less tokens, which the broker never obtains.
  • The stale comment in authserverclient/redeem.go is gone; Redeem returns the response's authorization_details for the output check.

Tests

Against the real AS-1, ToolHive v0.70.0's AS-2, and the vMCP, with a real backend (internal/identitybroker/callbinding_integration_test.go):

  • each call's ID-JAG exchange carries its entry, AS-1 signs it, the redemption carries none, AS-2 copies it into the token unchanged, the token expires no later than its ID-JAG, and the decision records equal, for a tools/call and a listing;
  • the call the token names runs through Mecatl's MCP client. A second call with the same token gets 401 token_reused. Other arguments get 403 arguments_mismatch, another tool tool_mismatch, and a listing token on tools/call method_mismatch;
  • a listing token lists only its server's tools, with no cursor, once (a second listing gets 401 token_reused);
  • a call the vMCP refuses with 401 invalid_token (an expired token) is retried with a new token, which the vMCP accepts. A token someone else already spent comes back as token_reused, an unknown outcome Mecatl's client does not retry;
  • a token someone else spends while Mecatl's handshake is held past exp is not presented for the tools/call: the attempt is authorization_expired, not invalid_token, and the call runs once (TestSpentTokenIsNotPresentedAfterItsSendBy);
  • a call that outlives its token is cancelled by Mecatl's MCP client late in its maximum duration, past where a grace of a sixth of the maximum (the former 5 of 30 minutes) would have ended, and the backend sees the cancellation. Just after exp, a raw client sees 202 for a cancellation and for a reply on the call's session, and 401 for both after the grace.

At the real AS-1 and AS-2 (authserverclient, mcpbroker): an unknown entry type and a second call entry are refused, and AS-2 refuses a claim that is not an array, so each server registers the call type and nothing else.

Through cmd/mecak8s (real startup and served endpoint, TestIdentityBrokerBindsEachGatewayTokenToItsCall):

  • the tokens carry their entries and expire no later than their ID-JAGs;
  • a listing token gets 403 method_mismatch on tools/call.

The existing harness tests still go through the gateway. The vMCP now refuses their calls as tool_not_found, the #2537 stand-in: it has no provider credential for the calendar backend. wantStandInRefusal checks the vMCP logged that reason and no other, so a binding bug can't pass as the stand-in.

A unit test pins the production call binding: the broker client listed, a 30-minute maximum, and a 30-minute grace for AS-2's mecatl tokens only, admitting a message 5 minutes after exp and refusing one after 30.

Unit tests cover the output check rows (dropped claim, null, other hash, operation, tool, extra member, list entry for a tool call, additional entry, not an array, repeated member, not JSON, reordered and spaced), the entry the broker sends, the HTTP client's form and response, the 403 and token_reused classification, the send-by check before the tools/call and before the handshake, the call-level no-retry on token_reused and on a tools/call refused at the send-by deadline, and the outcome rows.

Commands run locally, all passing:

go test -race ./internal/identitybroker/... ./internal/adapter/mcpbroker/... ./internal/adapter/mcp/ ./internal/adapter/permconfig/ ./internal/cliconfig/ ./internal/adapter/mcpauthority/ ./internal/testutil/identityharness/ ./cmd/mecak8s/
go test -race ./internal/app/
task lint
task generate
task docs
task test:workspace-sync

go test -race -run 'IdentityBroker|Gateway|AS1|AS2|Broker' ./internal/app/ reports a goleak (idle HTTP keep-alive connections) that origin/main reports too; the full package run is clean.

Left to CI: the full race and platform matrix, and task e2e:k8s.

Not covered, and why

API compatibility

  • Assessment: no wire API change. The gRPC and HTTP/SSE session contracts, their mappers, and engine semantics are unchanged; server.APIMajor stays.
  • Rationale: the changes are inside the identity broker, which mecak8s calls in process, and the embedded ToolHive servers. The vMCP's new enforcement applies only to tokens of the broker client mecatl. Other clients of the served vMCP and AS-2 are unchanged, including the workspace-enrollment login.
  • A gateway call refused by the vMCP is now the tool error gateway_refused rather than outcome_unknown, and a spent token gives token_reused. Both correct the outcome without changing the result's shape.
  • Major or feature changes: none. Break approval: none needed.
  • Upgrade: none.

🤖 Generated with Claude Code

rdimitrov and others added 3 commits November 27, 2026 19:26
ToolHive v0.70.0 has the call-binding pieces the gateway token needs:
AS-1 signs authorization_details into the ID-JAG, AS-2 narrows the
access token to one call, and the vMCP enforces tool-call and list-call
binding with after-exp admission opt-in from Go. Nothing in Mecatl
changes behaviour with this bump: the embedder sets none of it yet.

The other requirement changes are the minimums ToolHive v0.70.0 needs,
synchronized across workspace members with task deps:sync.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The broker now sends a call entry (https://toolhive.dev/mcp_tool_call)
on every ID-JAG exchange: server, tool, argument hash, and operation for
a tools/call; server and method for a tools/list. AS-1 signs it into the
ID-JAG and AS-2 copies it into the gateway token; both embedded servers
register the call type. After redemption the broker checks that the
token response carries the entry it sent, and fails the call with
call_entry_missing or call_entry_mismatch, not retried (step (8a)).

The embedded vMCP shares one call binding between its server and token
validator: tokens of the broker client must carry an entry, calls last
at most 30 minutes, and a call's cancellation is still accepted for five
minutes after its token expires. AS-2 issues gateway tokens for 30
seconds by default, set by mcp.broker.gateway_token_lifetime once an
embedded entry routes servers.

Mecatl's MCP client now reads the vMCP's 403 refusal (a JSON-RPC error
of code 403, or an insufficient_scope challenge) as a call that never
ran, so it is reported as gateway_refused rather than an unknown
outcome. The argument hash tests read ToolHive's canonical shared
vectors and compare with the vMCP's own hash, which found that Unicode
whitespace around absent arguments hashed as {} while the vMCP refuses
it; only JSON whitespace is trimmed now.

Also from the issue's review notes: IDJAGRecord carries Owner and User
like the other records, AuthorizeCall records an invalid request as
refused, and the AS-2 test asserts the broker client cannot exchange a
call-bound gateway token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A gateway token the vMCP answers with 401 token_reused has already
started a call, so the call it names may have run with it, as with a
stolen token replayed first. Mecatl's MCP client no longer retries it
with a new token: the outcome is token_reused, unknown, and the call
stays claimed. Every other invalid_token still gets its one retry.

The argument hash now delegates to the vMCP's own
callbinding.ArgumentsSHA256; only the rule that absent or null
arguments are sent as {} stays here. The ID-JAG exchange no longer
sends mecatl_operation: the operation travels only in the signed call
entry. The vMCP's grace after a token's expiry can be shortened only
through the test-only AS-2 trust, the lifetime bounds come from
ToolHive's minimum and the broker's largest ID-JAG lifetime, and an
explicit lifetime AS-2 cannot apply is refused.

Tests now cover AS-1 and AS-2 refusing other authorization_details
types, a retry after a real 401, a token spent by someone else, a reply
on the open call's session within and after the grace, and the
production call binding's defaults. The design states the grace and
the token_reused rule, and Service.AuthorizeCall documents step (8a).

Co-Authored-By: Claude Opus 5.5 <[email protected]>


mcp.broker.gateway_token_lifetime and AS-2's per-client lifetime could
not take effect in production: ToolHive applies a per-client lifetime
only to redeemed tokens, and AS-2 trusts no ID-JAG issuer until #2533.
They are removed; the ID-JAG lifetime caps each gateway token, as
before. The tests that outlive a gateway token now shorten the ID-JAG
at AS-1 instead.

The token_reused match now says it depends on ToolHive's description
text until ToolHive gives a spent token a distinct error signal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rdimitrov and others added 3 commits November 27, 2026 20:46
A local task docs run rewrapped the --workspace default, because the
generator wraps at the length of this checkout's real workspace path.
The reference is unchanged by this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
task deps:sync raised workspace members' requirements to the versions
ToolHive v0.70.0 needs, but left out the go.sum entries for some of
their go.mod files. A standalone build (GOWORK=off) then fails with
missing go.sum entries, as the microVM release script test does when it
builds environment/microvm's mecatl-oci-tree-digest. The entries are
added with go mod tidy (environment/microvm, engine, authn/oidc) or go
mod download (the rest); no go.mod changes. adapters' standalone build
still stops at an engine package not yet published, as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rdimitrov and others added 4 commits November 27, 2026 22:26
…ding it

The vMCP forwards a cancellation to the backend before its 202 reaches
the client, so the backend could report the call cancelled while the
wire recorder had not yet recorded the cancellation's exchange. Under
-race in CI the test then read no status at all ("got [], want 202").

The recorder now signals each recorded exchange, and both grace subtests
wait for the cancellation's exchange (bounded by waitLimit) before
asserting its status. The within-grace subtest also reports when the
cancellation was sent past the grace, so a slow runner is not mistaken
for a binding fault. The assertions themselves are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ToolHive v0.70.0 requires charm.land/bubbles/v2 v2.2.2, whose textarea
no longer repeats one background SGR on each input line. The rendered
screen is unchanged; only the redundant escape is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hole call

The vMCP's grace after a gateway token's exp was 5 minutes, chosen for
elicitation replies. Mecatl's gateway client receives no elicitation:
the vMCP answers a tools/call as one JSON response and the client opens
no GET stream (#2821). The only message it sends after exp is the
call's cancellation, which can come at any point in the call. A
cancellation more than 5 minutes after exp was answered 401, reported
as outcome_unknown, and the backend's tool kept running until the
30-minute maximum.

The grace now equals the maximum call duration, set from the same value
in gatewayCallBinding, so a cancellation reaches the backend for as long
as the call can run. callbinding.New accepts a grace equal to the
maximum. Admission after exp stays limited to the open call's own
messages on its session, for AS-2's tokens of the broker client only.

The test-only AS-2 trust now shortens the maximum call duration, and the
grace with it, instead of the grace alone, so the integration tests run
the production relation. The outlive test cancels late in the call, past
where a grace of a sixth of the maximum (the former 5 of 30 minutes)
would have ended; the production binding test admits a message 5 minutes
after exp and refuses one after 30. The design docs name the new grace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After a gateway token's exp, ToolHive's vMCP answers a token that has
already started a call with token_expired rather than token_reused. Mecatl
reads that as a plain invalid_token and retries with a new token, so a
call someone else already ran with a stolen token could run a second
time. SendBy gated only the first request, the initialize, so a
handshake that ended close to exp let the tools/call go out after it.

The MCP client now writes every request before the tools/call, and the
tools/call itself, at least gatewaySendMargin (250ms) before SendBy, or
not at all. The tools/call is checked after its argument hash, under the
lock that marks the call started, just before the write; one refused
there was not written, so the attempt is not sent as
authorization_expired, its claim is released, and it is not retried.
Messages of a call that has started stay ungated, for the vMCP's grace.

The vMCP checks exp with no leeway, and the embedded vMCP shares
Mecatl's clock and is reached in process, so the margin covers only the
time from the check to the vMCP's own. 250ms covers that many times over
and keeps three quarters of the shortest ID-JAG lifetime the broker
accepts (one second). A token_expired that still arrives is handled as
before, and other invalid_token answers are still retried once.

TestSpentTokenIsNotPresentedAfterItsSendBy reproduces the gap on the
real send path: the token is spent elsewhere while Mecatl's handshake is
held past exp. Before this change the attempt came back invalid_token;
now it is authorization_expired, no tools/call is written, and the call
runs once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@ChrisJBurns ChrisJBurns 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.

LGTM. I checked the PR against the call-binding design in docs/drafts/agent-identity/, and it implements steps (7), (8), (8a) and (9) as written:

  • the mcp_tool_call entry
  • registration of the call type at AS-1 and AS-2
  • the broker output check, with call_entry_missing and call_entry_mismatch
  • the vMCP binding, with the grace set to the maximum call duration
  • the step (9) failure rows: token_reused is unknown and never retried, a 403 is refused, and a plain invalid_token is retried once

The tracker updates in implementation.md match. I found no correctness bugs, including in the two newest commits (e5e733c, 54539b7). The follow-ups below are inline where the lines are in the diff. Two concern lines outside the diff:

  1. Arguments the gateway will refuse still get a token. Arguments whose keys differ only by case (for example {"a":…,"A":…}, gateway_refuses: true in testdata/argumenthash/vectors.json) hash the same on both sides, but the vMCP refuses the call with -32600. So a V is minted, and the model sees an Invalid Request tool error. credentials-and-lifecycle.md:656 and implementation.md:129 say the client should refuse such arguments before authorization rather than let the two sides disagree. It's safe as is, but either refuse them in argumentsSHA256 or note the exception in step (8).
  2. Stale rollout text. implementation.md:212 still says "Mecatl sets it with … #2727 … Until then, phase 1 keeps its current shortcut". #2727 is now done, so this should be past tense or removed.

Minor wording: gateway_refused folds the check 3 binding mismatch and the check 4 policy denial (credentials-and-lifecycle.md:802) into one outcome. Both are "not run, not retried", so the behaviour is fine.

Comment thread internal/adapter/mcp/gatewaycall.go Resolved
Comment thread internal/adapter/mcp/gatewaycall.go Resolved
rdimitrov and others added 3 commits November 28, 2026 00:37
After a failed handshake, the SDK closes the session with a DELETE that
goes through the send-by deadline. When it came after the deadline, the
wire's authorization_expired refusal replaced the handshake's earlier
rejection, such as invalid_token or a 404 on notifications/initialized,
so the attempt lost its one retry with a new token. A refusal is now
recorded only when no earlier refusal or refusing handshake answer
already says why the attempt was not sent: the first one wins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… authorizing

The vMCP's request parser refuses a tools/call whose arguments hold an
object with member names equal under case folding, such as
{"a":1,"A":2}, with -32600, although both sides agree on the hash. Such
arguments still got a gateway token, and the model saw an Invalid
Request tool error.

argumentsSHA256 now refuses them as refused_arguments before anything
is authorized. hasCaseFoldedMembers mirrors ToolHive's rule
(pkg/mcp/json_ambiguity.go): within each object at any depth, names are
compared after folding each rune to the smallest rune in its
unicode.SimpleFold orbit, Unicode simple case folding as
strings.EqualFold uses it. A test checks it against ToolHive's own
parser, mcp.DecodeMessage, and the shared vectors marked
gateway_refuses drive tests that each is refused before AuthorizeCall
while its hash still agrees with the vMCP's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Mark the gateway token's lifetime as a shortcut until #2533 in the
  code, and note at each design place that still promises a short,
  configurable V lifetime that until then a V gets AS-2's default,
  capped at the ID-JAG's remaining validity.
- Track stacklok/toolhive#7362, the stable token_reused reason the MCP
  client's text match depends on, in the ToolHive work list, needed
  before an external gateway (#2812).
- Put the rollout order's #2727 sentence in the past tense.
- State in step (8) and the test list that the MCP client refuses
  arguments with member names that differ only by case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov

Copy link
Copy Markdown
Member Author

Thanks. All follow-ups are in this PR:

  • Arguments the gateway refuses (4f00aee): argumentsSHA256 now refuses arguments with an object whose member names are equal under Unicode simple case folding, at any depth, as refused_arguments, before anything is authorized. It mirrors ToolHive's rule in pkg/mcp/json_ambiguity.go (each rune folded to the smallest rune in its unicode.SimpleFold orbit, strings.EqualFold semantics) and is tested against ToolHive's own parser, mcp.DecodeMessage. The gateway_refuses vectors drive tests that each is refused before AuthorizeCall, while its hash still matches the vMCP's. Step (8) and the test list in implementation.md now name the case. The 8 MiB / 413 case stays in Gateway calls the vMCP refuses before running them are reported as "may have run" #3009.
  • Stale rollout text (58e88ed): the Bind each gateway token to its call #2727 sentence in implementation.md's rollout order is now past tense.
  • The three inline points are answered on their threads.
  • gateway_refused wording: no change, as both checks mean "not run, not retried".

🤖 Addressed by Claude Code

TestSendGatewayCallHandshakeEndsAtSendBy failed in CI under -race with
authorization_expired where a hung handshake should leave no rejection.
It had two causes:

- The handshake's cancellation. When a hung handshake reaches its
  deadline, go-sdk sends notifications/cancelled for the initialize from
  its own goroutine. Under load it can reach the wire after sendBy. The
  wire never writes a cancellation before the tools/call, but since the
  send-by gate was extended to every pre-call request, the gate ran
  first and recorded authorization_expired. The gate now runs after that
  check, in roundTripOther, and the tools/call keeps its own check in
  startCall, so nothing is written past sendBy and the handshake's
  cancellation records nothing. TestGatewayHandshakeCancellationAfterSendByRecordsNoRefusal
  hands the wire that request after sendBy.
- The test's 50ms window. On a slow runner the deadline could pass
  before the handshake started, refused up front as
  authorization_expired. The test now tells the two cases apart by
  whether the hanging transport was entered: entered, the attempt must
  end at the deadline with no rejection; not entered, it must be
  authorization_expired with no request, and the test runs again with
  twice the window.

Either value is not sent, maps to unavailable, is not retried, and
releases the call's claim, so callers see no difference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov
rdimitrov merged commit cd406cc into main Nov 28, 2026
51 checks passed
@rdimitrov
rdimitrov deleted the claude/2727-call-binding-3bac13 branch November 28, 2026 09:47
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.

Bind each gateway token to its call

2 participants