Files
crewAI/lib
Joao Moura 73d16ac6ba fix(tools): reset the description when the declared-file pin is lost
Bugbot caught a hole in the previous commit's own fix. Guarding the declared
-file derivation clears `_declared_realpath` and `_declared_label`, but
`description` is a serialized *field* — on a `model_validate` rebuild it
arrives already saying "The default file is notes.txt, which is read when
'file_path' is omitted".

So a rebuilt reader that lost its pin still advertised a default it could not
read. The LLM would take the tool at its word, call it with no arguments, and
get "No file path provided" — the tool lying about its own contract, which is
worse than the missing default it was meant to degrade to.

The failure path now restores the class-default description alongside clearing
the pin, so what the tool says and what it does stay matched.

105 tests across the file tools; the new one asserts a real dumped description
advertises the default, and that after a rebuild losing the pin it does not,
matches the class default, and reports "No file path provided" on a bare call.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNumDnNbiyw3pv1WakAe6t
2026-08-03 19:01:37 -07:00
..