fix(19.7): RA-WR-01 never wait on a session lock under the router lock

Fan-out matching snapshots the sessions (and stateless entries) under the
router-wide lock, releases it, and reads each identity through a small
identity box that is never held across I/O, so an event no longer waits on
a session that is re-filtering while it holds sr.mu or sp.mu.

Widening and the fan-out recomputes run their guard checks with
guardContext: not cancelled with the triggering request, but bounded by
mcp.call_timeout, so a provider that never answers cannot hold a session
lock forever. README and docs/services/mcp.md describe the wider meaning of
mcp.call_timeout.

TestLockScopeUnderWidening blocks a widening guard check, fires a
permission event for that session and asserts that another session's call
still finishes, and that a never-answering check ends at call_timeout.
This commit is contained in:
2026-10-23 20:02:13 +02:00
parent f53668a3e8
commit cccf4025ea
7 changed files with 198 additions and 28 deletions

View File

@@ -40,7 +40,8 @@ const (
// endpoint; default the origin of app.url. A request without an Origin
// header is never refused by it.
AllowedOriginsKey = "mcp.allowed_origins"
// CallTimeoutKey bounds one in-process tool call, default 30s.
// CallTimeoutKey bounds one in-process tool call, and the guard checks
// run while a session or stateless server is re-filtered, default 30s.
CallTimeoutKey = "mcp.call_timeout"
// MaxResultBytesKey caps the route answer captured for a tool result,
// default 1048576 (1 MiB); a larger answer is a tool error.