Skip to content

Keep realtime tool responses ahead of hangup - #62

Merged
dimavrem22 merged 1 commit into
mainfrom
fix/realtime-work-before-hangup
Aug 12, 2026
Merged

Keep realtime tool responses ahead of hangup#62
dimavrem22 merged 1 commit into
mainfrom
fix/realtime-work-before-hangup

Conversation

@dimavrem22

Copy link
Copy Markdown
Contributor

Executive Summary

Keeps accepted realtime consultations alive until their result-bearing response is fully delivered before local hangup.

Description

  • Track consultations from acceptance through result submission.
  • Correlate the next result response and require its final assistant transcript, response completion, and outbound audio drain.
  • Defer local hangup with a bounded 30-second post-result deadline.
  • Centralize socket and session ownership so local and remote termination close exactly once.

Reason

A local goodbye can race a background consultation and end the call before the caller hears the result.

Decisions

  • Remote shutdown remains immediate.
  • Timeout and error fallbacks remain response-bearing work.
  • Failed responses release ownership safely.
  • The bridge run lifecycle is the sole close owner.

Testing

  • Full unit suite: 471 passed, 23 skipped.
  • Contract suite: 5 passed.
  • Ruff passed for changed files.
  • Full-lifecycle regression covers delayed consultation, immediate two-step goodbye, final transcript, response completion, audio drain, timeout fallback, and exactly-once close.

@dimavrem22
dimavrem22 merged commit 3b89a9d into main Aug 12, 2026
30 checks passed
@dimavrem22
dimavrem22 deleted the fix/realtime-work-before-hangup branch August 12, 2026 18:43
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