mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
Round-1 review defect: the TOOL branch added for ESQ1-296/ESQ1-289 assumed output_schema was always a dict once truthy. A non-dict output_schema (or a non-dict `properties` inside it) raised AttributeError instead of failing open. That crash is new -- the old branch never read output_schema at all -- and it happens outside the _run_stage try/except and outside the controller's narrow exception allowlist, so it would take down the SSE generator mid-stream for both cmd+K and the Builder. Reachable via refine mode: _hydrate_tool_nodes only stamps a schema when it finds a matching catalogue entry, so a hand-edited or legacy graph can carry forward an output_schema of any shape. Fix: shape-check before every .get() -- output_schema must be a dict and its properties must be a dict, or the branch returns True. SHARED WITH CMD+K: fails open whenever the schema is absent, empty, or an unreadable shape, so a tool we cannot describe behaves exactly as before. Only provably-wrong references, from a schema we can actually read, are rejected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>