Summary of changes
A sentence said in a live voice talk is handled once. Inside a talk the realtime model hears the audio itself and the input transcript is never sent back to it, so the double handling came from what happens to the talk's lines afterwards:
- Try Again after a talk. A talk that ended on a problem note (connection lost, the server did not answer) put its lines in the chat ending on that note, so the chat offered Try Again, and Try Again sent the talk's last sentence to the chat agent, which did it a second time. A talk's lines are now marked as spoken (
ChatEntry.spoken, nil in older saves) and Try Again only offers a typed request. The bear still trips on the problem (ChatModel.endedOnProblem). - "Continue" in the chat. The restored session's task to continue and its "Latest task" took the talk's sentence, so asking the chat to continue redid it. Spoken lines are skipped there and read as "Live talk, already handled" in the agent's context.
- The next talk within 5 minutes. The carried-over note listed only what was said, so a request whose answer was cut off (End while Poki spoke) read as still to do. It now lists each step Poki ran with how it ended (done, failed, still running) and says nothing in it is to be answered or redone. On #495's Gemini Live this note is a user turn, so the wording matters there too.
- Order of the words. The transcript of what the person said arrives on its own, often after the answer. It is now placed where the person spoke, by the item id the realtime API sends; without an id (the Gemini adapter) it is appended as before.
Motivation (Closes #N)
Part of #529: the 0.4.6 blocker "Voice: possible double handling of the input transcript". It does not close #529, which lists other items.
Test plan
New tests, what each protects, and a change that makes it fail:
VoiceModelTests.testWordsTranscribedAfterTheAnswerStandBeforeIt: a transcript arriving after its step and answer is placed before them; one with no item id is appended. Fails ifhearappends always.VoiceModelTests.testTheNextTalkIsToldWhatAlreadyRanForARequestWhoseAnswerWasCutOff: a talk stopped after a step finished; the next talk's note lists the sentence and "Poki ran do …: done", and no response is asked for. Fails ifcarrieddrops the steps.VoiceModelTests.testTheCarriedTurnsSayHowEachStepEnded: the done, failed and still running lines.ChatHarnessTests.testATalksWordsInTheChatAreNeverSentToTheAgentAgain: a restored talk that ended on a problem offers no Try Again, sends nothing on retry, has no task to continue and labels the talk in the agent's context; a typed request after it is still retried, alone. Fails ifretryableorcontinuationTaskstop skipping spoken entries.
CI, the iOS app workflow on GitHub's runners: run 44595873428, this head on a throwaway branch with #525's Approvals.swift build fix and #481's test runner fixes (main's app does not build or run its tests without them), running VoiceModelTests, SessionArchiveTests and the new chat test. The app builds; 36 of 37 tests pass, all 27 VoiceModelTests among them. SessionArchiveTests.testTheLimitNeverTakesAnArchivedConversation fails on its file check (the trimmed conversation's file is removed on the write queue after the check), in code this PR does not change; SessionArchiveTests also failed on #525's run without this change.
Not run on a physical iPhone.
Screenshots or screen recording
N/A. No screen changes; Try Again no longer shows after a talk that ended on a problem.
AI assistance: Claude Code. I have reviewed and understand these changes.
Thank you for tracing what happens after a call ends. We’d like the retry, continuation, and transcript-ordering fixes. For the next call, please carry over the tool name and outcome without the original arguments.