Skip to content

team-mode retry rewrites antigravity-gemini-3-flash to invalid antigravity-gemini-3-flash-preview #117

Description

@napadayte

Summary

Team-mode background retry can synthesize an invalid Antigravity Gemini model ID after a retryable subagent failure. In the observed run, a subagent failed on openai/gpt-5.4-mini, retried as google/antigravity-gemini-3-flash-preview, and immediately hit ProviderModelNotFoundError because the valid model is google/antigravity-gemini-3-flash.

Environment

  • LazyCodex version: source checkout from local OMO bundle at 4.16.0
  • OpenCode version: 1.17.13
  • OS: macOS
  • Install method: Desktop OpenCode + OMO plugin/bundle
  • Relevant config: team-mode run in /Users/napadayte/MemSys with Antigravity Gemini available and working in direct smoke tests

Repository Decision

  • Target repository: code-yeongyu/lazycodex
  • Why this belongs there: the failing behavior is in OMO/OpenCode plugin-side model fallback and provider model ID transformation, not in upstream Codex core.
  • LazyCodex evidence (runtime + source):
    • Runtime log: ~/.local/share/opencode/log/opencode.log at 2026-07-08T23:28:57Z shows retry session creation with model.id=antigravity-gemini-3-flash-preview and immediate ProviderModelNotFoundError.
    • Source: packages/omo-opencode/src/features/background-agent/fallback-retry-handler.ts builds retry model IDs through transformModelForProvider(providerID, nextFallback.model).
    • Source: packages/model-core/src/provider-model-id-transform.ts rewrites gemini-3-flash to gemini-3-flash-preview for provider === "google" without excluding antigravity-* model IDs.
  • Upstream Codex source evidence from $LAZYCODEX_SOURCE_ROOT/openai-codex-source:
    • No evidence that upstream Codex owns OMO team-mode retry logic or OMO provider-model transformation.
    • The observed failure happens inside OMO package paths and depends on OMO fallback wiring.

Reproduction

  1. Start a team-mode run where a subagent can retry through a fallback chain that includes Google Antigravity Gemini.
  2. Let the initial subagent model fail with a retryable error such as AI_APICallError: Service Unavailable.
  3. Observe the retry path create a replacement subagent session.
  4. In the failing case, OMO creates the retry session with google/antigravity-gemini-3-flash-preview.
  5. The retry immediately fails with ProviderModelNotFoundError.

Expected Behavior

When team-mode retries a subagent onto Antigravity Gemini, it should keep the valid model ID google/antigravity-gemini-3-flash instead of appending -preview.

Actual Behavior

OMO creates a retry session with google/antigravity-gemini-3-flash-preview and the prompt fails with:

ProviderModelNotFoundError: Model not found: google/antigravity-gemini-3-flash-preview. Did you mean: antigravity-gemini-3-flash, gemini-2.5-flash-preview-tts, gemini-3-flash-preview?

Evidence

  • Runtime log excerpt from ~/.local/share/opencode/log/opencode.log:
    • 2026-07-08T23:28:57.863Z subagent on openai/gpt-5.4-mini hits AI_APICallError: Service Unavailable
    • 2026-07-08T23:28:57.887Z retry session created with model.id=antigravity-gemini-3-flash-preview model.providerID=google
    • 2026-07-08T23:28:57.963Z share subscriber failed with ProviderModelNotFoundError
    • 2026-07-08T23:28:57.969Z prompt_async failed with the same error
  • Source evidence:
    • packages/omo-opencode/src/features/background-agent/fallback-retry-handler.ts
    • packages/delegate-core/src/model-selection.ts
    • packages/model-core/src/provider-model-id-transform.ts

Root Cause

Strongly evidenced root cause: OMO fallback/retry paths generate the retry model via transformModelForProvider, and the Google branch in packages/model-core/src/provider-model-id-transform.ts blindly rewrites gemini-3-flash to gemini-3-flash-preview. That transformation is valid for plain Google Gemini preview naming but invalid for Antigravity-prefixed IDs such as antigravity-gemini-3-flash, producing the nonexistent antigravity-gemini-3-flash-preview.

Three investigated hypotheses:

  • Hypothesis 1: old team cleanup bug (delete-team / ENOTEMPTY) is causing the fresh failure. Rejected: the fresh runtime failure occurs before cleanup and is a model-resolution error.
  • Hypothesis 2: team-mode is failing because Codex thread tools are missing. Rejected: thread tooling is available; the observed failure is in subagent retry model selection.
  • Hypothesis 3: fallback/retry incorrectly rewrites Antigravity Gemini model IDs. Supported by both runtime logs and the current transform implementation.

Proposed Fix

  • In packages/model-core/src/provider-model-id-transform.ts, skip the Google preview rewrite when the model ID starts with antigravity-.
  • Add regression tests covering:
    • google + gemini-3-flash -> gemini-3-flash-preview
    • google + antigravity-gemini-3-flash -> antigravity-gemini-3-flash
    • equivalent protection for antigravity-gemini-3.1-pro if the same transform path can touch it
  • Verify both delegate selection and background-agent retry paths still produce the same valid retry model.

Verification Plan

  • Reproduce the original retry path and confirm no retry session is created with antigravity-gemini-3-flash-preview.
  • Confirm the replacement retry session uses google/antigravity-gemini-3-flash.
  • Regression check: plain Google Gemini fallback should still map to preview naming where that behavior is intended.

This issue or PR was generated by LazyCodex.
Tag: lazycodex-generated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions