Repository navigation
fix(watchos): terminate stalled WatchConnectivity requests safely - #331
Merged
turinglambdaai merged 8 commits intoOct 27, 2026
Merged
Conversation
Terminate WatchConnectivity requests after a configurable deadline, unblock cancellation even if it races with continuation registration, and ignore late or duplicate callbacks without resuming a checked continuation twice. Keep policy and race tests portable to the macOS Swift test runner.
Give native reply handlers a one-shot finite deadline and cancel a stalled product router when the iPhone cannot answer the paired Watch in time. Tests cover timeout fallback and cancellation of a completed reply timer.
Bound simultaneous foreground requests to four per direction by default, reject excess calls without dispatch, and keep slots reserved until handlers actually exit even if a timed-out handler ignores cancellation.
Owner
Author
|
Maintainer follow-up (2026-10-27): Investigated the failing Swift protocol/runtime job. The only two test issues arose in |
github-actions
Bot
deleted the
fix/watchconnectivity-bounded-request-lifecycle
branch
October 28, 2026 06:24
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 changes
WatchConnectivity
sendMessageDatadid not bound the lifetime of an immediate request. A paired iPhone that never invoked its native success/error callback could leave the Swift caller suspended indefinitely, and callback/cancellation races risk resuming a checked continuation twice.requestTimedOutfor unresponsive peers.Validation
Full CI is pending. Existing iOS/watchOS SDK and simulator compilation plus macOS Swift unit tests must pass before merge. Real paired-Watch connectivity and signed app packaging remain separate acceptance gates.
Additional iPhone-side hardening: the native reply handler also has a finite one-shot deadline. A stalled product route handler receives cancellation and the watch is sent a single empty failure reply. Pure Swift tests cover late duplicate replies and timeout fallback; current-head CI pending.
Final resource bound: also cap simultaneous immediate messages to four per direction (configurable 1–32), with overflow rejected before dispatch. An uncooperative router handler retains its reserved slot until it exits, preventing an unlimited backlog. Added a deterministic budget test. The latest head must pass a fresh CI run before merge.