Skip to content

fix(sse): cover opencode-zen with the egress-IP lockout and feed body-text rules - #16797

Merged
diegosouzapw merged 8 commits into
cheaper-inference:release/v3.8.52from
maxmad64bis:fix/opencode-zen-missing-egress-bucket
Oct 18, 2026
Merged

diegosouzapw merged 8 commits into
cheaper-inference:release/v3.8.52from
maxmad64bis:fix/opencode-zen-missing-egress-bucket

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #15306

Summary

opencode-zen now joins the egress-IP lockout by default (opencode, opencode-go and opencode-cli before; the four family members now), so a quota 429 cools the accounts on that address instead of letting zen re-serve a failed egress, and paid setups keep the OMNIROUTE_EGRESS_IP_LOCK_PROVIDERS=none escape. Body-text error rules also reach the opencode family and cloudflare-ai now, so a monthly-quota or daily-allocation 429 reports quota_exhausted with its announced cooldown instead of a generic short rate_limit. Users saw repeated retries against an exhausted quota; now the verdict and its scope match what the catalog rules declare.

Related Issues

  • No linked issue — reproduced on the release base

Target Branch

  • Base is the active release/v3.8.x branch (the highest open release/v*), not main
  • New feature? From 3.8.55 on it is held with the v4-feature label for the v4 channel

Validation

  • Change type: provider
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/egress-lock-allowlist-10880.test.ts — asserts opencode-zen is in the egress lock scope; exclusivity for other providers is unchanged.
  • tests/unit/egress-ip-lock-env-override.test.ts — the unset and blank defaults now list 4 members; none and explicit lists are unchanged.
  • tests/unit/proxy-outcome-memory.test.ts — zen moved in-scope with a mirror case that skips the refused member.
  • tests/unit/pool-ip-quota-429-path.test.ts — a zen 429 now skips the pool member; openai takes the out-of-scope role.
  • tests/unit/opencode-429-pool-reselect.test.ts — a zen 429 now reselects; openai takes the out-of-list role.
  • tests/unit/agentrouter-error-rules.test.ts — opencode body markers now yield quota_exhausted with connection scope; the cloudflare-ai daily case is added.
  • tests/unit/opencode-400-model-unavailable.test.ts — quota-body markers now yield quota_exhausted with honored scope.
  • tests/unit/egress-ip-lock-10880.test.ts — comment updated to the 4-member set; added zen case with one upstream call and a cooled sibling.

Coverage Notes

  • open-sse/config/providerErrorRules.ts is covered by tests/unit/egress-lock-allowlist-10880.test.ts, tests/unit/egress-ip-lock-env-override.test.ts and tests/unit/agentrouter-error-rules.test.ts.

Reviewer Notes

@maxmad64bis
maxmad64bis force-pushed the fix/opencode-zen-missing-egress-bucket branch from 1e3692c to 4b12774 Compare October 15, 2026 23:32
…-text rules

document the 4-member egress-IP lockout default in the env example, the reference and its 66 locale mirrors
…restore tip defaults

Conflicts in providerErrorRules.ts, four egress/rule tests and .i18n-state.json
resolved to the release tip: cheaper-inference#16310 already dropped opencode from the egress
default set, and the opencode-zen / full-text widenings are re-applied behind
default-off feature flags in the follow-up commits so the default path stays
byte-identical to the tip.
…gress-IP lockout

opencode-zen joins the default egress-IP lock family only when the new
default-off flag is on (and OMNIROUTE_EGRESS_IP_LOCK_PROVIDERS is unset, an
explicit value still wins). The flag is read per call through a reader that
accountFallback.ts injects, so providerErrorRules.ts gains no src/ import and
fails closed to the release default. Flag off: every Zen connection keeps
cooling down on its own, exactly as on the release tip.
…de body-text rules

The opencode catalog rules (organization_quota_exceeded, monthly usage limit
reached, endpoint is unavailable, ...) match on body text the stripped
structured error never carries, so they cannot fire through
checkFallbackError today. Letting them see the full text reclassifies such a
429 as quota exhausted with a connection-scoped lock, a cooldown/lockout
change, so it is gated behind a default-off flag read through the injected
reader. Flag off: the opencode family keeps the structured body, as on the tip.
…he neuron-allocation rule

The cloudflare-ai catalog rule matches the 429 "daily free allocation" body,
which the structured error never carries, so it cannot fire through
checkFallbackError today. Letting it see the full text reclassifies that 429
from a short rate limit to quota exhausted, so it gets its own default-off
flag. Also rewrites the cheaper-inference#16797 changelog fragment to describe the opt-in
flags.
# Conflicts:
#	docs/reference/FEATURE_FLAGS.md
#	tests/unit/feature-flags-settings.test.ts
#	tests/unit/server-owned-tool-loop-flag.test.ts
@diegosouzapw
diegosouzapw merged commit ce7da47 into cheaper-inference:release/v3.8.52 Oct 18, 2026
1 of 3 checks passed
@maxmad64bis
maxmad64bis deleted the fix/opencode-zen-missing-egress-bucket branch October 18, 2026 22:37
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.

2 participants