fix(host): guard terminal metric snapshots (round 6 review)

This commit is contained in:
Hypatia May
2026-07-28 16:05:43 +08:00
parent 8de4760141
commit 5340aedb8b
2 changed files with 44 additions and 1 deletions

View File

@@ -422,7 +422,7 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
/** Pair a registry agent only with the exact Session lifecycle it owns. */
function metricsAgentFor(session: Session): Agent | undefined {
const agent = ctx.agents.get(session.id)
const agent = ctx.get('agents')?.get(session.id)
return agent?.session === session ? agent : undefined
}