Repository navigation
Conversation
…an unhandled rejection
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
DirectReturnProbe.onCutoverFailurehook — the cutovercatchno longer rethrows a non-withdrawnmigratefailure (which escaped through the timer's discarded promise as anunhandledRejection); it reports it via the new hook and returns normally.- Supervisor wiring —
onCutoverFailureroutes tologRelay('direct cutover failed after authentication', error.message.slice(0, 80)), matching the existingrelay bookkeeping failed after migrationlog. - Tests — a failed cutover under
adoptsOutrightis asserted to land in the hook with nounhandledRejection, and a withdrawn race is asserted to stay quiet.
The fix is minimal and correctly scoped. I traced the only two DirectReturnProbe constructors (supervisor + test fixture), confirmed the finally still reschedules and afterProbe releases the mutex/triggers relay recovery on a genuine failure, and that abortCutover()'s second call in the catch is a side-effect-free predicate. The unhandledRejection assertion is real coverage — it would fail on the pre-fix code (which rethrew). I ran mobile-direct-return-probe.test.ts (5/5 pass).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthrough
Merge Risk: ⚪ Minimal · up to Mobile direct cutover and post-migration failures are now reported without unhandled promise rejections, while withdrawn races remain quiet. No concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the problem, implementation, and tests, but it omits most required template sections. It does not provide the required Linked Issue format, ELI5, What Changed, Visual Proof with an N/A explanation, AI Disclosure, Review, Agent skill upstream boundary, Notes, or Checklist details. Resolution Complete the required template sections. Add an ELI5 summary, a What Changed section, a Linked Issue entry such as
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: ce5a0181-10fa-4879-b9bf-2d17b77640d0
📒 Files selected for processing (3)
mobile/src/transport/mobile-direct-return-probe.test.tsmobile/src/transport/mobile-direct-return-probe.tsmobile/src/transport/mobile-endpoint-supervisor.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — one minor type-annotation fix inline.
Reviewed changes
- Contained a throwing
onCutoverFailurereporter — the hook call is now wrapped intry/catch, so a reporter that itself throws can no longer reject the timer-ownedprobe()promise and leak an unhandled rejection. - Added a throwing-reporter regression test — a fixture override that explodes is asserted to still settle cleanly (no
unhandledRejection).
The containment matches what the prior review flagged as the remaining gap: the reporter is now truly diagnostics-only, and the new test would fail if the try/catch were removed (the throw would escape the timer-discarded promise).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Type-annotated the fixture
overridesparam —mobile-direct-return-probe.test.tsnow declaresonCutoverFailure?: (error: Error) => voidon the fixtureoverridestype, closing the gap the prior review flagged (TS2339/TS2353, previously invisible becausemobile/tsconfig.jsonexcludes**/*.test.tsfromtsc --noEmit).
The incremental delta is a single mechanical type-annotation fix that makes the fixture's contract match its usage; no behavioral surface changed.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…t-migration errors A failed cutover kept the credited success streak, so the next 15s tick re-dialed and failed the same way forever. The failure now enters hysteresis cooldown. onDirectMigrated rejections are reported through the same hook instead of escaping the timer promise.
There was a problem hiding this comment.
ℹ️ No critical issues — the cooldown booking and post-migration containment are correct; one minor diagnostic-labeling suggestion inline.
Reviewed changes
- Booked a direct failure on a genuine cutover failure —
recordDirectFailurenow runs before the report, so the resulting cooldown stops the probe from re-dialing, re-promoting on the spot, and failing identically every 15 s tick. - Contained post-migration bookkeeping errors —
onDirectMigratedis wrapped intry/catchand reported viareportCutoverFailure, so acredentialRefreshfailure can no longer reject the timer-discarded promise. - Extracted
reportCutoverFailureand addedonDirectMigrated/hysteresisfixture overrides plus two regression tests.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Split direct-cutover diagnostics into two hooks — a failed
migratenow reports throughonCutoverFailure(direct cutover failed after authentication), while a post-migrationonDirectMigratedbookkeeping failure routes through a newonBookkeepingErrorhook (direct bookkeeping failed after migration), so a landed-but-bookkeeping-failed cutover no longer reads as a lost-race fallback in field logs. This mirrors the relay path's pre-existingonBookkeepingErrordistinction. - Generalized the reporter —
reportCutoverFailurebecamereport(hook, error), which dispatches on a hook key and keeps the throwing-reportertry/catchcontainment in a single place for both failure modes. - Tests updated in lockstep — the fixture gained an
onBookkeepingErroroverride and abookkeepingErrorssink; the post-migration failure test now asserts the error lands inbookkeepingErrorswithcutoverFailuresempty (plus nounhandledRejection).
This commit resolves the prior review's diagnostic-labeling nit by giving the cutover-failure and bookkeeping-failure paths distinct hooks and log lines.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Closed with #19348, which reverts the mobile pass this PR fixes bugs inside. The mobile reconnect work will be re-landed one narrow, device-verified change at a time. |

Follow-up to #19308 from the post-merge adversarial review.
Why
DirectReturnProbe.probe()is only ever reached from a timer that discards its promise. The cutover catch swallowed a withdrawn race (stopped || abortCutover()) but rethrew every other failure, so nothing could catch it. During a reconnect raceabortCutoverisstopped || !adoptsOutright(), and with nothing connectedadoptsOutright()stays true, so a direct candidate that drops between authentication and the swap (or a logical client closed without stopping the supervisor) surfaced as an unhandled rejection. Before #19308 this path only ran against a live relay after a hysteresis streak; it now runs on every reconnect.Recovery was never affected (the
finallyreschedules), but the rejection is log noise and a spurious error in crash reporters.What
onCutoverFailure(error)hook on the probe. A cutover that fails for a reason other than losing the race is reported through it and the probe returns normally.direct cutover failed after authenticationwith the first 80 chars of the message.Tests
adoptsOutrighttrue andmigraterejecting, the failure is reported through the hook andprocesssees nounhandledRejection(fails on main).vitest(4324),tsc,oxlint,oxfmt --checkclean.