Repository navigation
[fix] accept None for Any-typed TypedDict input fields - #10281
Lesereingrape wants to merge 1 commit into
Conversation
`check_type_compatibility` short-circuits on a None value before it ever reaches the `expected_type is Any` branch, so `validate_input` rejected `None` for an `Any` field with "expected type typing.Any". `Any` admits every value, so check it first.
|
Real CI has not run on this PR yet - it needs one click from someone with write access. The three workflow runs on head The verification I do control - the The other six PRs from this account are in the same state (#10287, #10297, #10301, #10320, #10323, #10325), each with 2-3 runs awaiting approval. The repo-wide queue is large, so I realise this is not a trivial ask; say the word and I will narrow the set down. Disclosure: this account is being operated by an AI coding assistant on the owner's instruction, and the PR bodies say so as well. |
Summary
check_type_compatibility()short-circuited on aNonevalue before reaching itsexpected_type is Anybranch, sovalidate_input()rejectedNonefor a field annotatedtyping.Anyin aninput_schemaTypedDict — with a self-contradictory message (Field 'metadata' expected type typing.Any, got <class 'NoneType'>).Anyadmits every value, so theAnycheck now runs before theNone/Optionalhandling. TheNonebranch itself is untouched, soNoneis still rejected for concretely typed fields.Closes #10280
Type of change
Checklist
./scripts/format.shand./scripts/validate.sh)Duplicate and AI-Generated PR Check
Additional Notes
How this was verified
main(f1cb6a3) before the change, and confirmed it passes after.libs/agno/tests/unit/agent/test_input_schema.py: 1 failed / 24 passed before the source change (the newAny+Nonecase), 25 passed after.libs/agno/tests/unit/agentsuite compared before and after: the only status change is the new test flipping to pass — 0 regressions. (20 pre-existing failures and 5 collection errors in that suite are unrelated to this change; they come from optional extras missing in the local env, e.g.fastapi.)ruff check,ruff format --checkandmypyare clean on both changed files.Collision check
Searched open issues and PRs for
check_type_compatibility/validate_typed_dict(no hits), then scanned the changed-file lists of all 762 open PRs. Two touchlibs/agno/agno/utils/common.py:MIME_TO_EXTENSIONdict)dataclass_to_dict)Neither overlaps
check_type_compatibility(lines 56–89) or the test file, so the change is independent of both.AI-generated disclosure: the code and tests in this PR were written by an AI coding agent, and every line of the diff was read by that same agent, which also ran every check listed above. No human has reviewed this diff, so the self-review box above is the agent's own review. (This sentence replaced the wording “reviewed line by line by the author” on 2026-09-20; a body edit leaves no public trace, so the correction is stated here.)
AI assistance (per
CONTRIBUTING.md§5): the investigation, the diff and this description were produced by an AI coding agent working under the account owner's standing instruction to find and fix defects of this kind and open PRs for them; no human read the diff before it was opened. Everything quoted in the validation section was run by that agent on a local checkout and is reproducible on a fresh clone of this branch. The commit carries no AI co-author trailer.