Skip to content

Conversation

@m0reA1
Copy link
Contributor

@m0reA1 m0reA1 commented Nov 17, 2025

fixed #195

Summary by CodeRabbit

  • Bug Fixes
    • Improved call ending event handling to ensure proper event propagation when calls terminate.

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Walkthrough

Added an event handler in StreamEdge to subscribe to and forward CallEndedEvent notifications, enabling proper event propagation when calls terminate within the getstream plugin.

Changes

Cohort / File(s) Summary
Event Handler Addition
plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py
Added _on_call_ended async method to handle call-ended events; registered handler subscription in StreamEdge.__init__ to forward CallEndedEvent downstream

Sequence Diagram

sequenceDiagram
    participant SFU as SFU Event Source
    participant StreamEdge
    participant EventManager as Event Manager<br/>(Downstream)
    
    SFU->>StreamEdge: CallEndedEvent emitted
    rect rgb(200, 220, 240)
    StreamEdge->>StreamEdge: _on_call_ended() invoked
    note over StreamEdge: Event handler triggered
    StreamEdge->>EventManager: Forward CallEndedEvent<br/>with plugin_name="getstream"
    end
    EventManager->>EventManager: Subscribers notified
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward event handler addition with clear intent
  • Single subscription registration pattern
  • Limited scope confined to one file
  • No complex conditional logic or state management

Poem

The call ends, the bell tolls clear,
No ghosts left lingering here. 📞
StreamEdge listens, forwards the cry—
At last, the agent learns to die. 🌙

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: adding handling for the CallEnded event in the GetStream plugin, which aligns with the changeset.
Linked Issues check ✅ Passed The PR successfully implements the required functionality: adding a CallEnded event handler in the Stream plugin that forwards the event to downstream consumers, enabling the agent to exit cleanly as specified in issue #195.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objective: adding CallEnded event handling to the StreamEdge class. No unrelated modifications are present.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py (1)

252-257: Solid fix! Event forwarding will allow clean exit.

The implementation correctly handles and forwards the CallEndedEvent, which addresses the root cause described in issue #195. The agent's _audio_consumer_task loop will now receive the event and exit cleanly.

Consider these optional enhancements for richer context:

  1. Forward the reason from the SFU event (available as event.reason per the CallEndedEvent definition) using the kwargs field
  2. Add a logging statement for observability, similar to other event handlers in this file

Example refinement:

 async def _on_call_ended(self, event: sfu_events.CallEndedEvent):
+    logger.info(f"Call ended, reason: {event.reason}")
     self.events.send(
         events.CallEndedEvent(
             plugin_name="getstream",
+            kwargs={"reason": event.reason} if event.reason is not None else None,
         )
     )
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8f57c00 and 823b9e4.

📒 Files selected for processing (1)
  • plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py (3)
agents-core/vision_agents/core/events/manager.py (2)
  • subscribe (301-373)
  • send (435-479)
agents-core/vision_agents/core/edge/events.py (1)
  • CallEndedEvent (38-43)
agents-core/vision_agents/core/edge/sfu_events.py (1)
  • CallEndedEvent (613-643)
🔇 Additional comments (1)
plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py (1)

89-89: LGTM! Subscription registered correctly.

The event subscription follows the established pattern and will properly register the handler for sfu_events.CallEndedEvent.

Copy link
Contributor

@dangusev dangusev left a comment

Choose a reason for hiding this comment

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

Hey @m0reA1 , great find!
Approved and merged

@dangusev dangusev merged commit 7693813 into GetStream:main Nov 18, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

the agent doesn’t exit cleanly, when the call ends

3 participants