Skip to content

feat: add session end lifecycle callback - #2387

Open
chenghao-mou wants to merge 10 commits into
mainfrom
chenghao/feat/AGT-3407-add-session-end-hook
Open

feat: add session end lifecycle callback#2387
chenghao-mou wants to merge 10 commits into
mainfrom
chenghao/feat/AGT-3407-add-session-end-hook

Conversation

@chenghao-mou

Copy link
Copy Markdown
Member

Behavior: Add onSessionEnd after the primary session closes and before internal report generation. Bound the callback to 300 seconds, then flush final OTEL logs after shutdown callbacks.

Parity: Apply Python's 30-second connect and 900-second total deadlines to session report uploads. Retry only connection setup failures or responses with RetryInfo.

Validation: Agents tests, build, typecheck, lint, format, and throws checks pass. The API check still reports unrelated baseline drift.

Addresses AGT-3407
Addresses #2375

Initial prompt and agent context

Model: GPT-5.6

can you review the issue from #2375

okay, we should port over the relevant changes

session report should inherit the 30/900 timeout values, right?

okay, can you add them in the port as well?

okay, create a PR.

@chenghao-mou
chenghao-mou requested a review from a team as a code owner August 31, 2026 10:35
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d911119

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 39 packages
Name Type
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-azure Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-krisp Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-protoface Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Use SIGKILL when the supervisor must stop a child. Job processes consume SIGTERM, so the default Node kill signal cannot enforce shutdown or memory limits.
ProcPool.close could return while on-demand job children still ran, allowing CLI shutdown to cut off session-end cleanup. Await every unique executor close alongside watcher tasks.
Cloud session reports use the Python schema. Preserve room and agent_name instead of renaming these transport fields for log redaction.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟥 Room names bypass telemetry redaction

Session reports export room names under unmarked room. PII-enabled collectors cannot strip these customer-controlled names.

(Refers to this code)

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟥 Agent names bypass telemetry redaction

Session reports export agent names under unmarked agent_name. PII-enabled collectors cannot strip these potentially customer-defined names.

(Refers to this code)

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant