0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

fix(mcp): label task rows with their client and reclaim gracefully released rows

Operators couldn't tell which client sent a task once rows held only the
principal's hash. Rows now carry metadata.clientLabel: the client id with
the token subject or mapped user id, or with a short prefix of the token's
hash. It is never a credential, and callers are still matched on the
hashed principal only.

A graceful shutdown of a background task manager hands its leases back but
leaves running rows running, with no owner and no lease. The sweep only
reclaimed lapsed leases, so such a task stayed working forever. It now
reclaims a running row with no lease as well, as core's stale recovery
does (ported from fedc469d97).

Co-Authored-By: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
Daniel Lew 2026-10-27 16:31:17 -04:00
commit ebcfb2bbe9
6 changed files with 118 additions and 19 deletions