{"id":"o6yws-5i","creatorId":"anonymous","title":"#7171 ToolOutput retry duplicates full input per error (repro)","createdAt":1785923468543,"updatedAt":1785923468543,"latestVersionNum":1,"versions":[{"versionNum":1,"version":null,"branchName":null,"branchSha":null,"runRelease":true,"runBranch":false,"sdkDeps":{"pip":["pydantic","pydantic-ai"]},"snippets":[{"id":"toolbound","name":"Tool-bound path (ToolOutput): MARKER appears N_errors times","code":"import pydantic, pydantic_core\nfrom pydantic import ValidationError, create_model\nfrom pydantic_ai.messages import RetryPromptPart\nprint(f\"pydantic_core {pydantic_core.__version__}  pydantic {pydantic.VERSION}\")\nN_FIELDS, N_MISSING = 40, 20\nMARKER = \"UNIQUE_MARKER_VALUE_XYZ_unique_unique_unique_unique_unique_unique\"\nBig = create_model(\"Big\", **{f\"field_{i}\": (str, ...) for i in range(N_FIELDS)})\npresent = {f\"field_{i}\": (MARKER if i == 0 else f\"v{i}\") for i in range(N_FIELDS - N_MISSING)}\nprint(\"invalid_args chars:\", len(pydantic.TypeAdapter(dict).dump_json(present).decode()))\ntry:\n    Big.model_validate(present)\nexcept ValidationError as e:\n    errs = e.errors(include_url=False, include_context=False)\nprint(\"errors:\", len(errs), \"| each input is full dict with field_0==MARKER:\", errs[0]['input'].get('field_0') == MARKER)\n# ToolOutput path: tool_name set -> exclude = {'__all__': {'ctx'}}, keeps input on EVERY error\nresp = RetryPromptPart(content=errs, tool_name=\"final_result\").model_response()\nprint(\"tool-bound retry len:\", len(resp), \"| MARKER count:\", resp.count(MARKER))","primaryOutput":null,"comparisonOutput":null},{"id":"native","name":"NativeOutput path (tool_name=None): input dropped, no duplication","code":"import pydantic, pydantic_core\nfrom pydantic import ValidationError, create_model\nfrom pydantic_ai.messages import RetryPromptPart\nN_FIELDS, N_MISSING = 40, 20\nMARKER = \"UNIQUE_MARKER_VALUE_XYZ_unique_unique_unique_unique_unique_unique\"\nBig = create_model(\"Big\", **{f\"field_{i}\": (str, ...) for i in range(N_FIELDS)})\npresent = {f\"field_{i}\": (MARKER if i == 0 else f\"v{i}\") for i in range(N_FIELDS - N_MISSING)}\ntry:\n    Big.model_validate(present)\nexcept ValidationError as e:\n    errs = e.errors(include_url=False, include_context=False)\n# NativeOutput path: tool_name=None -> drops {'ctx','input'} for top-level errors\nresp = RetryPromptPart(content=errs, tool_name=None).model_response()\nprint(\"native retry len:\", len(resp), \"| MARKER count:\", resp.count(MARKER), \"(no multiplicative growth)\")","primaryOutput":null,"comparisonOutput":null}],"createdAt":1785923468543}]}