Skip to content

auto pick server and rejoin when session end#665

Open
liwa-dev wants to merge 17 commits into
OpenCloudGaming:devfrom
liwa-dev:feat/smart-auto-rejoin
Open

auto pick server and rejoin when session end#665
liwa-dev wants to merge 17 commits into
OpenCloudGaming:devfrom
liwa-dev:feat/smart-auto-rejoin

Conversation

@liwa-dev

@liwa-dev liwa-dev commented Jul 20, 2026

Copy link
Copy Markdown

What this does

When your free session ends instead of just kicking you back to the home screen the app automatically picks the best server and rejoins the same game for you

How it works

  • Grabs the live queue from printedwaste api
  • pings all servers at the same time to find the fastest one
  • skips dead/nuked servers automatically
  • rejoins the same game on the best available server

also fixes a dns issue if your ISP can't resolve nvidia servers (common in some regions) it falls back to cloudflare/google dns so the rejoin still works

How to turn it on

Settings -> Stream -> "Auto-Rejoin" toggle off by default

Summary by CodeRabbit

  • New Features
    • Added an opt-in Fast Queue Join (Auto Rejoin) setting with a Stream → Region toggle.
    • Implemented smart auto-rejoin: prefetches the best reconnect routing using queue position plus measured latency, then auto-rejoins near the end of free-tier streaming with a capped number of consecutive attempts.
  • Bug Fixes
    • Improved proxy behavior by using the standard network path when proxy settings are missing/invalid.
    • Added more reliable DNS resolution for supported NVIDIA-related domains to improve reconnect success.
    • Updated reconnect recovery so auto-rejoin is tried first on expected session end and disconnect events.

zortos293 and others added 7 commits July 7, 2026 21:45
Replace the outdated Discord test-build link now that OpenNOW is available on Google Play.
- Add DNS interceptor (dnsInterceptor.ts) to resolve GFN hostnames via
  Cloudflare/Google DNS, fixing NXDOMAIN errors on non-standard networks
- Add getSmartAutoJoinBaseUrl: pings all GFN datacenters in parallel via
  TCP, buckets by 15ms latency steps, then picks lowest queue in best bucket
- Add startAutoRejoin: on session end, auto-rejoins the same game on the
  best available server (no user interaction needed)
- Add enableFastQueueJoin setting toggle in Settings UI
- Pre-fetch best server URL 15s before session expires for instant rejoin
- Show 5s countdown notification before manual rejoin (window.__testAutoRejoin)
- Cache active game ref so rejoin survives session teardown
- Fixes TLS cert errors by using hostnames (not raw IPs) with intercepted DNS

Closes OpenCloudGaming#612
…er nuked zones, add loop guard

- cloudmatch.ts: Remove unused haversineKm, resolveIP, getGeoLocation helpers
  (these were leftover from an earlier geolocation approach)
- cloudmatch.ts: Add AbortController timeout (7s) for queue API fetch
- cloudmatch.ts: Filter nuked zones via fetchPrintedWasteServerMapping before
  building candidates list (respects server health data)
- cloudmatch.ts: Import app from electron to get version for User-Agent header
- index.ts: Pass sessionProxyUrl (when sessionProxyEnabled) to
  getSmartAutoJoinBaseUrl so queue fetch goes through the user proxy
- shared/gfn.ts: Add optional proxyUrl parameter to getSmartAutoJoinBaseUrl
  signature in OpenNowApi interface
- preload/index.ts: Forward proxyUrl arg to IPC channel
- App.tsx: Add consecutiveAutoRejoinAttemptsRef to cap auto-rejoin at 3
  consecutive attempts and prevent infinite reconnect loops
- App.tsx: Reset attempt counter on any manual (non-bypass) game launch
- dnsInterceptor.ts: Handle numeric family option overload correctly
- SettingsPage.tsx: Fix description ('distance' -> 'TCP ping and queue')
@capy-ai

capy-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Capy auto-review is paused for this organization because the usage-cycle auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

Smart auto-rejoin

Layer / File(s) Summary
Settings and IPC contracts
opennow-stable/src/main/settings.ts, opennow-stable/src/shared/gfn.ts, opennow-stable/src/shared/ipc.ts, opennow-stable/src/preload/index.ts, opennow-stable/src/renderer/src/components/SettingsPage.tsx, locales/en.json, opennow-stable/src/renderer/src/App.tsx
Adds the opt-in fast-queue setting and exposes smart auto-join through shared types, IPC, preload, localized settings UI, and renderer state.
DNS fallback and smart server selection
opennow-stable/src/main/services/dnsInterceptor.ts, opennow-stable/src/main/gfn/cloudmatch.ts, opennow-stable/src/main/gfn/proxyFetch.ts, opennow-stable/src/main/services/printedWaste.ts, opennow-stable/src/main/index.ts
Adds NVIDIA DNS fallback, proxy-aware queue fetching, and selection of a reachable zone using queue position, latency, server mapping, and IPC wiring.
Shared PrintedWaste zone selection
opennow-stable/src/renderer/src/lib/printedWaste.ts, opennow-stable/src/renderer/src/components/QueueServerSelectModal.tsx
Centralizes PrintedWaste zone URL construction, filtering, and weighted ping/queue selection for the server picker.
Automatic rejoin recovery
opennow-stable/src/renderer/src/App.tsx
Prefetches a smart URL near session expiry and attempts capped automatic rejoin from native-session and signaling recovery paths.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StreamingSession
  participant RendererApp
  participant MainProcess
  participant CloudMatch
  participant PrintedWaste
  participant DNS
  StreamingSession->>RendererApp: session close or signaling disconnect
  RendererApp->>MainProcess: request smart auto-join URL
  MainProcess->>CloudMatch: call getSmartAutoJoinBaseUrl
  CloudMatch->>PrintedWaste: fetch mapping and queue data
  CloudMatch->>DNS: resolve ranked zone hostname
  DNS-->>CloudMatch: resolved candidate
  CloudMatch-->>MainProcess: return HTTPS base URL
  MainProcess-->>RendererApp: return selected URL
  RendererApp->>StreamingSession: rejoin with selected base URL
Loading

Suggested reviewers: zortos293

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: automatically selecting a server and rejoining when a session ends.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
opennow-stable/src/main/gfn/cloudmatch.ts (1)

2069-2086: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Candidate DNS resolution is sequential; could add noticeable latency on the auto-rejoin critical path.

resolveHostnameWithFallback is awaited one candidate at a time; if the top-ranked (lowest-ping/queue) candidates are unreachable, this loop pays each fallback-resolution's cost serially before trying the next. Since this function is on the auto-rejoin critical path (called right as a session is ending), consider resolving the first few candidates concurrently and picking the first success, similar to how the TCP pings are already parallelized above.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opennow-stable/src/main/gfn/cloudmatch.ts` around lines 2069 - 2086, Update
the candidate resolution flow around resolveHostnameWithFallback to resolve a
bounded set of top-ranked candidateZones concurrently rather than awaiting each
candidate sequentially. Select and return the highest-priority candidate whose
hostname resolves, while preserving the existing logging and final
first-candidate fallback when none resolve.
opennow-stable/src/renderer/src/components/SettingsPage.tsx (1)

2824-2839: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded strings break the file's i18n convention.

Every other setting row in this component uses t("settings.xxx") for labels/hints. This new row hardcodes English text directly, so it won't be localized and is inconsistent with the rest of the file.

♻️ Suggested fix
                     <div className="settings-row">
                       <label className="settings-label">
-                        {"Auto-Rejoin (test)"}
+                        {t("settings.stream.autoRejoinTest")}
                         <span className="settings-hint">
-                          {"Automatically picks the best server using TCP ping and queue, and auto-rejoins when your session ends."}
+                          {t("settings.stream.autoRejoinTestHint")}
                         </span>
                       </label>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opennow-stable/src/renderer/src/components/SettingsPage.tsx` around lines
2824 - 2839, Update the Auto-Rejoin settings row in the SettingsPage component
to use the existing t("settings.xxx") localization helper for both its label and
hint instead of hardcoded English strings. Add or reuse the appropriate settings
translation keys while preserving the current toggle behavior and
enableFastQueueJoin binding.
opennow-stable/src/renderer/src/App.tsx (1)

1682-1721: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Pre-ping retries every second with no backoff once triggered.

Once sessionTimeRemainingSeconds <= 15, if getSmartAutoJoinBaseUrl() fails or returns no candidate, prePingSmartUrlRef.current stays null and the next tick (every second) retries — each attempt fetches the queue, fetches the server mapping, and TCP-pings every datacenter cluster. In the worst case (persistent failure) this repeats up to ~15 times in the closing seconds of a session. Consider a simple cooldown (e.g. only retry every 3-5s, matching the existing logging modulo) to avoid hammering the queue/mapping endpoints.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opennow-stable/src/renderer/src/App.tsx` around lines 1682 - 1721, Update the
Auto-Rejoin pre-fetch logic in the useEffect watching
sessionTimeRemainingSeconds so failed or empty getSmartAutoJoinBaseUrl attempts
cannot retry on every one-second tick. Add a cooldown timestamp or equivalent
retry guard, allowing retries only every 3–5 seconds while the session remains
at or below 15 seconds, and preserve the existing in-flight protection and
successful URL caching.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@opennow-stable/src/main/gfn/cloudmatch.ts`:
- Around line 1982-2009: Update getSmartAutoJoinBaseUrl to reuse the shared
fetchPrintedWasteQueue service instead of locally defining QUEUE_API_URL,
AbortController timeout, and fetch logic. Extend fetchPrintedWasteQueue to
accept and apply an optional proxyUrl while preserving its existing User-Agent
and request behavior, then pass proxyUrl from getSmartAutoJoinBaseUrl and
consume the shared response.

In `@opennow-stable/src/main/services/dnsInterceptor.ts`:
- Around line 14-68: Update initDnsInterceptor so the replacement dns.lookup
function preserves the original dns.lookup util.promisify.custom symbol. Copy
that symbol from the original lookup onto the new function after defining it,
retaining the `{ address, family }` result shape for promisified callers.

In `@opennow-stable/src/renderer/src/App.tsx`:
- Around line 3005-3031: Reset consecutiveAutoRejoinAttemptsRef after an
auto-rejoined session is confirmed stable, rather than relying only on the
non-bypass handlePlayGame path. Integrate this reset with the existing
scheduleStableRecoveryReset flow used after successful recovery, while
preserving the three-attempt guard for genuinely consecutive failures.
- Around line 3042-3048: Update the launch callback in startAutoRejoin so a null
streamingBaseUrl also calls setLaunchError with the existing user-facing session
connection failure message before resetting runtime and refreshing the navbar.
Preserve the current console logging and cleanup behavior, ensuring callers
still receive an error when async or cached URL resolution fails.

---

Nitpick comments:
In `@opennow-stable/src/main/gfn/cloudmatch.ts`:
- Around line 2069-2086: Update the candidate resolution flow around
resolveHostnameWithFallback to resolve a bounded set of top-ranked
candidateZones concurrently rather than awaiting each candidate sequentially.
Select and return the highest-priority candidate whose hostname resolves, while
preserving the existing logging and final first-candidate fallback when none
resolve.

In `@opennow-stable/src/renderer/src/App.tsx`:
- Around line 1682-1721: Update the Auto-Rejoin pre-fetch logic in the useEffect
watching sessionTimeRemainingSeconds so failed or empty getSmartAutoJoinBaseUrl
attempts cannot retry on every one-second tick. Add a cooldown timestamp or
equivalent retry guard, allowing retries only every 3–5 seconds while the
session remains at or below 15 seconds, and preserve the existing in-flight
protection and successful URL caching.

In `@opennow-stable/src/renderer/src/components/SettingsPage.tsx`:
- Around line 2824-2839: Update the Auto-Rejoin settings row in the SettingsPage
component to use the existing t("settings.xxx") localization helper for both its
label and hint instead of hardcoded English strings. Add or reuse the
appropriate settings translation keys while preserving the current toggle
behavior and enableFastQueueJoin binding.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f5e28b87-91a6-4e5d-a44e-7e46f1777f1c

📥 Commits

Reviewing files that changed from the base of the PR and between f6c3c42 and 5c098d3.

📒 Files selected for processing (10)
  • opennow-stable/src/main/gfn/cloudmatch.ts
  • opennow-stable/src/main/gfn/proxyFetch.ts
  • opennow-stable/src/main/index.ts
  • opennow-stable/src/main/services/dnsInterceptor.ts
  • opennow-stable/src/main/settings.ts
  • opennow-stable/src/preload/index.ts
  • opennow-stable/src/renderer/src/App.tsx
  • opennow-stable/src/renderer/src/components/SettingsPage.tsx
  • opennow-stable/src/shared/gfn.ts
  • opennow-stable/src/shared/ipc.ts

Comment thread opennow-stable/src/main/gfn/cloudmatch.ts Outdated
Comment thread opennow-stable/src/main/services/dnsInterceptor.ts
Comment thread opennow-stable/src/renderer/src/App.tsx
Comment thread opennow-stable/src/renderer/src/App.tsx Outdated
- printedWaste.ts: Add optional proxyUrl param to fetchPrintedWasteQueue
  so it can route through the session proxy via fetchWithOptionalProxy.
  Removes the duplicated queue fetch that was inside cloudmatch.ts.
- cloudmatch.ts: Replace inline queue fetch with fetchPrintedWasteQueue(appVersion, proxyUrl).
  Removes the duplicate QueueNodeInfo/QueueApiResponse interfaces and
  the raw fetchWithOptionalProxy call — now consistent with the rest of
  the PrintedWaste API family (same User-Agent, same proxy path).
- dnsInterceptor.ts: Preserve util.promisify.custom symbol on the replaced
  dns.lookup so that promisified callers still get the { address, family } shape.
- App.tsx: Reset consecutiveAutoRejoinAttemptsRef to 0 when stream is confirmed
  stable (alongside scheduleStableRecoveryReset), not only on manual launches.
  Fixes the bug where 3 successful rejoins across app lifetime would permanently
  stop auto-rejoin until manual relaunch.
- App.tsx: Show setLaunchError when auto-rejoin URL resolves to null instead of
  silently dropping user to idle — fixes UX regression vs pre-existing error popup.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
opennow-stable/src/main/services/printedWaste.ts (1)

18-21: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Interpolate the timeout constant in the error message.

The error message hardcodes "7000ms". If PRINTEDWASTE_TIMEOUT_MS is modified in the future, this message will become stale. Consider interpolating the constant instead.

♻️ Proposed refactor
   const timeoutId = setTimeout(
-    () => controller.abort(new Error("PrintedWaste queue request timed out after 7000ms")),
+    () => controller.abort(new Error(`PrintedWaste queue request timed out after ${PRINTEDWASTE_TIMEOUT_MS}ms`)),
     PRINTEDWASTE_TIMEOUT_MS,
   );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opennow-stable/src/main/services/printedWaste.ts` around lines 18 - 21,
Update the timeout error message in the setTimeout callback to interpolate
PRINTEDWASTE_TIMEOUT_MS instead of hardcoding “7000ms”, so it always reflects
the configured timeout value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@opennow-stable/src/main/services/printedWaste.ts`:
- Around line 18-21: Update the timeout error message in the setTimeout callback
to interpolate PRINTEDWASTE_TIMEOUT_MS instead of hardcoding “7000ms”, so it
always reflects the configured timeout value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fcc132df-888d-412a-bcf8-264ed3a2baef

📥 Commits

Reviewing files that changed from the base of the PR and between 5c098d3 and e15cb06.

📒 Files selected for processing (5)
  • native/opennow-streamer/bin/opennow-streamer
  • opennow-stable/src/main/gfn/cloudmatch.ts
  • opennow-stable/src/main/services/dnsInterceptor.ts
  • opennow-stable/src/main/services/printedWaste.ts
  • opennow-stable/src/renderer/src/App.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • opennow-stable/src/main/services/dnsInterceptor.ts
  • opennow-stable/src/main/gfn/cloudmatch.ts
  • opennow-stable/src/renderer/src/App.tsx

@Kief5555 Kief5555 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve your changes and ensure proper keys in the settings are set up for translations. Please only modify en.json.

Comment thread opennow-stable/src/renderer/src/components/SettingsPage.tsx Outdated
Comment thread opennow-stable/src/renderer/src/components/SettingsPage.tsx Outdated
Comment thread opennow-stable/src/renderer/src/App.tsx Outdated
Comment thread opennow-stable/src/renderer/src/App.tsx Outdated
liwa-dev added 2 commits July 20, 2026 19:57
- SettingsPage.tsx: Rename label to 'Auto Rejoin' (remove test suffix)
- SettingsPage.tsx: Update hint text for clarity as suggested
- App.tsx: Replace custom TCP-ping picker with the existing weighted
  algorithm from QueueServerSelectModal (75% ping + 25% queue score).
  Now uses window.openNow.pingRegions() + fetchPrintedWasteQueue()
  + fetchPrintedWasteServerMapping() — same IPC calls already used
  by the queue modal, no new IPC channels needed.
  Filters to standard NP-* zones only (excluding NPA-* alliance zones),
  same as QueueServerSelectModal.isStandardZone().
- App.tsx: Remove window.__testAutoRejoin() dev testing function
- locales/en.json: Add settings.region.autoRejoin and settings.region.autoRejoinHint
- SettingsPage.tsx: Use t('settings.region.autoRejoin') and t('settings.region.autoRejoinHint')
@liwa-dev

Copy link
Copy Markdown
Author

Please resolve your changes and ensure proper keys in the settings are set up for translations. Please only modify en.json.

the label and hint text are wired to translation keys in en.json file

    "autoRejoin": "Auto Rejoin",
    "autoRejoinHint": "Automatically picks the best server using your ping
  and queue, and automatically rejoins the game when your session ends." 

and in settingspage.tsx too:

    {t("settings.region.autoRejoin")}
    {t("settings.region.autoRejoinHint")}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
opennow-stable/src/renderer/src/App.tsx (2)

3309-3320: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

consecutiveAutoRejoinAttemptsRef is never reset on the default (web) streaming success path.

The stable-session reset (consecutiveAutoRejoinAttemptsRef.current = 0, with the comment "Session confirmed stable — reset auto-rejoin counter…") was added only inside activateNativeInputForCurrentSession (Lines 3241-3243), which is exclusively triggered by native-streamer signaling events. The WebRTC "offer" success path here — the one used for streamClientMode: "web", the default value (Line 494) — has no equivalent reset. This reproduces the exact previously-flagged bug ("cap blocks auto-rejoin permanently after 3 total attempts, not 3 consecutive failures") for the majority of users who are on the default web client mode, even though that issue is marked addressed.

🐛 Proposed fix: mirror the native-path reset
             setLaunchError(null);
             setStreamStatus("streaming");
             markDiscordStreamStarted();
             scheduleStableRecoveryReset(activeSession.sessionId);
+            // Session confirmed stable — reset auto-rejoin counter so it doesn't
+            // block future rejoins after successful sessions (mirrors native path).
+            consecutiveAutoRejoinAttemptsRef.current = 0;
             console.log(
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opennow-stable/src/renderer/src/App.tsx` around lines 3309 - 3320, Reset
consecutiveAutoRejoinAttemptsRef.current to 0 in the WebRTC offer success path
immediately after the session is confirmed streaming, alongside setLaunchError,
setStreamStatus, markDiscordStreamStarted, and scheduleStableRecoveryReset.
Mirror the stable-session reset performed by
activateNativeInputForCurrentSession so default web streaming success clears the
auto-rejoin counter.

3078-3111: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Auto-rejoin needs a live-URL fallback. startAutoRejoin still depends on the 15s prefetch cache, so a recovery-exhausted disconnect usually hits the no-cache branch and falls back to the same session-lost error. If this is meant to handle ordinary network drops too, fetch a fresh streamingBaseUrl here instead of relying on prePingSmartUrlRef.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opennow-stable/src/renderer/src/App.tsx` around lines 3078 - 3111, The
auto-rejoin path should fetch a fresh streaming URL when the prefetch cache is
empty instead of immediately calling launch(null). Update startAutoRejoin’s
no-cached-URL branch to invoke the existing live URL resolver (such as
getSmartAutoJoinBaseUrl), then pass its result to launch while preserving the
existing error handling when resolution returns null.
🧹 Nitpick comments (1)
opennow-stable/src/renderer/src/App.tsx (1)

1694-1755: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

AutoRejoin diagnostics bypass the shared logger.

All the new [AutoRejoin] tracing (prefetch progress/errors here, and the verbose state dump in startAutoRejoin) goes through plain console.* calls instead of @shared/logger, so these diagnostics won't be captured by the logs:export flow users would use to report a failed rejoin.

As per path instructions, "Use the shared logger (@shared/logger) and export logs via logs:export IPC channel; avoid bypassing this path for diagnostics features."

Also applies to: 3046-3113

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opennow-stable/src/renderer/src/App.tsx` around lines 1694 - 1755, Replace
the AutoRejoin diagnostic console.* calls in the shown prefetch flow and the
verbose state dump in startAutoRejoin with the shared logger from
`@shared/logger`. Preserve the existing messages and severity levels while routing
them through the logger so logs:export can capture all AutoRejoin diagnostics;
do not add parallel console logging.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@opennow-stable/src/renderer/src/App.tsx`:
- Around line 1682-1756: Move the zone filtering, URL construction, ping/queue
scoring, and best-server selection out of the Auto-Rejoin useEffect in App.tsx
into the existing shared picker utility or main-process cloudmatch/IPC path.
Update both App.tsx and QueueServerSelectModal.tsx to reuse that single
implementation, leaving the effect responsible only for requesting the prefetch
result and storing best.routingUrl; preserve the existing standard-zone,
nuked-zone, and weighted-scoring behavior.
- Around line 1685-1691: Clear prePingSmartUrlRef and prePingInFlightRef in
resetLaunchRuntime so every session reset removes any unused prefetch state.
Ensure this covers manual stops, launch errors, logout, and play failures while
preserving the existing auto-rejoin success cleanup.

---

Outside diff comments:
In `@opennow-stable/src/renderer/src/App.tsx`:
- Around line 3309-3320: Reset consecutiveAutoRejoinAttemptsRef.current to 0 in
the WebRTC offer success path immediately after the session is confirmed
streaming, alongside setLaunchError, setStreamStatus, markDiscordStreamStarted,
and scheduleStableRecoveryReset. Mirror the stable-session reset performed by
activateNativeInputForCurrentSession so default web streaming success clears the
auto-rejoin counter.
- Around line 3078-3111: The auto-rejoin path should fetch a fresh streaming URL
when the prefetch cache is empty instead of immediately calling launch(null).
Update startAutoRejoin’s no-cached-URL branch to invoke the existing live URL
resolver (such as getSmartAutoJoinBaseUrl), then pass its result to launch while
preserving the existing error handling when resolution returns null.

---

Nitpick comments:
In `@opennow-stable/src/renderer/src/App.tsx`:
- Around line 1694-1755: Replace the AutoRejoin diagnostic console.* calls in
the shown prefetch flow and the verbose state dump in startAutoRejoin with the
shared logger from `@shared/logger`. Preserve the existing messages and severity
levels while routing them through the logger so logs:export can capture all
AutoRejoin diagnostics; do not add parallel console logging.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90335c0a-290b-4f4d-9895-3a428351c8d4

📥 Commits

Reviewing files that changed from the base of the PR and between e15cb06 and 5198e23.

📒 Files selected for processing (2)
  • opennow-stable/src/renderer/src/App.tsx
  • opennow-stable/src/renderer/src/components/SettingsPage.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • opennow-stable/src/renderer/src/components/SettingsPage.tsx

Comment thread opennow-stable/src/renderer/src/App.tsx Outdated
Comment thread opennow-stable/src/renderer/src/App.tsx
liwa-dev added 2 commits July 20, 2026 20:09
- printedWaste.ts (renderer-shared): Add pickBestPrintedWasteZone and
  constructPrintedWasteZoneUrl helpers to avoid duplicating picker logic
- App.tsx: Use shared pickBestPrintedWasteZone to choose auto-rejoin target
- App.tsx: Clear pre-ping smart URL cache inside resetLaunchRuntime to avoid
  reusing a stale zone selection in future unrelated sessions
- QueueServerSelectModal.tsx: Refactor to import and use the shared picker
  algorithm, keeping both modal and auto-rejoin scoring systems in sync
Mirror the same reset already done in the native streamer path so the
3-attempt cap doesn't permanently block auto-rejoin for web mode users.
@liwa-dev
liwa-dev requested a review from Kief5555 July 21, 2026 09:25
@Kief5555

Copy link
Copy Markdown
Collaborator

@codex

@Kief5555
Kief5555 requested a review from zortos293 July 21, 2026 16:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60d2e956ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread opennow-stable/src/renderer/src/App.tsx Outdated
Comment thread opennow-stable/src/renderer/src/App.tsx Outdated
… cases

- Guard dnsInterceptor from running during test environments (fixes all 6 CI jobs)
- Add isStandardPrintedWasteZone filter to skip test/unit zone IDs
- Pass variantId through auto-rejoin so store variants rejoin correctly
- Add live server pick fallback when pre-ping misses the cutoff
- Make streamingBaseUrl optional — falls back to default region routing
- Replace undiciFetch with native fetch in proxyFetch fallback paths
- Remove getSmartAutoJoinBaseUrl IPC roundtrip — logic now runs in renderer
@liwa-dev

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59e9451a12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread opennow-stable/src/renderer/src/App.tsx
Comment thread opennow-stable/src/renderer/src/App.tsx
liwa-dev and others added 2 commits July 22, 2026 16:23
…vider routing

- Add autoRejoinInFlightRef to dedupe duplicate startAutoRejoin calls on session close
- Bypass PrintedWaste server picker for non-NVIDIA or Alliance provider sessions to preserve original provider routing
@liwa-dev

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d29ca51ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread opennow-stable/src/renderer/src/App.tsx
@Kief5555
Kief5555 changed the base branch from main to dev July 22, 2026 15:50
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.

4 participants