Skip to content

fix(gfn): implement serverInfo region fallback - #522

Merged
zortos293 merged 2 commits into
devfrom
capy/fix-gfn-session-fallback
Jun 27, 2026
Merged

fix(gfn): implement serverInfo region fallback#522
zortos293 merged 2 commits into
devfrom
capy/fix-gfn-session-fallback

Conversation

@zortos293

Copy link
Copy Markdown
Collaborator

This PR implements a fallback mechanism for getActiveSessions to prevent failures when the primary CloudMatch region endpoint is unreachable.

  • Refactored getActiveSessions in src/main/gfn/cloudmatch.ts to query v2/serverInfo for fallback region URLs (local-region, gfn-regions) if the primary fetch fails.
  • Added extractServerInfoRegionBases to parse and prioritize local region metadata from serverInfo response.
  • Added discoverActiveSessionFallbackBases and fetchActiveSessionsFromBase to manage the retry logic and error handling.
  • Updated getActiveSessions to include the stable deviceId in request headers.
  • Added tests in src/main/gfn/cloudmatch.test.ts for region metadata extraction and the fallback fetch flow.

Open OPE-217 OPE-217

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@zortos293 zortos293 added the capy Generated by capy.ai label Jun 27, 2026 — with Image Capy AI
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8065b610-85fa-413b-82c6-fd9bc439da18

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch capy/fix-gfn-session-fallback

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

@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: 0b5960fea6

ℹ️ 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 on lines +1260 to +1261
if (primary) {
return primary;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fall back after failed session responses

When the primary /v2/session request gets a non-OK response or CloudMatch API error, fetchActiveSessionsFromBase() returns [] rather than null. Since arrays are truthy, this branch returns immediately and never calls serverInfo, so the new region fallback only runs for thrown network errors; in provider/alliance cases where the generic base responds with 4xx/5xx but the local region has the active session, resume and force-new still see no sessions.

Useful? React with 👍 / 👎.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@zortos293
zortos293 merged commit ec6ac9d into dev Jun 27, 2026
16 checks passed
Chizuui pushed a commit to Chizuui/OpenNOW-Modified that referenced this pull request Aug 11, 2026
* Implement active-session fallback using serverInfo region discovery.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Fix active-session fallback on HTTP errors

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant