session/database: InputTranscription and OutputTranscription are not persisted
Required Information
Describe the Bug:
The database session service (session/database) does not persist LLMResponse.InputTranscription or LLMResponse.OutputTranscription. An event appended with transcriptions comes back from Get with both fields nil.
storageEvent (session/database/storage_session.go) has no column for either field, and neither createStorageEvent nor createEventFromStorageEvent maps them. adk-python's v0 events table does have them (input_transcription and output_transcription in src/google/adk/sessions/schemas/v0.py), so the Go schema is behind the one it mirrors. Any live/audio session stored in a database loses its transcripts after a reload. The in-memory service keeps them, because it stores the *session.Event directly.
#576 mentions this gap in passing, as part of the broader proposal to move to adk-python's single-JSON v1 schema. This issue covers only the two missing v0 columns.
Steps to Reproduce:
Add this test to session/database/service_test.go and run go test ./session/database -run TranscriptionsRoundTrip:
func TestDatabaseService_AppendEvent_TranscriptionsRoundTrip(t *testing.T) {
ctx := t.Context()
s := emptyService(t)
created, err := s.Create(ctx, &session.CreateRequest{AppName: "app", UserID: "user"})
if err != nil {
t.Fatalf("Create: %v", err)
}
event := &session.Event{ID: "live_event", Author: "agent"}
event.InputTranscription = &genai.Transcription{Text: "what time is it", Finished: true}
event.OutputTranscription = &genai.Transcription{Text: "it is noon"}
if err := s.AppendEvent(ctx, created.Session, event); err != nil {
t.Fatalf("AppendEvent: %v", err)
}
got, err := s.Get(ctx, &session.GetRequest{AppName: "app", UserID: "user", SessionID: created.Session.ID()})
if err != nil {
t.Fatalf("Get: %v", err)
}
ev := got.Session.Events().At(0)
if diff := cmp.Diff(event.InputTranscription, ev.InputTranscription); diff != "" {
t.Errorf("InputTranscription mismatch (-want +got):\n%s", diff)
}
if diff := cmp.Diff(event.OutputTranscription, ev.OutputTranscription); diff != "" {
t.Errorf("OutputTranscription mismatch (-want +got):\n%s", diff)
}
}Expected Behavior:
Both transcriptions come back unchanged, the same as with the in-memory service.
Observed Behavior:
--- FAIL: TestDatabaseService_AppendEvent_TranscriptionsRoundTrip (0.00s)
service_test.go:137: InputTranscription mismatch (-want +got):
(*genai.Transcription)(
- &{Text: "what time is it", Finished: true},
+ nil,
)
service_test.go:140: OutputTranscription mismatch (-want +got):
(*genai.Transcription)(
- &{Text: "it is noon"},
+ nil,
)Environment Details:
- ADK Library Version: v2.4.0 /
main@ 12f7cabc - OS: macOS (not OS-specific)
- Go Version: 1.26.6
Model Information:
- N/A (storage layer only; affects any live model that produces transcriptions)
Proposed fix
Add InputTranscription and OutputTranscription dynamicJSON columns to storageEvent. GORM's default naming turns these into input_transcription and output_transcription, the same names adk-python uses. Then marshal and unmarshal them alongside the other LLMResponse JSON fields. I have this working locally with the test above: 2 files, about 75 lines, and go test -race ./session/... passes.
One question before I open the PR: the change adds two columns.
- A Go-created database that is kept up to date with
database.AutoMigratepicks the columns up automatically. - A database created by adk-python already has them, so this also improves cross-SDK compatibility.
- A Go-created database whose schema is managed outside
AutoMigratewould fail on insert until the columns are added.
Is adding the columns in a minor release acceptable (with a release note), or would you prefer to hold this for the #576 schema work? I'm happy to open the PR now or fold it into that effort.
Source: google/adk-go