Skip to content

fix(cursor): discover account Agent endpoint - #10804

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.50from
tuandinh0801:fix/cursor-agent-region-discovery
Aug 21, 2026
Merged

diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.50from
tuandinh0801:fix/cursor-agent-region-discovery

Conversation

@tuandinh0801

Copy link
Copy Markdown
Contributor

Summary

  • Request AgentUrlConfig from Cursor with each selected account token.
  • Select agentUrl or agentnUrl from the account server config.
  • Cache validated Cursor Agent URLs by connection and token.
  • Preserve upstream server-config status errors.

Related Issues

Validation

  • Change type: provider
  • node --import tsx/esm --test tests/unit/cursor-agent-host.test.ts
  • node --import tsx/esm --test tests/unit/provider-translate-path-golden.test.ts
  • npm run check:provider-consistency
  • npm run check:provider-assets
  • npm run typecheck:core
  • npm run lint
  • Reconciled with current release/v3.8.50 at 3d7ed7aa8
  • Production-code changes include an automated test
  • Live Cursor request selected agentn.us.api5.cursor.sh and returned HTTP 200 with PING

Tests Added Or Updated

  • tests/unit/cursor-agent-host.test.ts

Coverage Notes

The unit test covers regional endpoint selection, privacy-mode selection, token rotation, cache reuse, and untrusted-host rejection.

Reviewer Notes

Cursor controls endpoint assignment through ServerConfigService.GetServerConfig. Fixed global or us hosts can fail for other teams. No migration or feature flag applies.

Cursor assigns Agent RPC hosts through ServerConfigService. Resolve and cache both privacy endpoints per connection and token, then select the endpoint that matches ghost mode.

Validate discovered hosts before sending credentials and preserve upstream status errors.

Refs diegosouzapw#10802
@diegosouzapw
diegosouzapw merged commit fa0cd5a into diegosouzapw:release/v3.8.50 Aug 21, 2026
3 checks passed
xiaoyaner0201 added a commit to xiaoyaner0201/OmniRoute that referenced this pull request Aug 21, 2026
…fd4040)

Additive two-parent merge onto the current live head, which advanced again during
O5/R6 from b87056a to 6fd4040 (five commits: diegosouzapw#10830 Grok Build custom host,
diegosouzapw#10854 skills marketplace API-key installs, diegosouzapw#10804 Cursor account Agent endpoint,
diegosouzapw#10531 freebuff translate-path golden regen, diegosouzapw#10805 SSE silent-close truncation).

Zero file overlap with this PR's 34-file diff; the merge is conflict-free and
introduces no adaptation of either side. No force, rebase, amend, or squash.
backryun added a commit to backryun/OmniRoute that referenced this pull request Aug 21, 2026
diegosouzapw#10804 (fa0cd5a) moved agent-endpoint discovery (a live
api2.cursor.sh GetServerConfig call) ahead of request building inside
CursorExecutor.execute. The two executor-level image-validation tests
use a fake access token, so discovery now fails with a real 401 before
image validation ever runs — the tests saw 401/500 instead of the
sanitized 400 they assert.

Stub globalThis.fetch for the ServerConfigService call with a minimal
valid protobuf response (field-27 submessage, varint-encoded tag,
*.api5.cursor.sh hosts accepted by validateCursorAgentUrl). Image
validation itself is untouched and still exercised end-to-end.
28/28 green.
backryun added a commit to backryun/OmniRoute that referenced this pull request Aug 21, 2026
diegosouzapw#10804 (fa0cd5a) moved agent-endpoint discovery (a live
api2.cursor.sh GetServerConfig call) ahead of request building inside
CursorExecutor.execute. The two executor-level image-validation tests
use a fake access token, so discovery now fails with a real 401 before
image validation ever runs — the tests saw 401/500 instead of the
sanitized 400 they assert.

Stub globalThis.fetch for the ServerConfigService call with a minimal
valid protobuf response (field-27 submessage, varint-encoded tag,
*.api5.cursor.sh hosts accepted by validateCursorAgentUrl). Image
validation itself is untouched and still exercised end-to-end.
28/28 green.
backryun added a commit to backryun/OmniRoute that referenced this pull request Aug 21, 2026
diegosouzapw#10804 (fa0cd5a) moved agent-endpoint discovery (a live
api2.cursor.sh GetServerConfig call) ahead of request building inside
CursorExecutor.execute. The two executor-level image-validation tests
use a fake access token, so discovery now fails with a real 401 before
image validation ever runs — the tests saw 401/500 instead of the
sanitized 400 they assert.

Stub globalThis.fetch for the ServerConfigService call with a minimal
valid protobuf response (field-27 submessage, varint-encoded tag,
*.api5.cursor.sh hosts accepted by validateCursorAgentUrl). Image
validation itself is untouched and still exercised end-to-end.
28/28 green.
backryun added a commit to backryun/OmniRoute that referenced this pull request Aug 22, 2026
diegosouzapw#10804 (fa0cd5a) moved agent-endpoint discovery (a live
api2.cursor.sh GetServerConfig call) ahead of request building inside
CursorExecutor.execute. The two executor-level image-validation tests
use a fake access token, so discovery now fails with a real 401 before
image validation ever runs — the tests saw 401/500 instead of the
sanitized 400 they assert.

Stub globalThis.fetch for the ServerConfigService call with a minimal
valid protobuf response (field-27 submessage, varint-encoded tag,
*.api5.cursor.sh hosts accepted by validateCursorAgentUrl). Image
validation itself is untouched and still exercised end-to-end.
28/28 green.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
Requests AgentUrlConfig from Cursor with each selected account token and selects the account's actual server-assigned Agent endpoint (agentUrl/agentnUrl) instead of a fixed global/us host, which fails for teams pinned to a different region. Caches validated endpoints by connection+token. Closes diegosouzapw#10802.

Validated in an isolated worktree boarded onto origin/release/v3.8.50 (0 conflicts, 4 files):
- 18/18 focused tests pass (cursor-agent-host, cursor-apikey-provider).
- provider-translate-path-golden.test.ts initially failed — traced to a pre-existing base-red (stale golden snapshot left by an earlier freebuff merge, diegosouzapw#10531, unrelated to this PR) and confirmed it reproduces on the pure release tip without this PR's changes. Fixed directly on release/v3.8.50 (mechanical key-ordering regen, values unchanged) rather than folding it into this PR's scope; green after merging that fix in.
- check-file-size, check-changelog-integrity: OK.
- typecheck:core: clean.
- check-complexity / check-cognitive-complexity: OK, both under baseline.
- Author additionally validated live: a real Cursor request selected agentn.us.api5.cursor.sh and returned HTTP 200/PING.

Co-authored-by: tuandinh0801 <tuandinh0801@users.noreply.github.com>
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.

fix(providers): Cursor Agent endpoint ignores account region assignment

2 participants