Repository navigation
Integrate parallel oracle streaming and defer hot-path logging - #7
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates the “parallel LLM streaming” oracle server into server_oracle.py, adds session-guarding to prevent stale background work from affecting new connections, and moves hot-path console/session logging off the asyncio audio loop via a bounded background logger.
Changes:
- Integrate a parallel LLM stream multiplexer into
server_oracle.pyand makeserver_oracle_parallel.pya compatibility shim. - Add deferred (threaded) session logging and update the audio loop to time-slice application of queued oracle updates (~2ms budget).
- Add unit tests covering deferred logging and key multiplexer/session-guard behaviors.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_server_oracle_logging.py | Adds tests for deferred session logging integration and multiplexer session/adoption behavior. |
| tests/test_deferred_logging.py | Adds focused unit tests for DeferredSessionLogger correctness and noop behavior when disabled. |
| src/kame/server_oracle.py | Becomes the canonical entrypoint; integrates parallel LLM streaming, session guards, deferred logging, and time-sliced oracle event application. |
| src/kame/server_oracle_parallel.py | Replaced with a thin compatibility entrypoint forwarding to server_oracle.cli. |
| src/kame/deferred_logging.py | New deferred logger implementation using a bounded queue and background thread. |
| README.md | Updates documentation to use kame.server_oracle as the entrypoint instead of the former parallel module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yagumana
marked this pull request as ready for review
July 15, 2026 06:08
Kuroki1931
reviewed
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
server_oracle.pyand keep it as the canonical oracle-guided entrypoint.server_oracle_parallel.pywith a compatibility shim.Why
PR #5 introduced parallel LLM streaming as a separate server entrypoint. This PR consolidates that implementation into the canonical oracle server,
avoiding two independent implementations of the same inference path.
Parallel streaming can produce many LLM chunks while the same event-loop thread is responsible for audio processing. Synchronous console and file
logging, combined with draining all queued oracle updates in one pass, could keep the audio loop busy for hundreds of milliseconds and cause audible
interruptions.
Deferred logging removes file and console I/O from the audio path. Time-slicing queued oracle updates ensures that any remaining backlog is handled in
later audio-loop iterations instead of delaying audio processing until the queue is empty.
Behavior and scope
opus_loopas the only writer toLMGen; parallel LLM tasks only enqueue oracle updates.Validation
Static and unit checks:
A controlled end-to-end audio-path smoke test used the real KAME/Moshi and Mimi path with deterministic oracle chunks. OpenAI streaming and ASR were
disabled so the test could isolate audio continuity under oracle-update and logging load.
A manual comparison using the public Hugging Face checkpoint was also performed against the same parallel branch before and after the logging change:
The manual comparison validates runtime continuity and is not intended as a deterministic benchmark of conversational response quality.