mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-31 02:28:09 +08:00
ChatGXY's router was hard-failing with 'Exceeded maximum output retries (1)': its pydantic-ai Agent used the default retry budget of 1, and the router's process() only caught (OSError, ValueError), so an UnexpectedModelBehavior sailed past the graceful _handle_fallback and surfaced to the user as a generic 500. This adds a per-agent 'retries' knob to inference_services, resolved through the same _get_agent_config chain as temperature/max_tokens and wired into every agent's Agent(retries=...). The default goes from pydantic-ai's 1 to 3 so a transient bout of non-conforming model output recovers instead of failing the run. custom_tool's producer keeps its retries=0 reflection-loop default but can now be overridden. The router also catches UnexpectedModelBehavior so a genuinely exhausted budget degrades to the existing fallback message instead of a 500. Adds unit tests for the resolution chain, the config->Agent wiring, and the router's graceful fallback (forced via an empty ModelResponse).