You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to access totalPremiumRequests and other data from the session.shutdown event but never see it fire. I log every event type from session.on() and get assistant.usage, session.idle, etc but never session.shutdown.
My sessions are long-lived and reused, so destroy() isn't called during normal use. On process exit I call client.stop() (which calls destroy() internally) but still nothing shows up. Looking at the source, it looks like destroy() clears all event handlers right after the RPC resolves, which might be before the shutdown notification arrives.
I've labeled this as sdk/nodejs and question. You've identified an interesting timing issue where destroy() clears event handlers right after the RPC resolves, potentially before the session.shutdown notification arrives.
The team will take a look at the intended usage pattern for accessing shutdown event data like totalPremiumRequests in long-lived sessions.
ahhh I was just about to raise the same problem - I need the shutdown event!
At the moment there is no way that I can see to end a session and get the session usage metrics.
Any progress on this? I could use the shutdown event as well. I'm currently evaluating token usage for a variety of agent POCs. In the mean time I can get from the event logs if needed, but it would be nice to collect the stats with an event handler.
Activity
github-actions commentedon Feb 17, 2026
Thanks for opening this issue, @theblixguy!
I've labeled this as
sdk/nodejsandquestion. You've identified an interesting timing issue wheredestroy()clears event handlers right after the RPC resolves, potentially before thesession.shutdownnotification arrives.The team will take a look at the intended usage pattern for accessing shutdown event data like
totalPremiumRequestsin long-lived sessions.Stono commentedon Apr 13, 2026
ahhh I was just about to raise the same problem - I need the shutdown event!
At the moment there is no way that I can see to end a session and get the session usage metrics.
jackcan2 commentedon Jun 12, 2026
Any progress on this? I could use the shutdown event as well. I'm currently evaluating token usage for a variety of agent POCs. In the mean time I can get from the event logs if needed, but it would be nice to collect the stats with an event handler.
kaawmnain24-netizen commentedon Aug 5, 2026