Team agents failed with 'Model not found' 404s because of two precedence bugs in the sub-agent provider chain: 1. providerFallbacks.primary silently overrode the agent's resolved model. new_with_fallback_config took fallback_config.primary() as THE primary, ignoring the model the caller (Agent tool / subagentModel) actually picked. So every spawned agent used the configured (dead) primary instead of its own model. Fix: the caller's model is the primary; providerFallbacks (primary + fallbacks) are recovery entries appended after it, deduped. 2. A 404 'model not found' is not retryable, so the chain died on the first (dead) model instead of advancing to the next configured fallback. Fix: add fallback_chain_eligible() that also treats 404/400 with a 'not found' / 'model ... unavailable' body as chain-eligible, so a dead primary advances to kimi/qwen/etc. Added status_code()/response_body() accessors to ApiError for the detection. 3. resolve_agent_model defaulted to hard-coded claude-opus-4-6 even when the session was connected to a custom endpoint (e.g. custom/openclaw). Fix: fall back to the config's top-level `model` before DEFAULT_AGENT_MODEL, so sub-agents inherit the session's actual provider by default. Verified with fallback_chain_tests (404 model-not-found eligible; 401 auth not eligible; 429 still eligible). 3 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.toml | ||
| GIT_TOOLS_README.md | ||
| MULTI_TOOL_README.md | ||