fix(crew): send AgentReady before starting nodes (unbreaks greeting in start()) - #70
Open
abhishekmishragithub wants to merge 1 commit into
Open
fix(crew): send AgentReady before starting nodes (unbreaks greeting in start())#70abhishekmishragithub wants to merge 1 commit into
abhishekmishragithub wants to merge 1 commit into
Conversation
…rt() works CrewSession.start() started nodes and only then sent SDKAgentReadyEvent. A node whose start() emits a speak (e.g. a greeting) had that event flushed to the platform before Ready; the platform's connect handshake then sees a non-Ready first frame, never spawns its receive loop, and the whole call goes silent. Send Ready first, then start nodes. Incoming events still buffer on the websocket until our receive loop starts (after nodes), so nothing is lost. Adds a regression test asserting Ready is sent before any node starts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CrewSession.start()(session.py) called_start_nodes()and only afterwards sentSDKAgentReadyEvent. A node whosestart()emits a speak — the natural way to greet — had thatSDKAgentSpeakEventflushed to the platform before Ready. Pipecat'sAgentSDKProcessor._connectexpects Ready as the first frame; getting a speak first leaves_connected=False, its receive loop never starts, and every subsequent event is a no-op — the whole call goes silent. This is why node-levelself.speak()instart()silenced our test agents.Fix
Send
SDKAgentReadyEventbefore_start_nodes(). Incoming events still buffer on the websocket until our own receive loop starts (after nodes are up), so nothing is lost by ordering Ready first. Any early speak from a node'sstart()is now legal.Test
Adds
tests/custom/test_crew_session_ready_ordering.pyasserting Ready is sent before any node starts (fails if the ordering regresses).Notes
firstMessagethe primary greeting path). This fix makes an in-start()greeting also viable instead of silently breaking.OutputCrewNode.process_eventrequiringsuper()) is deferred to the DevX pass since its fix is an API change.🤖 Generated with Claude Code