google-gemini / google-gemini/gemini-cli

bug: Whisper transcription drops records split across stdout chunks

Open
#28,648 1 comment 0 reactions 0 assignees View on GitHub
area/core effort/small status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

## What happened?

Local Whisper transcription treats each Node stdout `data` event as if it contained complete newline-delimited records. Stream chunks do not preserve line boundaries, so transcription lines split across chunks are silently dropped.

In `packages/core/src/voice/whisperTranscriptionProvider.ts:90-93`, every chunk is converted to a string and immediately passed to `parseOutput()`. At lines 154-160, that string is split on newlines and each fragment must independently match the complete timestamp regex. No incomplete-line buffer is retained between calls.

## How can this be reproduced?

Feed the provider the following two stdout chunks:

1. `[00:00:00.000 --> 00:00:`
2. `02.000] Hello world.\n`

Neither individual call to `parseOutput()` sees the complete timestamped line, so no transcription event is emitted. Passing the concatenated bytes as a single chunk works, demonstrating that output depends on arbitrary OS chunking.

Splits inside the transcribed text can also produce truncated text or discard the remainder.

## What did you expect to happen?

Parsing should be independent of stdout chunk boundaries. Complete newline-delimited records should be processed after concatenating them with any buffered partial record from the preceding chunk.

## Why this matters

Node streams make no guarantee that process output arrives one line per `data` event. This can cause intermittent missing words or entire speech blocks in normal voice usage.

## Suggested direction

- Keep a decoder-backed pending-text buffer.
- Parse only complete lines on each chunk.
- Preserve the final incomplete segment for the next chunk and flush it on process close.
- Add tests that split a valid line at several positions, including across UTF-8 character boundaries.

## Client information

Found by source audit on current `main`, commit `f47d6c6f7`. The existing provider test covers only the missing-binary error path.

Contributor guide

Open the contributing guide

Research direction

Start in packages/core/src/voice/whisperTranscriptionProvider.ts, especially the stdout handler at lines 90-93 and parseOutput() at lines 154-160. Read the existing provider tests, then add coverage for valid timestamped lines split at several positions, including UTF-8 boundaries. Done means complete records are emitted regardless of chunk boundaries, partial records are retained and flushed on process close, and no text is dropped.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
audio-video-rtc, cli, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.