Skip to content

Detect click/pop discontinuities with bounded PCM evidence - #13

Merged
engkimo merged 2 commits into
engkimo:mainfrom
9o6:fix/issue-4-click-pop
Sep 7, 2026
Merged

Detect click/pop discontinuities with bounded PCM evidence#13
engkimo merged 2 commits into
engkimo:mainfrom
9o6:fix/issue-4-click-pop

Conversation

@9o6

@9o6 9o6 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Closes #4

Summary

  • add a deterministic PCM16 adjacent-sample discontinuity detector across chunk boundaries
  • preserve stage media time separately from wall-clock event time and deduplicate adjacent detections
  • project bounded incidents with optional nearby queue-clear/barge-in evidence and an explicit remote playout boundary
  • document the detector contract, thresholds, silence handling, and proof limitations

Testing

  • python3 -m ruff check src/voxbench/observability/observer.py src/voxbench/observability/__init__.py src/voxbench/control_plane/run_api.py tests/test_observability.py
  • python3 -m pytest -q (330 passed, 4 skipped)

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: c1b6f2d3-e97a-41ea-a341-78cef2aaf451


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@engkimo engkimo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The detector contract and bounded evidence projection look good, and the full test/build suite passes. One concurrency issue should be fixed before merge.

observe_stage_audio() reads _stage_pcm_state before acquiring _lock, then later updates that state inside the lock. Concurrent calls for the same stage can both consume the same previous sample/frame offset and overwrite each other, which can lose a chunk-boundary discontinuity, roll back media time, or bypass the 5 ms dedup state. Since this is stateful cross-chunk analysis, please serialize the read → detect → state update sequence for each stage (or otherwise make it atomic), and add a focused concurrent-call regression test.

@9o6

9o6 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the concurrency issue in 394c76a. The per-stage PCM state read, discontinuity detection, dedup decision, media-frame advancement, and state update now execute in one observer lock section.

I also added a focused concurrent-call regression test that pauses the first detector invocation, starts a second call for the same stage, verifies the detector invocations are serialized, and confirms both boundaries retain monotonic media times (5 ms and 10 ms).

Validation:

  • ruff check .
  • pytest -q — 331 passed, 4 skipped

@engkimo engkimo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the concurrency fix. The stage PCM state read, discontinuity detection, dedup decision, and state update are now serialized under the observer lock, and the focused concurrent-call regression test verifies that the second call cannot consume stale state. The observability tests pass locally (29 passed), and the required Python, web build, and security checks are green. Approved.

@engkimo
engkimo merged commit ae575b6 into engkimo:main Sep 7, 2026
4 checks passed
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.

Detect click/pop discontinuities and correlate them with playback events

2 participants