Commit 1c6b2f9
committed
feat(compaction): add modelFallbacks with runtime retry and auth fixes
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 unset1 parent f309656 commit 1c6b2f9
3 files changed
Lines changed: 871 additions & 555 deletions
File tree
- src
- agents/pi-embedded-runner
- config
0 commit comments