You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
comply_test_controller's context_factory gets no request_context, so it sees no principal under stateful streamable-http #1821
register_test_controller calls the seller's context_factory with a RequestMetadata that has no request_context. Every other MCP tool gets the in-flight Starlette request there. So under
stateful streamable-http, auth_context_factory finds no principal for comply_test_controller: caller_identity is None, and metadata["adcp.auth_info"] is never set. A controller store that
scopes accounts or media buys by principal cannot find any, and the sandbox gate's account resolver
receives auth_info=None.
Versions
Present in v9.5.0 (latest stable), v10.0.0-beta.8, and main. Observed on 6.4.0.
src/adcp/server/test_controller.py (main, line 1522; v10.0.0-beta.8, line 1673):
auth_context_factory's docstring explains why that matters: its ContextVar fallback "works only when
the dispatch runs in the same async task as the middleware (i.e., stateless streamable-http and
A2A). In stateful streamable-http, these read None."
Reproduce
serve(..., auth=BearerTokenAuth(...), context_factory=auth_context_factory, test_controller=store)
with stateful streamable-http (the default).
Call comply_test_controller with a valid bearer token, e.g. force_account_status.
In the store, context.caller_identity is None, though the same token on any other tool gives
the principal.
A regression test: build the app with BearerTokenAuth and auth_context_factory, call comply_test_controller over stateful streamable-http with a token, and assert that the store's context.caller_identity is the token's principal.
Workaround
Wrap context_factory to fill in the request when it is missing:
With this in place, the 3.1.1 media_buy_seller/delivery_reporting storyboard passes on our seller.
We had excluded it because our store finds media buys by principal, and the controller had none.
Activity