Fix: Eliminate initial flash of default output on realtime session start#13
Merged
AdirAmsalem merged 3 commits intomainfrom Mar 14, 2026
Merged
Fix: Eliminate initial flash of default output on realtime session start#13AdirAmsalem merged 3 commits intomainfrom
AdirAmsalem merged 3 commits intomainfrom
Conversation
decartdev
approved these changes
Mar 14, 2026
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
When starting a realtime session with a reference image (e.g. Lucy 2 with a Firebase-hosted image), users see ~3 seconds of the default "Einstein" output before the intended reference image takes effect. This is because the SDK was applying the initial prompt/image after the WebRTC connection was already established and generating frames.
Solution
The initial state (prompt, reference image, or passthrough) is now sent and acknowledged before the WebRTC handshake begins. The server knows what to generate before the first frame is ever produced.
This is the iOS port of JS SDK PR #93 and Python SDK PR #32.
What changes for users
initialPromptis now optional — omitting it defaults to passthrough mode instead of requiring an empty prompt.setPrompt()now forwardsenhance— theenrichflag was previously ignored for non-image prompts.How it works
set_image+ waits forset_image_ackprompt+ waits forprompt_ackset_imagewith explicit nulls + waits forset_image_ackTimeout is 30s with fail-fast on server errors or WebSocket disconnect, matching the JS and Python SDKs.
Files changed
DecartRealtimeManager.swift— moved initial state before handshake, added ack waiting with timeout and error propagationRealtimeConfiguration.swift—initialPromptdefaults to empty (passthrough)SignalingModel.swift— addedenhance_promptto prompt messages, null-preserving encoding for passthrough, expanded ack modelsWebSocketClient.swift—send()now throws on failure instead of silently dropping messages