Files
crewAI/lib/crewai-tools/tests
Joao Moura 1c252e2d83 docs(tools): state what the declared-path pin means across a rebuild
Bugbot flagged that `model_post_init` re-derives `_declared_realpath` from
the serialized `file_path`, so a rebuild in a different working directory can
repoint the declared default. The mechanism is real. Traced it to exactly one
case of three:

  absolute file_path              -> survives a rebuild anywhere
  relative file_path + base_dir   -> survives; base_dir is anchored already
  relative file_path, no base_dir -> re-anchors to the rebuilding cwd

Keeping the re-anchor, deliberately. A bare relative path names nothing
absolute to preserve, and the alternative is pinning a directory that, for a
rebuild in a fresh container, no longer exists — reading a stale absolute path
would be the worse failure. It is also not a regression in any case: before
this branch a rebuilt reader lost the declared file outright and answered "No
file path provided".

Rewriting `file_path` to its resolved form at construction would close it,
but `tests/agents/test_agent.py:2311` pins that the authored string survives,
so that is a public-contract change rather than a fix. A serialized pin field
would too, at the cost of a schema change — noted on the thread for whoever
reviews, not taken unilaterally.

So: all three cases now have a test, and the class docstring says which is
which, so the behavior is a decision rather than something a reader has to
infer. 38 tests in the seam suite, 338 across the file tools and crewai's
tool suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNumDnNbiyw3pv1WakAe6t
2026-08-03 15:28:23 -07:00
..
2025-10-20 14:10:19 -07:00