Skip to content

Fix nine review comments from agentic-call PR#35

Merged
codingjoe merged 10 commits intoagentfrom
copilot/sub-pr-34
Mar 15, 2026
Merged

Fix nine review comments from agentic-call PR#35
codingjoe merged 10 commits intoagentfrom
copilot/sub-pr-34

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

Addresses all review feedback from the agentic call PR across correctness, API hygiene, and documentation issues.

Correctness

  • audio.py – Replace G.711-only _estimate_payload_rms (byte std-dev proxy) with true PCM RMS (√mean(audio²)) computed from decoded float32, making VAD accurate for Opus and G.722
  • ai.py – Fix _flush_speech_buffer minimum-length guard: was comparing chunk count against _sample_rate // 50 * silence_gap (samples); now compares total PCM samples (sum(len(c) for c in _speech_buffer)) against SAMPLE_RATE * silence_gap
  • rtp.py – Catch ValueError from RTPPacket.parse() and log+discard malformed datagrams rather than crashing the UDP protocol

API / Public surface

  • rtp.py – Add Call = RTPCall backward-compat alias (exported in __all__)
  • sip/types.py – Add DigestAlgorithm and DigestQoP to __all__
  • __main__.py – Fix --system-prompt defaulting to None causing TypeError in AgentCall.__post_init__; system_prompt is only overridden in AgentCallWithOutput when the CLI option is explicitly supplied:
@dataclasses.dataclass(kw_only=True)
class AgentCallWithOutput(AgentCall):
    ...
    if _system_prompt is not None:
        system_prompt: str = dataclasses.field(default=_system_prompt)

Docs / docstrings

  • srtp.py – Fix broken RFC 4568 URL (rfc456rfc4568)
  • docs/calls.md – Convert bare [voip.rtp]/[RTPCall] to mkdocstrings cross-reference syntax
  • ai.py – Update AgentState docstring to match actual behaviour (response task cancelled in transcription_received, not via a VAD hook)

Tests

  • Fix TestCallCompatShim no-op assertion (RTPCall is RTPCallCall is RTPCall)
  • Add test covering malformed-datagram discard in RealtimeTransportProtocol

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.98%. Comparing base (c929753) to head (2f9b44a).
⚠️ Report is 12 commits behind head on agent.

Files with missing lines Patch % Lines
voip/__main__.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            agent      #35      +/-   ##
==========================================
- Coverage   94.06%   93.98%   -0.08%     
==========================================
  Files          17       17              
  Lines        1568     1564       -4     
==========================================
- Hits         1475     1470       -5     
- Misses         93       94       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 15, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • releases.astral.sh
    • Triggering command: /home/REDACTED/.local/bin/uv uv run pytest tests/ -x -q --tb=short (dns block)
  • stun.cloudflare.com
    • Triggering command: /home/REDACTED/work/VoIP/VoIP/.venv/bin/pytest pytest tests/ -x -q --tb=short (dns block)
    • Triggering command: /home/REDACTED/work/VoIP/VoIP/.venv/bin/pytest pytest tests/ -q --tb=short (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] [#26] Add agentic call functionality to VoIP library Fix nine review comments from agentic-call PR Mar 15, 2026
Copilot AI requested a review from codingjoe March 15, 2026 15:18
@codingjoe codingjoe marked this pull request as ready for review March 15, 2026 16:22
Copilot AI review requested due to automatic review settings March 15, 2026 16:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to address prior review feedback for the “agentic call” work by improving RTP robustness, making VAD/RMS calculations codec-correct, cleaning up exported symbols, updating docs, and adjusting tests accordingly.

Changes:

  • Update audio decoding/VAD plumbing to compute RMS from decoded PCM instead of G.711 payload bytes.
  • Make RTP receive path resilient to malformed datagrams by catching parse failures and discarding packets.
  • Adjust public exports/docs and refactor tests (move RTPCall tests into tests/test_rtp.py, remove outdated RMS tests, tweak CLI system-prompt overriding).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
voip/srtp.py Fix RFC 4568 reference URL in module docstring.
voip/sip/types.py Export DigestAlgorithm / DigestQoP via __all__.
voip/rtp.py Discard malformed RTP datagrams instead of raising from RTPPacket.parse().
voip/audio.py Compute RMS from decoded float PCM; introduce resampling_rate and adjust resampler rate usage.
voip/ai.py Adjust VAD parameters/guards; remove AgentState and some method docstrings.
voip/main.py Only override system_prompt field when CLI option is explicitly provided.
tests/test_rtp.py Add malformed-packet discard test; move RTPCall base-class tests here.
tests/test_call.py Remove standalone RTPCall/compat shim test module (tests moved).
tests/test_audio.py Remove tests for deleted _estimate_payload_rms.
docs/calls.md Update wording and mkdocstrings cross-references for call handler docs.
Comments suppressed due to low confidence (2)

voip/ai.py:90

  • The docstring for TranscribeCall.audio_received was removed, leaving a key overridable hook undocumented while adjacent helper methods retain docstrings. If this method is part of the intended extension surface (and appears in generated docs), consider restoring a concise docstring describing audio and rms semantics.
    def audio_received(self, *, audio: np.ndarray, rms: float) -> None:
        self._speech_buffer.append(audio)
        if rms > self.speech_threshold:
            self._on_audio_speech()
        else:

voip/audio.py:272

  • The docstring for _decode_raw references SAMPLE_RATE, but SAMPLE_RATE is no longer defined in this module. Also, rms passed into audio_received is now computed from decoded PCM (audio), so the surrounding documentation that describes an RTP-payload-byte proxy is now out of date.
                audio=audio, rms=float(np.sqrt(np.mean(np.square(audio))))
            )

    def _decode_raw(self, packet: bytes) -> np.ndarray:
        """Decode raw RTP payloads to a float32 PCM array at :data:`SAMPLE_RATE` Hz.

You can also share your feedback on Copilot code review. Take the survey.

codingjoe and others added 2 commits March 15, 2026 17:34
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@codingjoe codingjoe merged commit ef7d91a into agent Mar 15, 2026
17 of 19 checks passed
@codingjoe codingjoe deleted the copilot/sub-pr-34 branch March 15, 2026 16:38
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.

3 participants