Skip to content

fix: resolve e2e cloud host from region, not a hardcoded default - #7

Merged
AlexLiu190625 merged 2 commits into
xorbitsai:mainfrom
AlexLiu190625:fix/e2e-cloud-region
Jun 23, 2026
Merged

fix: resolve e2e cloud host from region, not a hardcoded default#7
AlexLiu190625 merged 2 commits into
xorbitsai:mainfrom
AlexLiu190625:fix/e2e-cloud-region

Conversation

@AlexLiu190625

Copy link
Copy Markdown
Collaborator

The e2e cloud suite still encoded an invalid host and a key-only flow that now fails fast: running it without XAGENT_BASE_URL routed runtime traffic to a dead host, and the bad-key probe raised ValueError in the constructor before it could reach the unauthorized path.

Changes

  • Resolve the cloud host from XAGENT_REGION (au/sg) or XAGENT_BASE_URL. There is no default host: the service is per-region and a key only authenticates against the region that minted it.
  • The bad-key probe and the full-flow runtime client take the resolved host via a cloud_base_url fixture, so an empty host can no longer raise ValueError before the unauthorized path runs.
  • Drop the docstrings describing a key-only workflow and a hosted default that no longer exist.

Verification

ruff + mypy --strict clean, pytest 215 passed, the e2e suite collects cleanly (skipped by default; not run in CI).

The e2e cloud suite still encoded an invalid host and a key-only flow
that now fails fast, so running it without XAGENT_BASE_URL routed
runtime traffic to a dead host.

- Resolve the cloud host from XAGENT_REGION (au/sg) or XAGENT_BASE_URL;
  there is no default host, since the service is per-region and a key
  only authenticates against the region that minted it.
- The bad-key probe now takes a resolved host via the cloud_base_url
  fixture, so an empty host no longer raises ValueError in the
  constructor before the unauthorized path is exercised.
- Drop the documentation describing a key-only workflow and a hosted
  default that no longer exist.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the end-to-end tests to support per-region cloud hosts by introducing a cloud_base_url fixture and helper functions in conftest.py that resolve the host using XAGENT_BASE_URL or XAGENT_REGION. The smoke tests are refactored to consume this new fixture. The feedback suggests normalizing the XAGENT_REGION environment variable to lowercase before passing it to the Region enum to avoid potential case-sensitivity issues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread python/tests/e2e/conftest.py Outdated
XAGENT_REGION=SG should resolve like sg; the Region enum matches on its
lowercase value, so strip and lowercase the env var first.

@rogercloud rogercloud left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Design verdict: sound ✅

This is the follow-up to the PR #6 review, and it resolves all three findings cleanly. The fix mirrors the library's own host-resolution contract inside the e2e test surface: a single _cloud_base_url() resolver (explicit XAGENT_BASE_URL wins → else XAGENT_REGION via the Region enum → else None/skip), exposed through a shared cloud_base_url fixture. No hardcoded host, no guessing — consistent with the per-region model the library now enforces.

Resolution of prior findings

  • #1 [Major] — Fixed. _runtime_base_url() and its hardcoded https://cloud.xagent.run are gone; test_workspace_full_flow now drives the runtime AgentClient off the resolved cloud_base_url.
  • #2 [Minor] — Fixed. test_bad_workspace_key_unauthorized now takes cloud_base_url, so it reaches the InvalidAPIKey assertion instead of raising ValueError from the constructor when XAGENT_BASE_URL was unset.
  • #3 [Minor] — Fixed. Stale "defaults to the hosted endpoint" docstrings in python/tests/e2e/conftest.py and python/tests/e2e/test_cloud_smoke.py are corrected to the XAGENT_REGION / XAGENT_BASE_URL story.

The earlier case-sensitivity suggestion is also handled — Region(region.strip().lower()) normalizes " SG ", AU, etc.

Verification

  • ruff check and mypy --strict both clean.
  • e2e suite collects and skips cleanly with no env set (0 errors).
  • Resolution paths exercised: none→None, " SG "→sg host, AU→au host, explicit base_url wins, invalid region → clear ValueError.

Minor observation (non-blocking)

An invalid XAGENT_REGION raises ValueError during fixture setup rather than pytest.skip. This is defensible fail-fast behavior — a typo'd region should be loud rather than silently skipped — so no change needed.

LGTM.

@AlexLiu190625
AlexLiu190625 merged commit d7ac0aa into xorbitsai:main Jun 23, 2026
3 checks passed
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.

2 participants