Fix: Add started_at/duration in SessionReport.to_dict() and drop a duplicated assignment#6258
Open
TimCares wants to merge 1 commit into
Open
Fix: Add started_at/duration in SessionReport.to_dict() and drop a duplicated assignment#6258TimCares wants to merge 1 commit into
started_at/duration in SessionReport.to_dict() and drop a duplicated assignment#6258TimCares wants to merge 1 commit into
Conversation
…t.to_dict()` result Also dropped duplicate assignment for `audio_recording_path` and `audio_recording_started_at` in `JobContext.make_session_report`.
Author
|
As mentioned above, I opened a separate design discussion: I am keeping this out of this PR since it would change the meaning of an existing field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello there! While working on monitoring voice AI agents I went through
JobContext.make_session_report/SessionReportand found two small, self-contained issues. Both do not change the semantics of any existing field.
Summary
started_atanddurationare never serialized.SessionReportdefinesboth as fields, but
to_dictnever emits them.timestamp(the "end") is serialized, but the start andthe duration are silently omitted, so they're computed/stored and then lost
on serialization. Consumers of the serialized report (e.g. the local
session_report.jsonwritten during console recording, and anythingdownstream reading
to_dict()) can't see the session start or duration atall, even for audio sessions where
durationis computed.Duplicated assignment in
make_session_report.audio_recording_pathandaudio_recording_started_atare set in theSessionReport-constructor call and then re-assigned again immediately afterwards.The second block is redundant for those two fields, only the
durationlineadds anything.
Changes
started_atanddurationinSessionReport.to_dict().audio_recording_path/audio_recording_started_atinmake_session_report.Backward compat
Adding the two keys to
to_dict()is purely additive. No existing field changesmeaning or type, so consumers (including Cloud observability) are unaffected.
Out of scope
There's a related but separate design question —> what
durationeven isand whether it should be gated on audio recording.
That changes the meaning of an existing field.
I'm intentionally keeping that out of this PR.
I'll open a design discussion and link it in a comment below.