Skip to content

fix(antigravity): attempt onboarding when projectId is empty (#5193 regression of #2541) - #7815

Merged
diegosouzapw merged 3 commits into
cheaper-inference:release/v3.8.49from
rafaumeu:fix/antigravity-onboarding-regression
Jul 20, 2026
Merged

diegosouzapw merged 3 commits into
cheaper-inference:release/v3.8.49from
rafaumeu:fix/antigravity-onboarding-regression

Conversation

@rafaumeu

Copy link
Copy Markdown
Contributor

Summary

Fixes #7814 — PR #5193 regression of #2541.

Accounts without a pre-existing Google Cloud Code project get stuck in a login catch-22: loadCodeAssist returns empty projectId, but the fire-and-forget onboarding gate if (projectId) never fires for empty projectId — so onboarding never runs.

Changes

src/lib/oauth/providers/antigravity.ts — Add else if branch after the existing if (projectId) gate:

  • When projectId is empty AND onboardUserEndpoints are configured, attempt onboarding inline (bounded by AbortSignal.timeout(8s))
  • If onboarding succeeds, retry loadCodeAssist (also 8s-bounded) to discover the newly created project
  • Graceful degradation: if either step fails/times out, projectId stays empty and lazy retry at request-time (antigravityProjectBootstrap.ts) handles it

tests/unit/antigravity-oauth-postexchange-nonblocking.test.ts — 3 new tests:

  1. postExchange attempts onboarding when projectId is empty and returns discovered projectId — verifies the fix works end-to-end
  2. postExchange falls back to empty projectId when onboardUser fails — verifies graceful degradation
  3. postExchange is timeout-bounded during onboarding attempt (empty projectId) — verifies no infinite hang

Also adjusted existing timeout assertion test to account for the new onboarding attempt (+8s budget when projectId is empty).

Behavior Matrix

Scenario Before (broken) After (fixed)
projectId exists Fire-and-forget onboarding (unchanged) Fire-and-forget onboarding (unchanged)
projectId empty, onboard succeeds Returns empty projectId (BROKEN) Discovers projectId after onboarding
projectId empty, onboard fails Returns empty projectId (broken, no attempt) Returns empty projectId (attempted, graceful)
All endpoints stall Hangs if await (old), or empty projectId Timeout-bounded ~24s max, empty projectId

Tradeoff

Adds at most +8s to login flow when projectId is empty (onboarding attempt + retry loadCodeAssist, both timeout-bounded). This only affects new accounts without a project — a one-time cost. The alternative (permanently empty projectId) is a broken login.

Tests

All 5 tests passing on Node 24:

  • 2 existing tests (fire-and-forget + timeout-bounded) preserved
  • 3 new tests covering empty-projectId onboarding path
  • RED -> GREEN TDD cycle verified

Checklist

  • Spec-driven development (RED->GREEN->REFACTOR)
  • All quality gates pass (prettier, eslint, t11:any-budget, docs-sync)
  • Existing tests preserved and passing
  • No new dependencies
  • Graceful degradation on failure
  • Follows project conventions (AbortSignal.timeout pattern, pino logger, try/catch)

@rafaumeu
rafaumeu requested a review from diegosouzapw as a code owner July 20, 2026 02:43
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for the sharp root-cause trace here -- the regression chain (#2219 -> #2569 -> #5193 -> this) is exactly right, and the if (projectId) gate never firing for the empty-projectId case is a genuinely nasty catch-22 for new accounts.

Verified locally: checked out the branch in an isolated worktree and ran the full test file -- all 5 tests pass (2 preserved + 3 new), confirming the fix and the graceful-degradation/timeout-bound behavior.

One process item before this can merge: the PR is currently based on main, but our active integration branch is release/v3.8.49 (the repo's actual default branch). Since antigravity.ts is untouched between main and release/v3.8.49, retargeting is conflict-free for your changes -- we'll flip the base so this lands in the current cycle and Closes #7814 auto-closes on merge. The "Quality Gates (Extended)" CI red you're seeing is an unrelated pre-existing zizmor baseline drift (176 vs 175) in .github/workflows/* -- nothing in your diff touches those files, so that's on us to reconcile, not something to chase in this PR.

Minor non-blocking note for your own tracking: the worst-case added latency when all four bounded network calls (userInfo, loadCodeAssist, onboardUser, retry-loadCodeAssist) are slow-but-not-timing-out is closer to ~32s than the "+8s" mentioned in the description -- still fully bounded (no infinite hang), just worth knowing.

Nice work overall -- clean, surgical, well-tested fix for a real bug.

@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.49 July 20, 2026 03:37
rafaumeu and others added 2 commits July 20, 2026 01:51
…-inference#5193 regression of cheaper-inference#2541)

PR cheaper-inference#5193 changed onboarding from inline await to fire-and-forget gated by
if (projectId), which never fires when projectId is empty — the exact case
that needs onboarding. This re-introduced the cheaper-inference#2541 catch-22.

Add an else-if branch that attempts onboarding inline (bounded by
AbortSignal.timeout) when projectId is empty, then retries loadCodeAssist
to discover the newly created project.

- Existing accounts with projectId: unchanged (fire-and-forget)
- New accounts without projectId: now onboarded within login flow
- Timeout bounded: +8s worst case (onboardUser + retry loadCodeAssist)
- Graceful degradation: if onboarding fails, lazy retry handles it

Tests:
- 3 new tests covering empty-projectId onboarding path (RED→GREEN)
- Existing 2 tests preserved and passing
- Adjusted timeout assertion for the stall test (now includes onboardUser stall)
- 5/5 passing on Node 24

Fixes cheaper-inference#7814
Related: cheaper-inference#5193, cheaper-inference#2569, cheaper-inference#2541, cheaper-inference#2219
…tId fix (cheaper-inference#7814)

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouzapw@users.noreply.github.com>
@diegosouzapw
diegosouzapw force-pushed the fix/antigravity-onboarding-regression branch from f5fc76e to 883febd Compare July 20, 2026 04:53
diegosouzapw added a commit to rafaumeu/OmniRoute that referenced this pull request Jul 20, 2026
…heaper-inference#5193 regression of cheaper-inference#2541)"

This reverts commit b36d3b6.

That commit is a byte-identical duplicate of the antigravity onboarding
fix shipped separately in PR cheaper-inference#7815 (same author, same diff to
src/lib/oauth/providers/antigravity.ts and its test file). Keeping it
here would ship and credit the same fix twice across two PRs. cheaper-inference#7808 is
scoped to the cheaper-inference#7791 global-install alias-resolver fix only; the
antigravity fix stays in cheaper-inference#7815.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Validated in local merge-train on tomni-proxmox-113 @ 19bcf534352e24cdd2448cdfdfd64d5bd9695c74 (FAST gates green: static + changed tests + vitest)

@diegosouzapw
diegosouzapw merged commit bf9202d into cheaper-inference:release/v3.8.49 Jul 20, 2026
5 checks passed
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…-inference#5193 regression of cheaper-inference#2541) (cheaper-inference#7815)

* fix(antigravity): attempt onboarding when projectId is empty (cheaper-inference#5193 regression of cheaper-inference#2541)

PR cheaper-inference#5193 changed onboarding from inline await to fire-and-forget gated by
if (projectId), which never fires when projectId is empty — the exact case
that needs onboarding. This re-introduced the cheaper-inference#2541 catch-22.

Add an else-if branch that attempts onboarding inline (bounded by
AbortSignal.timeout) when projectId is empty, then retries loadCodeAssist
to discover the newly created project.

- Existing accounts with projectId: unchanged (fire-and-forget)
- New accounts without projectId: now onboarded within login flow
- Timeout bounded: +8s worst case (onboardUser + retry loadCodeAssist)
- Graceful degradation: if onboarding fails, lazy retry handles it

Tests:
- 3 new tests covering empty-projectId onboarding path (RED→GREEN)
- Existing 2 tests preserved and passing
- Adjusted timeout assertion for the stall test (now includes onboardUser stall)
- 5/5 passing on Node 24

Fixes cheaper-inference#7814
Related: cheaper-inference#5193, cheaper-inference#2569, cheaper-inference#2541, cheaper-inference#2219

* docs(changelog): add fragment for antigravity onboarding empty-projectId fix (cheaper-inference#7814)

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouzapw@users.noreply.github.com>
Co-authored-by: Rafael Dias Zendron <rafaumeu@users.noreply.github.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…-inference#5193 regression of cheaper-inference#2541) (cheaper-inference#7815)

* fix(antigravity): attempt onboarding when projectId is empty (cheaper-inference#5193 regression of cheaper-inference#2541)

PR cheaper-inference#5193 changed onboarding from inline await to fire-and-forget gated by
if (projectId), which never fires when projectId is empty — the exact case
that needs onboarding. This re-introduced the cheaper-inference#2541 catch-22.

Add an else-if branch that attempts onboarding inline (bounded by
AbortSignal.timeout) when projectId is empty, then retries loadCodeAssist
to discover the newly created project.

- Existing accounts with projectId: unchanged (fire-and-forget)
- New accounts without projectId: now onboarded within login flow
- Timeout bounded: +8s worst case (onboardUser + retry loadCodeAssist)
- Graceful degradation: if onboarding fails, lazy retry handles it

Tests:
- 3 new tests covering empty-projectId onboarding path (RED→GREEN)
- Existing 2 tests preserved and passing
- Adjusted timeout assertion for the stall test (now includes onboardUser stall)
- 5/5 passing on Node 24

Fixes cheaper-inference#7814
Related: cheaper-inference#5193, cheaper-inference#2569, cheaper-inference#2541, cheaper-inference#2219

* docs(changelog): add fragment for antigravity onboarding empty-projectId fix (cheaper-inference#7814)

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouzapw@users.noreply.github.com>
Co-authored-by: Rafael Dias Zendron <rafaumeu@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(auth): postExchange fire-and-forget skips onboarding when projectId is empty (#5193 regression of #2541)

2 participants