fix: attach callId and map fetch failures - #26
Open
Arshgill01 wants to merge 1 commit into
Open
Arshgill01 wants to merge 1 commit into
Arshgill01 wants to merge 1 commit into
Conversation
createAndWait discarded the created call id when the following GET failed, and a rejected fetch surfaced as TypeError instead of CalleConnectionError. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
What
fetchso a rejected fetch becomesCalleConnectionErrorinstead of a rawTypeError.createAndWaitsuccessfully POSTs, attachcallIdonCalleAPIError,CalleConnectionError, andCalleTimeoutErrorthrown from the wait-phase GET.waitForResulttimeout already named the id in the message; it now also sets thecallIdproperty.Why
createAndWaitkeptcall.idin a local variable. If the following GET failed (network, 5xx, deadline), the thrown error had nocallIdfield, so the caller could not recover a call that had already been created. A rejectedfetchwas not mapped toCalleConnectionError, socatch (e instanceof CalleError)missed it.Related but not fixed: #17 (wait returns on terminal status before
structuredResult) and #23 (deadline does not abort GET/sleep). This PR does not change the wait predicate or timeout bounding.Evidence
Vitest, mocked
fetch, no network, no phone call.Before (published 0.7.0 probe):
After:
New cases: rejected fetch on create is
CalleConnectionError; POST-ok then GET reject or GET 502 includescallId: "call_123".Test
pnpm testandpnpm run typecheckas above.Source
From the CALL-E hackathon feedback lab: https://github.com/Arshgill01/ExactRef/blob/main/docs/feedback/lab/XR-605-create-and-wait-loses-call-id.md
Made with Cursor