fix: call piSession.dispose() in AgentService.destroySession #62
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
AgentService.destroySession()callssession.unsubscribe()and clears listeners, but never callssession.piSession.dispose(). The Pi SDK'sdispose()method is the intended shutdown path — it removes all internal listeners and disconnects from the agent. Without it, the PiAgentSessionobject and its underlying agent remain in memory with internal subscriptions alive, preventing GC and potentially leaving background work running.Location
apps/gateway/src/agent/agent.service.ts—destroySession()methodFix
Add
session.piSession.dispose()afterunsubscribe()in the destroy path. Wrap in try-catch consistent with existing error handling.Found by
Gatekeeper review (communication spine PR #61)