Skip to content

fix!: ask for the recording again when it fails instead of breaking the call - #183

Merged
nafg merged 2 commits into
masterfrom
bb/fix-failed-recording-breaking-the-call-thr_g6z4x4rabr
Dec 3, 2026
Merged

nafg merged 2 commits into
masterfrom
bb/fix-failed-recording-breaking-the-call-thr_g6z4x4rabr

Conversation

@nafg

@nafg nafg commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Problem

When Twilio's recording-status callback reported that a recording did not complete, the callback completed the call's promise with a defect (promise.die). The next /call request for that call died with a 500. The call state stayed the same, so every later request waited on the same failed recording and died too: the call could never get past it.

Fix

  • A failed recording now completes the promise with a typed failure, a message for the caller, instead of a defect. The recording promises become Promise[String, ...].
  • interpretState routes that failure through postHandle, which says the message, pauses and asks for the recording again with a new promise. The caller hears "Recording failed. Please try again." and the call carries on from the new recording.
  • A timeout while waiting for the recording still answers "Please wait..." outside postHandle, so the next request keeps waiting for the same recording.

Commits

  1. test: adds a twilio-base-test project and a test that drives a call through a failed recording, a retry and a completed recording. To drive a call without HTTP, the core of the /call handler is pulled out into CallStateServer.advanceCall. The test is marked TestAspect.failing in this commit, since it fails before the fix.
  2. fix!: the fix itself, and removes TestAspect.failing.

Breaking change

The recording promises in CallState and the recording-status callback types are now Promise[String, ...] instead of Promise[Nothing, ...], and CallStateServer.recordingResult and transcribedRecordingResult return IO[String, ...] instead of UIO.

🤖 Generated with Claude Code

nafg and others added 2 commits December 3, 2026 06:50
Add a twilio-base-test project with a test that drives a call through
a failed recording, a retry and a completed recording. It fails on this
commit, so it is marked failing until the fix.

To let the test drive a call without HTTP, the core of the /call
handler is pulled out into CallStateServer.advanceCall, which takes the
call info and the request's params and returns the Result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he call

When Twilio reported that a recording did not complete, the callback
completed the call's promise with a defect, so the next /call request
for that call died with a 500. The call state stayed the same, so every
later request waited on the same failed recording and died too: the
call could never get past it.

Now a failed recording completes the promise with a failure: a message
for the caller. The caller hears "Recording failed. Please try again."
and is asked to record again, and the call carries on from the new
recording. Waiting too long for a recording still answers "Please
wait..." and keeps waiting for the same one.

BREAKING CHANGE: the recording promises in CallState and the recording
status callback types are now Promise[String, ...] instead of
Promise[Nothing, ...], and CallStateServer.recordingResult and
transcribedRecordingResult return IO[String, ...] instead of UIO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T11:53:01.855678Z a665adf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mergify

mergify Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@nafg
nafg merged commit 76bc039 into master Dec 3, 2026
4 checks passed
@nafg
nafg deleted the bb/fix-failed-recording-breaking-the-call-thr_g6z4x4rabr branch December 3, 2026 11:54
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.

1 participant