feat(compaction): add modelFallbacks for compaction model resolution#1211
Open
BingqingLyu wants to merge 1 commit into
Open
feat(compaction): add modelFallbacks for compaction model resolution#1211BingqingLyu wants to merge 1 commit into
BingqingLyu wants to merge 1 commit into
Conversation
Adds modelFallbacks?: string[] to AgentCompactionConfig. When the
primary compaction model fails (resolution, auth, or runtime), each
fallback is tried in order before giving up.
Changes:
- types.agent-defaults.ts: add modelFallbacks?: string[]
- zod-schema.agent-defaults.ts: add modelFallbacks schema
- compact.ts:
- Model resolution fallback loop (primary model not in registry)
- Auth fallback loop with tryAuthForModel returning hasExchange
- Runtime fallback loop: on session.compact() throw, retry with full
re-resolve + re-auth + createAgentSession per fallback
- fbEffectiveModel now passes through applyLocalNoAuthHeaderOverride
and applyAuthHeaderOverride using fbKeyInfo/fbHasExchange (P1 fix)
- tryCompactWithModel disposes fbSession in finally block (P2 fix)
- All error messages surface tried models list
- Backward compatible when modelFallbacks is unset
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.
Closes openclaw#52011
Summary
When the primary compaction model override is unreachable (e.g. a local vLLM server is down), compaction currently fails immediately. This adds a modelFallbacks array to AgentCompactionConfig that allows specifying fallback models tried in order before giving up.
Changes
Config Example
{ "agents": { "defaults": { "compaction": { "model": "vllm/qwen3-coder-next", "modelFallbacks": ["anthropic/claude-haiku-4-5"] } } } }Testing