claw-code/rust/crates/tools
TheArchitectit d8716efb8e fix(team): sub-agents honor resolved model + fall through on model-not-found
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>
2026-06-17 12:32:00 -05:00
..
src fix(team): sub-agents honor resolved model + fall through on model-not-found 2026-06-17 12:32:00 -05:00
tests Keep G002 path-scope tests aligned with enforced denials 2026-05-14 17:33:47 +09:00
.gitignore fix: auto compaction threshold default 200k tokens 2026-04-01 03:55:00 +00:00
Cargo.toml feat(tools): add LoggingAspect to unified tool dispatch entry point 2026-05-25 11:22:45 +09:00
GIT_TOOLS_README.md feat: git-aware context tools 2026-05-25 11:24:37 +09:00
MULTI_TOOL_README.md feat: SubAgent tool for fast sub-agent delegation 2026-06-10 16:49:33 -05:00