Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 1:46 PM ET / 17:46 UTC (Revision 20). ClawSweeper reviewWhat this changesThe voice-call plugin stores realtime caller speech before the corresponding assistant reply, avoids duplicate final transcripts, and adds SQLite-backed regression coverage. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still has the reported ordering defect. The latest commit resolves the previous continuity-reset finding, and no blocking defect remains in the reviewed patch. Priority: P2 Review scores
Verification
How this fits togetherThe voice-call plugin receives speech transcripts from realtime providers while handling telephony audio. Its handler sends transcript events through the call manager to the stored call record used for post-call review. flowchart TD
A[Telephony audio] --> B[Realtime voice provider]
B --> C[Caller partials and finalized replies]
C --> D[Voice-call transcript handler]
D --> E[Turn ordering and final deduplication]
E --> F[Call manager write queue]
F --> G[SQLite call transcript]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +214, Tests +471. Total +685 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep one call-manager persistence owner and preserve complete, ordered caller turns across final flushes, consultations, and provider generations. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: run a multi-turn Google Live call using partial caller transcription, then inspect its stored transcript after close; current main persists assistant turns before the cumulative caller final. This review did not execute that path. Is this the best way to solve the issue? Yes, the patch repairs transcript sequencing at the existing handler and manager boundary, and the latest generation-scoping change resolves the prior finding without adding configuration or a competing storage owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c88dd9375fe8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (19 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review The findings from the last review have been addressed on the current head; the PR body now carries a "Review response" section with the reworked behaviour and the after-fix regression tests (names + exact command + observed result). passes on the branch. |
|
🦞👀 Re-review progress:
|
a54c0c2 to
7832d95
Compare
Verification evidence — revision 7 (
|
|
CI:
This PR touches Locally, on the head commit Worth a job re-run before treating it as a merge blocker. |
5694b4b to
a5e633d
Compare
…whole A committed caller turn was claimed by a compact prefix match with no word boundary, so a per-utterance final "high" after a stored "hi" was reduced to "gh". A claim now also requires the match to end where the final ends or where the source skips whitespace; otherwise the final is kept whole. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A per-utterance final such as "hello again" after a stored "hello" matched the committed prefix and was reduced to "again", dropping "hello" from the stored transcript. A committed turn is now claimed only when the text after the claimed turns is exactly what the provider streamed since the last commit, which is what a cumulative flush carries; otherwise the final is kept whole. The cumulative-flush fixtures now stream their tail as a partial before the flush, matching Google Live input transcription traffic. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ts text Every realtime provider finalizes the caller speech it streamed as partials since its previous final, and the handler already records that stream. Use it to decide how much of a final restates committed turns: only the length beyond the stream since the last commit. A final no longer than that stream is one new utterance, so a caller who repeats a stored "yes" keeps both turns. Text matching now only verifies the accounting and returns the final whole on any mismatch, which retires the word-boundary heuristic. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ialogue test main keeps the lifecycle harness's no-op StreamDisconnectLifecycle module-private, so the named import no longer exists (TS2459), leaving the handler's stream-disconnect lifecycle undefined at runtime.
The 1,200-char partial cap also bounded the raw buffer that caller turns are persisted from, and the final's reduction skipped the dropped prefix as if it had been stored. Bound only the consult buffer and keep the raw stream whole.
…ontext A completed consultation consumed the caller's raw persistence deltas along with its own bounded context, so a partial-only provider's turn was never committed at the assistant boundary and the cumulative close final was stored whole, duplicating the earlier turns. The consult path now spends only its context; the storage path alone consumes the deltas. Co-Authored-By: Claude Opus 5.5 <[email protected]>
89214f6 to
8e8e857
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
A non-resumable reconnect drops the provider's accumulated input transcript and emits session.continuity.reset, but the committed-caller ledger lived for the whole bridge. The replacement session's cumulative flush was then reduced against turns the previous session committed, failed to align, and stored its already-committed text a second time. Rebind the ledger on the continuity reset, alongside the generation bump. A caller final captures the ledger when it is created, so a flush deferred behind an in-flight turn write still reduces against the generation it belongs to.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Fixes realtime voice-call transcripts recording a late-finalized caller turn after its assistant reply. Carry observed turn starts into the existing transcript-append owner and retain repeated utterances. Supersedes #159143, thanks @mnowrot. Related: #159138 The 65-line regression allocation covers real carrier WebSocket ingress through persisted SQLite dialogue order, including partial-text and speech-start paths and repeated caller phrases. Both cases failed on main; 132 focused tests and touched-file lint/format pass remotely. Independent Codex autoreview P0-P2 was scoped-clean. Co-authored-by: Marcin Nowrot <[email protected]>
…law#191602) Fixes realtime voice-call transcripts recording a late-finalized caller turn after its assistant reply. Carry observed turn starts into the existing transcript-append owner and retain repeated utterances. Supersedes openclaw#159143, thanks @mnowrot. Related: openclaw#159138 The 65-line regression allocation covers real carrier WebSocket ingress through persisted SQLite dialogue order, including partial-text and speech-start paths and repeated caller phrases. Both cases failed on main; 132 focused tests and touched-file lint/format pass remotely. Independent Codex autoreview P0-P2 was scoped-clean. Co-authored-by: Marcin Nowrot <[email protected]>
Closes #159138
What Problem This Solves
A realtime voice call's stored transcript read as all of the agent's lines followed by one glued blob of everything the caller said, instead of an alternating conversation.
User Impact
Post-call transcripts can be read and attributed turn by turn: the caller's words appear in the right place in the dialogue rather than being dumped at the end.
Why This Change Was Made
Under the Google realtime provider the caller side arrives only as partials, so the plugin persisted nothing for the caller until the provider's single end-of-call flush.
The handler now commits the pending caller partial as its own
call.speechentry immediately before the first assistant entry of each turn, and the end-of-call flush is reduced to the suffix the committed-caller ledger does not already cover.Getting that order right required changing how the writes are issued. Every transcript write used to be chained onto one
transcriptPersistencepromise, so a write was only issued after the previous one settled. Writes are now issued immediately and ordered by the manager's keyed mutation queue, and every issued write is accumulated into the tracked promise so shutdown waits for all of them instead of only the most recent.Consequences of that change, each covered by a test:
Evidence
28 stored realtime calls showed the bot-block/caller-blob shape (e.g.
9181a17b21 assistant entries then one user entry;bd9c0eed15 then one). After the change, entries interleave per turn.New
extensions/voice-call/src/webhook/realtime-handler.transcript-store.test.tsasserts on the persisted transcript rather than the manager mock, covering:stores each caller turn ahead of the reply it answered- a normal multi-turn call.finishes a queued caller turn write before shutdown completes- provider close with a queued turn write.stores the reply paired with a failed caller turn and recovers that turn at flush- a caller-write failure together with its assistant reply.It opens a real state database, like the already-registered
extensions/voice-call/src/manager/store.test.ts, so it is listed in the extension database-worker fork lane.Commands and results (all from a clean worktree at this head):
node scripts/run-vitest.mjs extensions/voice-call/src/webhook/realtime-handler.test.ts extensions/voice-call/src/webhook/realtime-handler.lifecycle.test.ts extensions/voice-call/src/webhook/realtime-handler.persistence.test.ts extensions/voice-call/src/webhook/realtime-handler.transcript-store.test.ts->
111 passed+3 passed, 0 failed.pnpm test:extensions:batch voice-call-> 76 files,147 passed(extension-database-workers) and684 passed / 9 failed(extension-voice-call). All 9 failures are inextensions/voice-call/index.test.tsandextensions/voice-call/index.lifecycle.test.ts, which this PR does not touch; see "Unrelated failures" below.node scripts/run-oxlint.mjs --tsconfig extensions/tsconfig.json extensions/voice-call/src/webhook-> exit 0.Measured cost of the new file (
pnpm test <file> --maxWorkers=1): 17.3 s wall, 14.7 s Vitest duration, of which 13% (~1.9 s) is test time; the rest is cold transform/import. Peak RSS 538 MB. Under the 5 s test-time target in writing tests. No real timers, sleeps, or polling - it drives the handler through deferreds - and each case gets its own state directory fromcreateManagerHarness. CI seconds to follow once the run exists.node scripts/run-vitest.mjs test/vitest-projects-config.test.ts test/vitest-scoped-config.test.ts test/scripts/extension-test-plan.test.ts->3 files / 567 passed(covers the database-worker path registration). A wider run includingtest/scripts/test-projects.test.ts,test/scripts/test-extension.test.tsandtest/scripts/ci-changed-node-test-plan.test.tsalso passed6 files / 2693 passed.Correcting the previous evidence in this PR
An earlier revision of this description claimed that
assigns unique event IDs to finalized chunks received in the same millisecondandwaits for shutdown transcript durability (failure=false|true)"also fail on unmodified upstream main". That was wrong. Those tests pass onmain; they were regressions introduced by this branch's deferred persistence chain, which delayedcall.assistant-speechpast the tick those tests observe. They pass now.check-test-typesThe full-graph extension test type check (
pnpm tsgo:extensions:test) cannot run on the machine used here - it OOM-kills at ~6 GB RSS on 7.7 GB of RAM without producing atsbuildinfo- so the lane itself is left to CI. Instead the same compiler was run over a scoped project containing onlyextensions/voice-call/**/*.test.tsplus the repository's.d.tsinputs, throughnode scripts/run-tsgo.mjs -p <scoped tsconfig>: exit 0 in ~35 s at ~3.9 GB peak RSS.That scoped check reproduces the lane failure. The red
check-test-typeslane was caused by this branch, not by upstream. The previous head addedDestructuring inside the predicate gives no type-guard narrowing, and
transcriptexists on only two ofNormalizedEvent's union members, so.transcriptis aTS2339. Both occurrences are rewritten as map-then-filter, which narrows. No suppression was added.Verified in both directions on the scoped project: restoring the previous head's version of that one file reproduces the lane failure exactly -
Unrelated failures
extensions/voice-call/index.test.ts(3 tests) andextensions/voice-call/index.lifecycle.test.ts(6 tests) fail in theextension-voice-callproject. They are about plugin registration and runtime-generation lifecycle, not transcripts, and this PR does not modify them orindex.ts.Attribution check: reverting
extensions/voice-call/src/webhook/realtime-handler.ts- the only production file this PR changes - to its merge-base content and re-running those two files reproduces the same failures. The symptoms (expected "vi.fn()" to be called 1 times, but got 0 timesfor the mockedcreateVoiceCallRuntime, andexpected '' to contain 'Runtime not started: setup incomplete') point at the plugin registration fixture, and the reproduction host was a source-only worktree with no built artifacts. Left to CI; not addressed here.🤖 Generated with Claude Code
Round 2 — ClawSweeper Revision 4 findings resolved (
a54c0c2c)[P2] Retain the caller ledger until the final flush has drained. The committed-caller
ledger was handler state keyed by call ID, and the provider close callback deleted it. Google
Live flushes its accumulated caller transcript and only then notifies close, so with a caller
turn write still in flight the deferred flush read an already-deleted ledger and re-stored the
whole caller transcript. The ledger now belongs to the bridge that wrote those turns, so it
outlives the close callback and a replacement connection starts its own; no call-keyed state
and no close-time cleanup remain.
[P2] Preserve repeated per-utterance final transcripts. Reduction let any committed text
consume an incoming final (
compactCommitted.includes(compact)), so a provider that finalizeseach utterance lost a repeated later utterance — a final "yes" counted as old speech because an
earlier turn already contained the word. A final now claims only the turns it restates from the
start, which is the cumulative-flush contract, and each claimed turn is released, so repeated
finals are stored once and a caller who repeats a phrase keeps both turns.
Verification
node scripts/run-vitest.mjs extensions/voice-call/src/webhook/tsgo -p .artifacts/tsconfig.voice-call-test.json)oxlint+oxfmt --checkon the changed files4c6ed3e3"yes goodbye"), dropped repeat (missing"yes"), duplicated repeat (extra"yes")New tests cost: the whole
realtime-handler.transcript-store.test.tsfile is 6 tests in23.7 s wall / 20.5 s duration, 534 MB peak RSS at
--maxWorkers=1(3 tests were 17.3 s /538 MB), so the 3 added cases reuse an existing fixture rather than paying a new setup.
Real Google Live proof (after fix, real transport)
A real multi-turn Google Live call ran through the PR's handler (
realtime-handler.tsblob13e2b1b4, head7832d952), the real Google realtime provider, and the real SQLite call store. I read the stored transcriptback after close.
The transport was not mocked. No
vi.mock, no network stubbing, and no syntheticLiveServerMessageframes were used. The provider's real
createGoogleGenAI()→@google/genaiLive.connect()opened a TLSwebsocket to
generativelanguage.googleapis.com. The round-2 mock ofgoogle-genai-runtime.jsis removed.The caller audio is real speech: Google TTS (
gemini-3.1-flash-tts-preview, 24 kHz PCM) →ffmpeg→G.711 μ-law 8 kHz. It was streamed as Twilio
mediaframes (160 B every 20 ms, in real time) into thehandler's carrier websocket, and Google's own ASR produced the caller transcripts.
The close window. On caller turn 3, I called
bridge.close()on the Google bridge in the same synchronoustick as the assistant's final reply transcript. At that moment the turn-3 caller write had just been issued
and was still in flight.
close()then flushed Google's accumulated caller text for the whole call as onefinal, before
onClose. This is the path ClawSweeper flagged. Limitation: this is the client-side close(the hang-up path), not a close initiated by Google's server.
wss://generativelanguage.googleapis.com//ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent?key=<redacted>authorized=true, SNIgenerativelanguage.googleapis.com, issuer Google Trust ServicessetupCompleteonReadyfired; SDKsession.setupComplete={}(set only from a server frame)inputTranscriptionframes match the provider callbacks (e.g." ca","pital")gemini-2.5-flash-native-audio-preview-12-2025(partial caller text + cumulative flush on close); siblinggemini-3.1-flash-live-preview(default)residualChars=0after fix;residualChars=71on4c6ed3e34c6ed3e3: 7 (whole caller transcript re-stored)Stored transcript after close (after fix, 2.5 native audio)
Same harness on
4c6ed3e3's handler (before)Default model
gemini-3.1-flash-live-preview(after fix)3.1 emits each caller utterance as one complete final, so at close it has no pending caller text to flush.
Redacted after-fix runtime trace (2.5 native audio, abridged: caller partials 1–2 and assistant deltas omitted)
Observed on the real transport: "ca pital"
Google 2.5 splits words across
inputTranscriptionframes (" ca","pital"). The committed caller turncomes from the handler's smart-joined partial buffer (
appendTranscriptText), which puts a space between thefragments. Google's own final and the raw concatenation both read "capital". Base main stored the provider
final and never committed partials, so this PR introduced the spacing. It affects stored text only;
ordering, deduplication, and the close-time reduction are unaffected (the reduction compares
whitespace-insensitively). Recorded as a follow-up and not fixed in this revision.
The harness was a temporary vitest file driven by
node scripts/run-vitest.mjsin theextension-database-workersproject, withGEMINI_API_KEYtaken from the environment. It was removed aftercapture and is not part of this diff.