mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-07 19:20:34 +00:00
* fix(agents): ignore malformed entries in a serialized MCP routing index `McpRoutingMiddleware._normalize_index` documents that it accepts "arbitrary serialized routing data, not only the output of the builder", but two shapes escaped the coercion and raised instead: - an entry that is not a mapping (`str`, `list`, `None`, a number) reached `.get` and raised `AttributeError`; - a non-finite `priority` raised `OverflowError` from `int()` — JSON accepts `Infinity`/`-Infinity` literals, so a hand-edited or foreign index can carry one. The middleware is constructed per run, so either shape fails every model call in that process instead of the entry being ignored the way an entry with no keywords already is. Both now degrade to "not indexable": a non-mapping entry is skipped, and a priority that cannot be a finite int falls back to 0 (the existing value for `None`/non-numeric priorities). Valid entries are unchanged. Tests cover each rejected shape, the control shapes that already degraded, and the builder-shaped output that must stay identical. Dropping only the mapping guard fails the non-mapping cases; dropping only `OverflowError` fails the non-finite cases. * fix(mcp): handle infinite routing priorities in the builder --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>