History

Stamp client identity on MCP execution spans (#1621)

Rhys Sullivan committed 2 months ago

Commit 86c68af1 parent 6dff8916 files · +263 −4Browse files

Showing the changes to apps/cloud/src (1 of 6 files). Show all

Unified · Split

apps/cloud/src/mcp/session-durable-object.ts+4−0
@@ -379,6 +379,10 @@ export class McpSessionDOSqlite extends McpAgentSessionDOBase<Env, CloudSessionD · 378 unmodified lines
379 // the negotiated apps support comes back from storage instead.379 // the negotiated apps support comes back from storage instead.
380 restoredAppsEnabled: sessionMeta.appsEnabled ?? false,380 restoredAppsEnabled: sessionMeta.appsEnabled ?? false,
381 onAppsEnabledChange: (appsEnabled) => self.persistAppsEnabled(appsEnabled),381 onAppsEnabledChange: (appsEnabled) => self.persistAppsEnabled(appsEnabled),
382 // Same restore contract for the client identity that keys the
383 // `mcp.client.*` span attribution on execution spans.
384 ...(sessionMeta.clientInfo ? { restoredClientInfo: sessionMeta.clientInfo } : {}),
385 onClientInfoChange: (clientInfo) => self.persistClientInfo(clientInfo),
382 appsEnabled: false,386 appsEnabled: false,
383 sessionful: true,387 sessionful: true,
384 requestStateSigningKey: self.modernRequestStateSigningKey(),388 requestStateSigningKey: self.modernRequestStateSigningKey(),