Skip to content

fix(routing): add agy to executor map so it uses AntigravityExecutor - #2957

Merged
diegosouzapw merged 1 commit into
diegosouzapw:mainfrom
ReqX:fix/agy-executor-missing
May 31, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:mainfrom
ReqX:fix/agy-executor-missing

Conversation

@ReqX

@ReqX ReqX commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The agy provider was registered in providerRegistry.ts with executor: "antigravity" but the executor map in executors/index.ts only had an "antigravity" entry, no "agy" entry. This caused getExecutor("agy") to fall through to DefaultExecutor, which tried to read this.config.baseUrl (singular). The agy provider config only has baseUrls (plural), so buildUrl() returned undefined. Passing undefined to fetch() triggered a TypeError: Cannot read properties of undefined (reading 'toString') inside Node's undici HTTP client, surfaced as a 502 to the client.

Fix: Add agy: new AntigravityExecutor() to the executor map. One line.

Related Issues

Validation

  • npm run lint clean (0 warnings)
  • npm run typecheck:core clean
  • Manual test: agy/gemini-3-flash, agy/claude-sonnet-4-6, agy/gemini-3.5-flash-low all return valid responses on patched dev server

Tests Added Or Updated

  • New: tests/unit/executor-agy.test.ts with 5 assertions:
    • getExecutor("agy") returns AntigravityExecutor (not DefaultExecutor)
    • getExecutor("antigravity") returns AntigravityExecutor
    • buildUrl() returns valid streaming endpoint
    • buildUrl() returns valid non-streaming endpoint (always streams)
    • buildHeaders() sets Bearer auth from accessToken

Coverage Notes

  • Change is in open-sse/executors/index.ts (one map entry). The new test file covers executor resolution, URL building, and header construction for the agy provider. Existing antigravity tests (antigravity-credits, antigravity-version, antigravity-projectid, executor-default-base) all pass unchanged.

Reviewer Notes

  • Missing-map-entry bug. No logic changed, no new code paths. The agy provider was unusable since its introduction because the executor was never wired up.
  • The AntigravityExecutor constructor hardcodes super("antigravity", PROVIDERS.antigravity), so both "antigravity" and "agy" share the same provider config. This is correct: identical base URLs, OAuth credentials, and request format.

The agy provider was registered in providerRegistry.ts with
executor: "antigravity" but the executor map in executors/index.ts
only had an "antigravity" entry. getExecutor("agy") fell through to
DefaultExecutor, which returned undefined for baseUrl (agy only has
baseUrls), causing fetch(undefined) → TypeError: Cannot read properties
of undefined (reading 'toString').

Closes diegosouzapw#2932
@ReqX
ReqX requested a review from diegosouzapw as a code owner May 30, 2026 22:20

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

Code Review

This pull request adds the agy alias for the AntigravityExecutor and introduces a new unit test file tests/unit/executor-agy.test.ts to verify its functionality. The review feedback correctly advises rewriting the new tests to use Vitest's native test and expect APIs instead of Node's native node:test and node:assert modules. This change is necessary to maintain consistency with the repository's test runner and ensure accurate test coverage tracking to meet the required 75% coverage threshold.

Comment on lines +1 to +39
import test from "node:test";
import assert from "node:assert/strict";

import { getExecutor, AntigravityExecutor } from "../../open-sse/executors/index.ts";

test("getExecutor('agy') returns AntigravityExecutor (not DefaultExecutor)", () => {
const executor = getExecutor("agy");
assert.ok(executor instanceof AntigravityExecutor, "agy provider should use AntigravityExecutor");
});

test("getExecutor('antigravity') returns AntigravityExecutor", () => {
const executor = getExecutor("antigravity");
assert.ok(executor instanceof AntigravityExecutor, "antigravity provider should use AntigravityExecutor");
});

test("getExecutor('agy') builds valid streaming URL", () => {
const executor = getExecutor("agy");
const url = executor.buildUrl("gemini-3-flash", true);
assert.ok(
url.includes("streamGenerateContent?alt=sse"),
`expected streaming endpoint URL, got: ${url}`
);
});

test("getExecutor('agy') builds valid non-streaming URL", () => {
const executor = getExecutor("agy");
const url = executor.buildUrl("gemini-3-flash", false);
// Antigravity executor always uses streaming endpoint (buildUrl ignores stream flag)
assert.ok(
url.includes("streamGenerateContent?alt=sse"),
`expected streaming endpoint URL (always), got: ${url}`
);
});

test("getExecutor('agy') buildHeaders returns Bearer auth", () => {
const executor = getExecutor("agy");
const headers = executor.buildHeaders({ accessToken: "test-token" });
assert.equal(headers.Authorization, "Bearer test-token");
});

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.

medium

The repository uses Vitest as its test runner (as indicated by vitest.config.ts in the root). Using Node's native node:test and node:assert modules can lead to inconsistency, potential issues with Vitest's test runner/matchers, and incorrect test coverage reporting (which is critical to maintain the ≥75% coverage requirement). Please rewrite the test to use Vitest's native test and expect APIs.

import { test, expect } from "vitest";

import { getExecutor, AntigravityExecutor } from "../../open-sse/executors/index.ts";

test("getExecutor('agy') returns AntigravityExecutor (not DefaultExecutor)", () => {
  const executor = getExecutor("agy");
  expect(executor).toBeInstanceOf(AntigravityExecutor);
});

test("getExecutor('antigravity') returns AntigravityExecutor", () => {
  const executor = getExecutor("antigravity");
  expect(executor).toBeInstanceOf(AntigravityExecutor);
});

test("getExecutor('agy') builds valid streaming URL", () => {
  const executor = getExecutor("agy");
  const url = executor.buildUrl("gemini-3-flash", true);
  expect(url).toContain("streamGenerateContent?alt=sse");
});

test("getExecutor('agy') builds valid non-streaming URL", () => {
  const executor = getExecutor("agy");
  const url = executor.buildUrl("gemini-3-flash", false);
  expect(url).toContain("streamGenerateContent?alt=sse");
});

test("getExecutor('agy') buildHeaders returns Bearer auth", () => {
  const executor = getExecutor("agy");
  const headers = executor.buildHeaders({ accessToken: "test-token" });
  expect(headers.Authorization).toBe("Bearer test-token");
});
References
  1. Coverage must stay ≥ 75%. Using Vitest APIs ensures proper coverage tracking and integration with the repository's test suite. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Following the existing pattern. Happy to rewrite, but should be for all then, which shouldn't be the scope of this PR imho.

Comment thread open-sse/executors/index.ts

@kilo-code-bot kilo-code-bot 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 Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
open-sse/executors/index.ts 52 Missing provider registration - The provider ID "agy" should be registered in src/shared/constants/providers.ts and, if OAuth-based, in src/lib/oauth/constants/oauth.ts. Without this, requests using the "agy" provider may fail validation.
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
None
Files Reviewed (2 files)
  • open-sse/executors/index.ts - 1 issues
  • tests/unit/executor-agy.test.ts - 0 issues

@ReqX

ReqX commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

Replying to #2957 (comment)

Thanks for the review. I kept node:test + node:assert/strict to match the existing executor tests in this repo:

  • tests/unit/executor-gitlab.test.ts
  • tests/unit/executor-puter.test.ts
  • tests/unit/executor-default-base.test.ts
  • tests/unit/antigravity-credits.test.ts
  • tests/unit/antigravity-version.test.ts

All use import test from "node:test" / import assert from "node:assert/strict". Happy to rewrite to Vitest if the maintainers prefer consistency the other way.

@ReqX

ReqX commented May 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Replying to @kilo-code-bot review (#pullrequestreview-4396079202)

The WARNING flags that agy should be registered in src/shared/constants/providers.ts and src/lib/oauth/constants/oauth.ts, but it is already registered in both:

  • src/shared/constants/providers.ts:93 = id: "agy"
  • src/lib/oauth/constants/oauth.ts:190 = Antigravity CLI (agy) OAuth config

This is pre-existing registration. The only missing piece was the executor map entry, which this PR adds.

@diegosouzapw

Copy link
Copy Markdown
Owner

Thank you for your contribution! This PR has been reviewed and integrated into the upcoming v3.8.8 release. 🎉

@diegosouzapw
diegosouzapw merged commit 379b72c into diegosouzapw:main May 31, 2026
3 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jun 2, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
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.

[BUG] Antigravity CLI not working [agy/gemini-3-flash] [502]: Cannot read properties of undefined (reading 'toString') (reset after 10s)

2 participants