Skip to content

Keep realtime tool responses ahead of hangup - #26

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

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

Conversation

@dimavrem22

Copy link
Copy Markdown
Contributor

Executive Summary

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

Description

  • Track per-call asynchronous work from acceptance through result submission.
  • Correlate owned responses and require final assistant transcript, response completion, and outbound audio drain.
  • Defer local hangup with a bounded 30-second post-result deadline.
  • Make remote shutdown immediate even while tool work is running.
  • Make call and realtime socket closure idempotent.

Reason

A local goodbye can race background tool work and end the call before the caller hears the result. Remote termination must also remain prompt while work is outstanding.

Decisions

  • Contact reads use a 30-second execution timeout and consultations keep their existing timeout.
  • Remote shutdown never waits for pending tool promises.
  • Late results after shutdown are ignored.
  • Failed responses and timeout paths release ownership safely.

Testing

  • Full suite: 833 passed.
  • Typecheck, lint, and build passed.
  • Regressions cover delayed contact read, immediate two-step goodbye, owned transcript and audio drain, immediate remote shutdown during consultation, late-result suppression, and exactly-once close.

@dimavrem22
dimavrem22 merged commit ec98548 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