Skip to content

Fix quadratic Wyoming audio buffering - #634

Merged
basnijholt merged 4 commits into
mainfrom
fix/wyoming-bytearray-buffer
Aug 13, 2026
Merged

Fix quadratic Wyoming audio buffering#634
basnijholt merged 4 commits into
mainfrom
fix/wyoming-bytearray-buffer

Conversation

@basnijholt

@basnijholt basnijholt commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • accumulate Wyoming PCM chunks in a mutable bytearray to avoid copying the complete recording for every chunk
  • convert buffered audio to bytes once when recording stops, then reuse the buffer
  • add a regression test that verifies chunk accumulation stays in place
  • pin the Ruff pre-commit hook to the project's 0.15 lint baseline; 0.16 activates repo-wide findings and breaks pre-commit.ci

Testing

  • uv run --all-extras pytest (1477 passed, 4 skipped)
  • uv run ruff check .
  • uv run pre-commit run --all-files

@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown

Greptile Summary

The PR replaces repeated immutable PCM concatenation with in-place bytearray accumulation, converting the buffer to bytes once before WAV creation. It also adds a focused regression test and aligns the pre-commit Ruff hook with the project’s 0.15 tooling baseline.

  • Accumulates converted Wyoming audio chunks without repeatedly copying the complete recording.
  • Preserves the existing WAV and transcription interfaces by converting the completed buffer to bytes.
  • Verifies that multiple chunks retain the same mutable buffer.
  • Pins the pre-commit Ruff hook to v0.15.22.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
agent_cli/server/whisper/wyoming_handler.py Replaces quadratic bytes concatenation with bytearray extension while preserving stop-path audio contents and lifecycle behavior.
tests/test_server_whisper_wyoming.py Adds a regression test confirming that successive audio chunks accumulate in the same buffer.
.pre-commit-config.yaml Pins ruff-pre-commit to v0.15.22 to align with the repository’s Ruff 0.15 baseline.

Reviews (2): Last reviewed commit: "ci: pin Ruff hook to project baseline" | Re-trigger Greptile

@basnijholt
basnijholt merged commit c5abc33 into main Aug 13, 2026
11 checks passed
@basnijholt
basnijholt deleted the fix/wyoming-bytearray-buffer branch August 13, 2026 20:39
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.

1 participant