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
testing: forward lifespan and MCP session settings from build_asgi_app #1054
Beta.5's adcp.testing.build_asgi_app(transport="both") solves the combined
MCP+A2A topology gap from #1047, but it still cannot replace production app
composition for adopters that configure lifespan hooks or stateful MCP
sessions.
The public helper does not accept or forward these production serve() / _build_mcp_and_a2a_app() inputs:
Passing any of them through **factory_kwargs does not work: those kwargs are
forwarded to create_adcp_server_from_platform(), where they are unexpected.
Our in-process app must run cleanup hooks for database-backed proposal/task
stores and must exercise the same MCP session configuration as production.
Consequently, even on beta.5 it still has to import:
For transport="both", forward them to the existing production composition
path. Tests should verify that startup/shutdown hooks run under an ASGI lifespan
manager and that the MCP server receives the three session settings.
This is an additive production-parity follow-up to #1047; the beta.5 transport
selection and auth/discovery behavior are otherwise working well.
code-reviewer: Non-breaking additive; must forward all 5 kwargs at the _build_mcp_and_a2a_app() call site or hooks silently never fire; ValueError guard required for hooks on non-"both" transport; three test categories mandatory (ValueError guard, session-kwarg forwarding to create_mcp_server, lifespan hook fires under LifespanManager)
dx-expert: Design is correct and consistent with production serve(); build_test_client() must also expose all 5 params (that's where LifespanManager fires hooks); max_active_sessions default must be None, not a concrete cap; docstrings need :param entries covering the transport="both" restriction on hook params
My take: Clean production-parity gap — #1047 (merged via #1048) shipped transport="both" but the public testing API doesn't yet forward the lifespan and session-config surface that production serve() exposes. All five new params are optional with production-matching defaults.
build_asgi_app() signature (src/adcp/testing/decisioning.py): Add on_startup, on_shutdown, stateless_http=False, session_idle_timeout=1800.0, max_active_sessions=None. Add ValueError for hooks on transport != "both" (mirror serve.py:1015); warnings.warn for non-default MCP-only session params when transport="a2a". Forward all 5 to _build_mcp_and_a2a_app() for transport="both"; forward session trio to create_mcp_server() for transport="mcp".
build_test_client(): Add same 5 kwargs, forward to build_asgi_app().
Tests: (a) ValueError for hooks with transport="mcp" and transport="a2a"; (b) mock asserts session kwargs reach create_mcp_server; (c) lifespan integration test confirms hook fires through build_test_client(transport="both", on_startup=(...)).
Non-breaking: all new params optional with defaults matching production; existing callers unaffected.
Activity
bokelley commentedon Aug 20, 2026
Triage
Classification: Feature request
Bucket(s): enhancement
Status: ready-to-implement
What the experts said:
_build_mcp_and_a2a_app()call site or hooks silently never fire;ValueErrorguard required for hooks on non-"both"transport; three test categories mandatory (ValueError guard, session-kwarg forwarding tocreate_mcp_server, lifespan hook fires underLifespanManager)serve();build_test_client()must also expose all 5 params (that's whereLifespanManagerfires hooks);max_active_sessionsdefault must beNone, not a concrete cap; docstrings need:paramentries covering thetransport="both"restriction on hook paramsMy take: Clean production-parity gap — #1047 (merged via #1048) shipped
transport="both"but the public testing API doesn't yet forward the lifespan and session-config surface that productionserve()exposes. All five new params are optional with production-matching defaults.build_asgi_app()signature (src/adcp/testing/decisioning.py): Addon_startup,on_shutdown,stateless_http=False,session_idle_timeout=1800.0,max_active_sessions=None. AddValueErrorfor hooks ontransport != "both"(mirrorserve.py:1015);warnings.warnfor non-default MCP-only session params whentransport="a2a". Forward all 5 to_build_mcp_and_a2a_app()fortransport="both"; forward session trio tocreate_mcp_server()fortransport="mcp".build_test_client(): Add same 5 kwargs, forward tobuild_asgi_app().ValueErrorfor hooks withtransport="mcp"andtransport="a2a"; (b) mock asserts session kwargs reachcreate_mcp_server; (c) lifespan integration test confirms hook fires throughbuild_test_client(transport="both", on_startup=(...)).Triaged by Claude Code. Session: https://claude.ai/code/cse_01E5ECmJ7hNYWY5DoeKvcJU8
Generated by Claude Code