fix: simplify free-only detection, add regression tests for Zen subscriber downgrade#1
Closed
mrosnerr wants to merge 2 commits into
Conversation
…rade and chain degradation Add tests proving 4 issues in the free-only fallback implementation: P0: Paid Zen subscribers (connectedProviders=["opencode"]) get force-downgraded to free models because isFreeOnlyProviderConfiguration cannot distinguish free-tier from paid Zen users. P0: Category defaults for paid models are silently dropped via getFreeOnlyCategoryDefaultModel when the free-only gate fires. P0: Fallback chains are rewritten to the free-only chain even when availableModels proves the user has paid model access. P2: getFallbackChainForFreeOnlyProviders returns a degraded single-entry filtered chain instead of the full FREE_ONLY_FALLBACK_CHAIN when the original chain contains exactly one free model. Also adds coupling invariant test ensuring FREE_ONLY_FALLBACK_CHAIN providers stay in sync with FREE_ONLY_PROVIDER_IDS. All 4 regression tests fail on the current PR code, confirming the bugs.
…criber downgrade Replace the two-point interception approach (gate category default + replace fallback chain) with a simpler append strategy: - Restore connectedProviders to conditional read (matches dev branch) - Remove getFreeOnlyCategoryDefaultModel (was silently dropping paid category defaults) - Remove getFallbackChainForFreeOnlyProviders (was replacing chains wholesale, degrading to single-entry filtered chains) - Add appendFreeModelFallbacks: appends free models as a tail to the existing chain with deduplication - Derive freeOnly from availableModels on warm cache (correct signal), fall back to connectedProviders on cold cache only - Skip non-free entries in cold-cache loop when freeOnly Paid users are completely unaffected (warm-cache path identical to dev). Free users get free models appended as a safety net after the system chain naturally exhausts.
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA). To sign the CLA, please comment on this PR with: This is a one-time requirement. Once signed, all your future contributions will be automatically accepted. I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
MoerAI
pushed a commit
that referenced
this pull request
May 20, 2026
- Add focused ROADMAP with TOC and clear priorities - Pin package layering refactor as #1 urgent work - Add multi-harness agent OS notice to all language READMEs - Add ROADMAP section to root README with contributor guidance - All ROADMAP-related PRs should use the ROADMAP label
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building on the work in this branch — we ran into a few edge cases while reviewing and wanted to contribute tests and a simplified approach. Feel free to merge, cherry-pick what's useful, or close if you'd prefer to take a different direction.
What changed
Simplified free-only detection
getFreeOnlyCategoryDefaultModelandgetFallbackChainForFreeOnlyProvidersin favor of a singleappendFreeModelFallbacksthat preserves chain ordering and deduplicatesconnectedProvidersto its original conditional read (only on cold cache), matchingdevbranch behaviorFixed Zen subscriber downgrade
availableModels(checks if all models are free) rather thanconnectedProviders, which can't distinguish free-tier from paid Zen usersopencodeare no longer force-downgraded to free modelsTests lean on production code instead of hardcoding models
CATEGORY_MODEL_REQUIREMENTS.ultrabrain.fallbackChainandFREE_ONLY_FALLBACK_CHAINdirectly — no hardcoded model names that break when the model roster rotatesFREE_ONLY_FALLBACK_CHAINproviders stay in sync withFREE_ONLY_PROVIDER_IDSappendFreeModelFallbacksto guarantee original chain comes first, then free models in priority orderCold cache limitation noted
connectedProviders-based detection is still used on cold cache (no model list available). Left a TODO noting this is removable oncesubagent-resolverfalls back to a free model instead ofmatchedAgent.modelon cold cache.