fix(client-runtime): tolerate transient foreground probe timeouts #5198
main fromrefs/pull/5198/head·opened View on GitHubProblem#
When the host is temporarily resource constrained, a foreground health probe can time out even though the existing session is still valid. Immediately replacing that session can start a reconnect while the same host is still stalled, leaving the client unusable until it recovers.
Fix#
Keep the existing desktop/web session after the first foreground probe timeout. A successful probe resets the count, while a second consecutive timeout still triggers normal recovery. Definite probe failures and mobile resume behavior are unchanged.
Testing#
- Focused connection supervisor suite: 35 tests passed
- Client-runtime typecheck
- Targeted lint and formatting checks
Model: GPT-5; harness: Codex.
Note
Medium Risk Changes live connection monitoring and reconnect timing in client-runtime; behavior is well-covered by supervisor tests but affects when sessions are replaced under load.
Overview
Foreground health probes on application-active no longer tear down the session on a single 15s timeout when the host is briefly stalled. The supervisor keeps the existing lease, logs a warning, and only triggers normal reconnect recovery after two consecutive timeouts (FOREGROUND_PROBE_TIMEOUTS_BEFORE_RECONNECT).
A successful probe resets the counter. Definite probe failures and application-active-probe (mobile, 3s timeout) behavior are unchanged.
Tests cover: one timeout stays connected; two timeouts → backoff/release; success between timeouts resets the count.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 3fdbd155b93f90d9b9e24ca89ed010b3ff097887. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).Note
Tolerate transient foreground liveness probe timeouts in EnvironmentSupervisor#
- During
application-activewakeups, a single probe timeout no longer triggers a reconnect; the supervisor only reconnects after 2 consecutive timeouts (FOREGROUND_PROBE_TIMEOUTS_BEFORE_RECONNECT = 2). - A successful probe resets the timeout counter to 0, so isolated timeouts are always tolerated.
application-active-probesignals retain the existing fail-fast behavior on timeout.- Two new tests cover consecutive timeout reconnection and counter reset after a successful probe.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Needs human review
This PR changes runtime behavior for connection supervision - tolerating transient foreground probe timeouts before reconnecting instead of failing immediately. This modifies core connection handling logic and should be reviewed by someone familiar with the supervisor implementation.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Closing in favor of #8522, which carries the same foreground-probe timeout fix on the current connection supervisor and preserves its updated reconnect behavior. Keeping the review in one place.
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
61f1d7d2-365c-4fe9-a512-c2ef24bb1bddYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
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.
❤️ Share