Skip to content

fix(session/vertexai): persist live transcriptions - #1964

Merged
baptmont merged 2 commits into
google:mainfrom
DisturbedCrow:fix/session-vertexai-transcriptions
Oct 26, 2026
Merged

baptmont merged 2 commits into
google:mainfrom
DisturbedCrow:fix/session-vertexai-transcriptions

Conversation

@DisturbedCrow

Copy link
Copy Markdown
Contributor

Linked issue

Problem:

The Vertex AI session service doesn't save InputTranscription or OutputTranscription. RunLive appends finished transcriptions as their own events with no Content, and since appendEvent doesn't map those fields and eventNeedsRawEvent doesn't ask for raw_event, the events get stored empty. After the session is reloaded, those turns are missing from what the model sees. session/database had the same problem in #1655.

Solution:

eventNeedsRawEvent now returns true when an event has a transcription. The read path already prefers raw_event and decodes the whole event from it, so nothing else had to change.

I used raw_event rather than the EventMetadata transcription fields because that's what adk-python does. It always writes raw_event and never reads or writes those fields, so a session reads back the same from either runtime. Events without a transcription are written exactly as before, which keeps the recorded replays in testdata matching.

I also added the two key names to TestRawEventWireKeysAreCamelCase, since other runtimes read them.

Behavior change

On the Vertex AI session service, events with a transcription are now written with raw_event and come back with the transcription. After a reload, those turns are back in the model's context like they already are with the in-memory and database services, so prompts get a little longer. Events stored before this change stay empty, and events without a transcription are unchanged.

This is for main only. v1 has no raw_event support, so it would need a different fix there.

Testing Plan

Unit Tests:

  • All unit tests pass locally.

go test ./... passes, go test -race ./session/... passes, golangci-lint run (v2.3.1) reports 0 issues and go mod tidy -diff is empty.

With your source change reverted and your tests kept, which test fails?

TestVertexAiClientTranscriptionRoundTrip (both subtests, the transcription comes back nil) and the two new cases in TestEventNeedsRawEvent.

Manual End-to-End (E2E) Tests:

I don't have an Agent Engine project, so I haven't run this against the live service. The round-trip test goes through the real gRPC client against the package's fake SessionService, and an append with no Content carried in raw_event is already covered by the recorded compaction_record_round_trips replay, so the live service accepts that shape.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

While looking at this I noticed the legacy path (no raw_event) also doesn't map Escalate, TransferToAgent or SkipSummarization, and doesn't keep UsageMetadata. I left that out to keep this PR to the one issue, and can open a separate issue for it.

RunLive appends a finished transcription as an event with no Content, so
InputTranscription or OutputTranscription is all the event carries. The
Vertex AI backend wrote neither: they are not mapped to a SessionEvent
field, and eventNeedsRawEvent did not request raw_event for them. The
event was stored empty, and after a reload the contents processor had
nothing to turn back into the user or model turn, so the spoken part of
the conversation was missing from the model's history.

Write raw_event for events that carry a transcription. adk-python keeps
transcriptions in raw_event only and never uses the EventMetadata
transcription fields, so events written here read back the same in both
runtimes. Plain events keep the legacy wire format, so the recorded
replays are unaffected.
@sunny-kavixo

Copy link
Copy Markdown

Hi @DisturbedCrow,

Thanks for opening #1964 and for the detailed explanation.

I've reviewed the proposed changes, particularly the eventNeedsRawEvent handling, the transcription round-trip regression tests, and the cross-runtime serialization coverage.

The approach looks well scoped. I'd like to focus my independent validation on transcription-only events without Content, restored conversation history, and compatibility with events that don't require raw_event.

I'll keep any findings tied to reproducible tests and avoid duplicating the implementation.

Thanks again for the opportunity to review this.

Best regards,
Putluru Sandeep (@sunny-kavixo)

@baptmont
baptmont merged commit c43259a into google:main Oct 26, 2026
14 checks passed
karthik-0306 added a commit to karthik-0306/google-adk-go that referenced this pull request Oct 26, 2026
Resolves the conflict with google#1964 in session/vertexai/vertexai_test.go by keeping both sides' eventNeedsRawEvent cases: the transcription rows from upstream and the cache metadata row from this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
karthik-0306 added a commit to karthik-0306/google-adk-go that referenced this pull request Oct 26, 2026
Resolves the conflict with google#1964 in session/vertexai/vertexai_test.go by keeping both sides' eventNeedsRawEvent cases: the transcription rows from upstream and the cache metadata row from this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session/vertexai drops InputTranscription and OutputTranscription when appending events

3 participants