Skip to content

fix(provisioner): drop dead trinity, hard-block Codex from community fallback - #282

Closed
samxu01 wants to merge 1 commit into
mainfrom
fix/community-fallback-drop-trinity-block-codex
Closed

samxu01 wants to merge 1 commit into
mainfrom
fix/community-fallback-drop-trinity-block-codex

Conversation

@samxu01

@samxu01 samxu01 commented May 3, 2026

Copy link
Copy Markdown
Contributor

Why

Investigating fakesam's session failing on every model in the chain:

Model Result
openai-codex/gpt-5.4-mini 403 (community agent has no Codex creds)
google/gemini-2.5-flash auth_permanent (key revoked)
openrouter/nvidia/nemotron-3-super-120b-a12b:free 401 Missing Authentication header
openrouter/arcee-ai/trinity-large-preview:free 404 No endpoints found

Two root causes:

  1. Trinity is dead at OpenRouter — every fallback hop into trinity errored.
  2. The OpenRouter provider config is entirely missing from the live gateway PVC — models.providers only contains openai-codex, no openrouter entry. So when nemotron is requested, the gateway has no provider definition to attach the key to → 401. Cause: applyOpenClawModelDefaults writes the OR provider, but it only runs inside provisionOpenClawAccount. No reprovision has happened since the code that adds the provider was last updated.

This PR fixes #1 in code. #2 is fixed by running reprovision-all after the PR deploys.

What

  • Drop arcee-ai/trinity-large-preview:free from every reference in the provisioner:
    • OPENROUTER_FREE_FALLBACKS constant
    • defaults.model.fallbacks community chain
    • models.providers.openrouter model catalog
    • 2 LiteLLM virtual-key allowlists
  • Drop trinity from globalModelConfigService.ts communityAgentModel.fallbacks
  • Flip 7 community-agent preset recommendedModel entries (presets.ts) from trinity → nemotron
  • New hard assertion: applyOpenClawModelDefaults throws if any openai-codex/* model appears in defaults.model.{primary,fallbacks}. Cheap defense-in-depth so a future edit can't accidentally re-introduce Codex into the community chain and silently burn quota.

Behavioral change

Community agents when nemotron 429s:

  • Before: chain falls through gemini (revoked) → trinity (404) → request errors with multi-model 404 chain
  • After: chain falls through gemini placeholders (still inert until key restored) → request fails. Agent goes silent for that heartbeat, retries next interval. No Codex burn even by accident.

Dev agents (theo/nova/pixel/ops/aria) — unchanged. Still use openai-codex/gpt-5.4-mini primary via the per-agent override, and their fallback list still includes nemotron + gemini placeholders.

Test plan

  • Deploy Dev runs green
  • After deploy: trigger reprovision-all. Confirm new gateway PVC /state/moltbot.json shows:
    • agents.defaults.model.primary = openrouter/nvidia/nemotron-3-super-120b-a12b:free (not gpt-5.4-mini)
    • models.providers.openrouter = { baseUrl, api, models: [nemotron] } (provider entry now exists)
    • No trinity references anywhere
  • Trigger fakesam (or any community agent) heartbeat; confirm LiteLLM logs show nemotron call succeeding (not 401, not 5.4-mini)
  • Confirm dev-agent overrides (nova/pixel/theo/ops/aria) still show model.primary = openai-codex/gpt-5.4-mini

🤖 Generated with Claude Code

…fallback

Two compounding bugs in the community-agent model chain:

1. arcee-ai/trinity-large-preview:free is dead at OpenRouter (404 No
   endpoints found). Every fallback hop into trinity errored, and it was
   referenced in:
   - OPENROUTER_FREE_FALLBACKS (drives dev-agent fallbacks)
   - defaults.model.fallbacks (community-agent fallback chain)
   - openrouter provider catalog (model registry)
   - 2 LiteLLM virtual-key allowlists
   - globalModelConfigService.ts default community fallbacks
   - 7 community-agent preset recommendedModel entries

2. The community fallback chain had no explicit guard against re-introducing
   openai-codex/* models. Community agents must never burn paid Codex quota
   even on fallback (they aren't issued Codex credentials anyway, but the
   guarantee was implicit). Added a hard assertion in
   applyOpenClawModelDefaults that throws if any openai-codex/* model is
   present in defaults.model.{primary,fallbacks} — fail the next provision
   instead of silently leaking quota.

After this PR + Deploy Dev + reprovision-all, the gateway PVC will reflect:
- defaults.model.primary = openrouter/nvidia/nemotron-3-super-120b-a12b:free
- defaults.model.fallbacks = [gemini-2.5-flash, lite, 2.0-flash] (inert
  placeholders until GEMINI_API_KEY is reinstated)
- models.providers.openrouter = { baseUrl, api, models: [nemotron] }
  (the OR provider was missing from the live PVC entirely, which is why
  fakesam's nemotron call 401'd "Missing Authentication header" — gateway
  had no provider definition to attach the key to)

If nemotron 429s while gemini is dead, community agents go silent for that
heartbeat and retry next interval. Better than burning Codex.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
samxu01 added a commit that referenced this pull request May 3, 2026
…fallback (#282)

Two compounding bugs in the community-agent model chain:

1. arcee-ai/trinity-large-preview:free is dead at OpenRouter (404 No
   endpoints found). Removed from OPENROUTER_FREE_FALLBACKS,
   defaults.model.fallbacks, OR provider catalog, 2 LiteLLM virtual-key
   allowlists, globalModelConfigService communityAgentModel.fallbacks,
   and 7 community-preset recommendedModel entries.

2. Added a hard assertion in applyOpenClawModelDefaults that throws if
   any openai-codex/* model appears in defaults.model.{primary,fallbacks}.
   Cheap defense-in-depth: a future edit that accidentally puts Codex in
   the community chain will fail the next provision, not silently burn
   the weekly Codex quota.

After Deploy Dev + reprovision-all the gateway PVC will reflect:
- defaults.model.primary = openrouter/nvidia/nemotron-3-super-120b-a12b:free
- models.providers.openrouter = { baseUrl, api, models: [nemotron] } (the
  OR provider was missing from the live PVC entirely, which is why
  fakesam's nemotron call 401'd "Missing Authentication header" — gateway
  had no provider definition to attach the key to)

If nemotron 429s while gemini is dead, community agents go silent for
that heartbeat and retry next interval. Better than burning Codex.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@samxu01

samxu01 commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Squash-merged locally as 77e10c3 to preserve Sam Xu git author attribution. Closing.

@samxu01 samxu01 closed this May 3, 2026
@samxu01
samxu01 deleted the fix/community-fallback-drop-trinity-block-codex branch May 3, 2026 22:10
samxu01 added a commit that referenced this pull request May 3, 2026
PR #282 removed arcee-ai/trinity-large-preview:free (dead at OR), but the
test assertion still required it. Update to require gemini-2.5-flash
present (inert placeholder), explicitly exclude trinity (regression
guard), and preserve openai-codex/* exclusion checks.

Two pre-existing failures (podController, dmService) flagged separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
samxu01 added a commit that referenced this pull request May 3, 2026
…ordination (#285)

Three changes to reduce 429-induced lane stalls and lost requests:

1. Drop gemini from fallback chains. GEMINI_API_KEY belongs to project
   946211286881 where Gemini API is not enabled (403 every call). No plan
   to provision a working key, so removing rather than chaining 60-120s of
   dead-end retries per failed request.
2. Drop trinity from LiteLLM model_list and all fallbacks. Already dead at
   OpenRouter (404 No endpoints found, removed gateway-side in PR #282).
3. num_retries 0 → 1, retry_after: 1. The 1s delay gives the rotator
   sidecar time to swap auth.json before LiteLLM reads it for the retry,
   so the failed request lands on a fresh Codex account on retry. Same-
   prompt retry on 429 doesn't bill (4XX = no charge), so the retry
   across the rotator is genuinely free until success. Bounded to 1 retry
   to cap the cascade ceiling under burst load (multi-retry caused
   "symmetric account-2/3 depletion" per 2026-05-03 incident).

Final fallback: gpt-5.4{,-mini,-nano} → nemotron only. Nemotron itself has
no fallback — fail fast, next request lands on rotated Codex account.

Also synced agent-configs.yaml seed defaults (consumed by fresh gateway
pods before provisioner runs) and the dev-local external/litellm/config.yaml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
samxu01 added a commit that referenced this pull request May 4, 2026
… clarified (#289)

Update Agent Runtime quick-rule for community/dev model routing to match
the post-burn-fix state (PRs #282, #284, #285):

- Drop trinity reference (model dead at OpenRouter)
- Add aria to dev-agent list
- Note hard guardrail in applyOpenClawModelDefaults blocking codex from
  community fallback chain
- Document GEMINI_API_KEY's wrong-project status (946211286881) so
  future debugging doesn't waste time
- Document new retry policy: num_retries=1 + retry_after=1 lets
  codex-auth-rotator swap auth.json before retry reads it

Pure docs change, no test deltas.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.

Add basic unit tests for backend functions

1 participant