Skip to content

Fix Task exception was never retrieved in Agent._poll_audio_queues on close#473

Merged
dangusev merged 1 commit intomainfrom
fix/_poll_audio_queues-silent-failure
Apr 7, 2026
Merged

Fix Task exception was never retrieved in Agent._poll_audio_queues on close#473
dangusev merged 1 commit intomainfrom
fix/_poll_audio_queues-silent-failure

Conversation

@dangusev
Copy link
Copy Markdown
Collaborator

@dangusev dangusev commented Apr 7, 2026

Agent._poll_audio_queues sometimes triggered Task exception was never retrieved warnings on Agent.close because participant queues were polled in parallel in background tasks.

This PR simplifies the code by making the poll sequential since the timeout is only 1ms.

Summary by CodeRabbit

  • Refactor
    • Simplified the audio queue polling mechanism by changing from concurrent to sequential processing, improving code maintainability and reducing complexity.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5422c5ec-01c4-4d01-bfd1-9f28b5adef4f

📥 Commits

Reviewing files that changed from the base of the PR and between 08cdeaf and 7af33f8.

📒 Files selected for processing (1)
  • agents-core/vision_agents/core/agents/agents.py

📝 Walkthrough

Walkthrough

The Agent._poll_audio_queues method was refactored from concurrent to sequential queue polling, eliminating asynchronous task spawning and cancellation logic while changing the order in which participant audio data is yielded.

Changes

Cohort / File(s) Summary
Queue Polling Refactor
agents-core/vision_agents/core/agents/agents.py
Changed _poll_audio_queues from concurrent task-based polling to sequential queue iteration. Removed asyncio.as_completed pattern, task creation/cancellation overhead, and out-of-order readiness handling. Now processes queues linearly, awaiting each queue.get_duration() directly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

Queues no longer race—
they shuffle, one by one,
obedient as bell jars,
trading concurrency's mad brightness
for sequential darkness.
The tasks dissolve. What breathing room remains?

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: fixing a 'Task exception was never retrieved' warning in Agent._poll_audio_queues by switching from parallel to sequential queue polling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/_poll_audio_queues-silent-failure

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 and usage tips.

@Nash0x7E2 Nash0x7E2 self-requested a review April 7, 2026 17:20
@dangusev dangusev merged commit 9b276c6 into main Apr 7, 2026
6 checks passed
@dangusev dangusev deleted the fix/_poll_audio_queues-silent-failure branch April 7, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants