Repository navigation
feat(rlm): env-default model with 429 fallback list - #244
Merged
Merged
Conversation
Add a third model-routing tier to createLlmClient so an RLM loop can default to a free/cheap model (instead of the session's paid main model) and fail over to a list of fallbacks when a provider rate-limits (HTTP 429). New env vars: - REPL_RLM_DEFAULT_MODEL — model id/name resolved through the host registry - REPL_RLM_DEFAULT_PROVIDER — optional provider for that model - REPL_RLM_FALLBACK_MODELS — comma list of `provider/model-id` (or bare `model-id`), tried in order when the previous model returns a 429 Resolution order is now: injected model/provider → REPL_RLM_BASE_URL endpoint → env-default (+ fallbacks) → session main model. A non-429 error still rethrows immediately; an exhausted fallback list rethrows the last 429.
Add a one-shot `/rlm-setup` command so a fresh install can configure the rlm model routing without hand-editing a shell profile. - Defaults to the session model (ctx.model id + provider), no fallback. - Asks to opt in to a custom model/provider and to a 429 fallback chain (X fallback models -> the chain is the default + X). - Writes an idempotent managed block to the detected shell profile (~/.zshrc / ~/.bashrc / ~/.config/fish/config.fish / ~/.profile), using `export` (or fish `set -gx`), and applies the same values to the current process so rlm picks them up immediately. Pure helpers live in src/rlm_setup.ts (profile detection, block render, idempotent rewrite, env apply) with unit tests in test/rlm_setup.test.ts. Extends the registered-command pin (#198) to cover /rlm-setup.
AdarGit008
force-pushed
the
feat/rlm-default-free-fallback
branch
from
October 17, 2026 03:13
a77f1fe to
04e72c6
Compare
CI "coverage floors" was red: the new /rlm-setup handler pushed extensions/repl-extension.ts below its floor, and src/rlm_setup.ts had no floor. - Add 7 extension tests driving the /rlm-setup dialogs: session-model default, custom model/provider, fallback chain, cancel, no-session, and idempotent profile rewrite. - Remove the unreachable "no model resolved" guard the tests could not reach. - Baseline: add src/rlm_setup.ts floor (94.5) and raise src/rlm_client.ts to its now-covered 93.27.
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.
What
Adds a third model-routing tier to
createLlmClientso an RLM loop can default to a free/cheap model (instead of the session's paid main model) and fail over to a fallback list when a provider rate-limits (HTTP 429).New env vars
REPL_RLM_DEFAULT_MODELREPL_RLM_DEFAULT_PROVIDERREPL_RLM_FALLBACK_MODELSprovider/model-id(or baremodel-id), tried in order on a 429Resolution order
injected
model/provider→REPL_RLM_BASE_URLendpoint → env-default (+ fallbacks) → session main model.Tests
8 new cases in
test/rlm_client.test.ts(default routing, not-found, 429 fallback, non-429 no-fallback, exhausted-list rethrow, injected-wins, endpoint-wins, bare-id fallback). Full file: 24/24 pass;tsc --noEmit,npm run build, andnpm run lintall green.