Skip to content

fix: make ArtifactPlan.videoRecordingEnabled optional#40

Open
skylarkdevs wants to merge 1 commit into
VapiAI:mainfrom
marnixai:fix/optional-video-recording-enabled
Open

fix: make ArtifactPlan.videoRecordingEnabled optional#40
skylarkdevs wants to merge 1 commit into
VapiAI:mainfrom
marnixai:fix/optional-video-recording-enabled

Conversation

@skylarkdevs
Copy link
Copy Markdown

Problem

Calling vapi.start(assistantId:) against the current production Vapi server fails immediately with .callDidEnd (no transcript, no audio) because the SDK's strict Decodable decoder throws keyNotFound("videoRecordingEnabled") while parsing WebCallResponse.

The server response no longer always nests videoRecordingEnabled under artifactPlan — it has moved to transport.videoRecordingEnabled for many calls — so the key is genuinely absent from the JSON the SDK receives.

Reproduction:

  1. Create an assistant in the Vapi dashboard with default settings (no explicit artifactPlan.videoRecordingEnabled)
  2. From iOS, call vapi.start(assistantId: "<id>")
  3. Observe vapi.eventPublisher emits .callDidEnd(error: decodingError(keyNotFound("videoRecordingEnabled", ...))) ~0.3s after start

Fix

Make ArtifactPlan.videoRecordingEnabled an optional Bool?. The only existing reader is in Vapi.swift:

let isVideoRecordingEnabled = response.artifactPlan?.videoRecordingEnabled ?? false

Swift's optional-chain flattening means the expression's type is unchanged (Bool?), so this line keeps compiling with no callsite update needed.

Impact

  • Restores vapi.start() for SDK consumers whose backend doesn't echo artifactPlan.videoRecordingEnabled on every web-call response.
  • No behavior change when the key IS present — same value flows through.
  • No public API change other than the property becoming optional, which is source-compatible with the existing ?? false pattern.

Test plan

  • Builds cleanly against an iOS 18 simulator target
  • vapi.start() against a production assistant now produces .callDidStart + transcript instead of .callDidEnd(decodingError)

The Vapi server response no longer includes `videoRecordingEnabled`
under `artifactPlan` — the field moved to `transport.videoRecordingEnabled`
on the server. The SDK's strict Decodable conformance threw
`keyNotFound` on the missing key, which surfaced to consumers as
an immediate `.callDidEnd` event with no preceding `.callDidStart`
and an unhelpful `decodingError` reason. Every `vapi.start()` call
was failing.

Declaring it `Bool?` lets the decoder leave it `nil` when the
server omits it. The single callsite already uses optional
chaining (`response.artifactPlan?.videoRecordingEnabled ?? false`
in Vapi.swift:348), so no consumer-facing behavior changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants