Skip to content

test(channels): wait for the sendVoice reply in the voice note test - #549

Merged
itsskofficial merged 1 commit into
existence-master:mainfrom
PruthviRajSolase:fix/telegram-voice-test-flaky
Nov 7, 2026
Merged

itsskofficial merged 1 commit into
existence-master:mainfrom
PruthviRajSolase:fix/telegram-voice-test-flaky

Conversation

@PruthviRajSolase

@PruthviRajSolase PruthviRajSolase commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #546

The spoken reply (voice_replies = True) is sent after the text reply, but the test asserted on sendVoice right after tg.say(...) returned. Under load the call hadn't landed yet, so len(voices) == 1 failed.

The test now waits for the sendVoice call with the existing until helper (bounded at 30 s) before asserting. No behaviour change; the assertions that follow are unchanged.

Checked:

  • pytest tests/channels passes (163 passed, 1 skipped)
  • ruff check sentient tests passes
  • the test passed 15/15 repeated runs

Summary by CodeRabbit

  • Tests
    • Updated a voice-reply test to wait for the voice message to be recorded before checking its file payload and confirming no audio message was sent.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7a9f13d8-3124-43ac-8fc1-e4487515694d
Commits

Reviewing files that changed from the base of the PR and between 2a3f848 and b781909.

Files selected for processing: 1
  • tests/channels/test_telegram.py

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

The Telegram voice-reply test now waits for a recorded sendVoice call before it checks the voice payload and confirms that sendAudio was not called.

Changes: Telegram voice-reply test

Layer / File(s) Summary
Wait for the voice reply
tests/channels/test_telegram.py
The test waits for a recorded sendVoice call before it checks the voice payload and confirms that no sendAudio call occurred.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other · Severity of issue fixed: Low

Suggested labels: area: channels

Suggested reviewers: itsskofficial, kabeer2004

Merge Risk: Minimal · up to b7819

The test now waits for the voice reply without weakening its payload checks. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change correctly. The PR makes the voice-note test wait for a sendVoice call before it asserts, and the title says the same. It uses the conventional test(channels) prefix and stay…
Linked Issues check Passed Issue #546 requires a bounded wait for the asynchronous sendVoice call in tests/channels/test_telegram.py::test_voice_note_is_transcribed_and_answered. The PR adds the existing until helper with…
Out of Scope Changes check Passed The PR changes only the timing of the sendVoice assertion in the test named by issue #546. The payload and sendAudio assertions remain unchanged. No unrelated behavior or production code changes a…
Full details: Title check

Explanation

The title names the change correctly. The PR makes the voice-note test wait for a sendVoice call before it asserts, and the title says the same. It uses the conventional test(channels) prefix and stays specific to the sendVoice reply in the voice note test.

Full details: Linked Issues check

Explanation

Issue #546 requires a bounded wait for the asynchronous sendVoice call in tests/channels/test_telegram.py::test_voice_note_is_transcribed_and_answered. The PR adds the existing until helper with a 30-second bound before the sendVoice assertions. The reported channel tests, lint checks, and repeated test runs support the change.

Full details: Out of Scope Changes check

Explanation

The PR changes only the timing of the sendVoice assertion in the test named by issue #546. The payload and sendAudio assertions remain unchanged. No unrelated behavior or production code changes are reported.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit waits while voice calls land
Then checks the payload, neat and grand
No audio call slips past the test
The voice reply gets checked with care
And floppy ears applaud the fix

@github-actions github-actions Bot added the area: channels Telegram, Discord label Nov 2, 2026
@PruthviRajSolase

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Nov 2, 2026
@PruthviRajSolase

Copy link
Copy Markdown
Contributor Author

recheck

@itsskofficial itsskofficial left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Welcome to Sentient, @PruthviRajSolase, and thank you! This is a small, correct fix and I found nothing to change. Approving.

Why it works. The voice reply is sent inside the turn, but wait_idle() gives up silently after 10 s. On a loaded machine the test could therefore reach the assertion before sendVoice happened. Your until(...) polls against a 30 s deadline and raises AssertionError when it runs out, so it waits longer but doesn't hide a failure.

Checked on the voice test, by changing only the audio conversion from a throwaway pytest plugin (repo code untouched):

Reply main This branch
Normal (0.2 s delay) pass pass
Takes 12 s, past wait_idle's 10 s (reproduces #546) fails, assert 0 == 1 pass
Never sent fails, assert 0 == 1 fails at the deadline, condition not met in time
Conversion breaks, falls back to sendAudio fails, assert 0 == 1 fails at the deadline, condition not met in time

Under load. pytest tests/channels -n auto on 16 cores ran 20 times in a row on Windows: 20 of 20 passed, 167 tests each, nothing skipped. A local model was running at the same time for part of this, which stretched two runs to 15 and 5.5 minutes. They passed too.

There's no flaky marker on this test and you didn't add one, so nothing needs removing. CI and the CLA are green, there are no review threads, and no changelog entry is needed for a test-only change.

One optional thought for a future PR: test_voice_note_in_and_voice_note_out in tests/channels/test_whatsapp.py looks like the same pattern, with some leftover debug prints. It isn't part of this PR.

@itsskofficial
itsskofficial added this pull request to the merge queue Nov 7, 2026
Merged via the queue into existence-master:main with commit 29adbd7 Nov 7, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: channels Telegram, Discord

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky: test_voice_note_is_transcribed_and_answered misses the sendVoice reply under load

2 participants