Files
crewAI/lib/crewai-tools/tests
Joao Moura 953e1b94ab fix(tools): make construction-time store failures non-fatal where they can be
Copilot flagged that `model_post_init` calls `store.normalize` / `store.display`
unguarded, so a store raising there stops a serialized crew from loading —
against this PR's own claim that a broken integration degrades rather than
taking file I/O down.

It suggested falling back to the local store. Not doing that: silently
redirecting a crew configured for durable storage onto a disk that will be
discarded trades a loud failure for quiet data loss, which is the exact bug
this PR exists to fix.

Three changes instead.

The protocol now *states* the invariant it only implied. `normalize` and
`display` must be pure string computation — no I/O, no raising — because the
tools call them while a tool is being constructed. Both real stores already
comply (`CdoFileStore` does `posixpath` arithmetic and never touches its
client); this makes it a contract a new store is held to rather than a
coincidence.

The reader's declared-file derivation is now guarded, because a crew that
cannot load over a *convenience default filename* is indefensible. It comes
back without a default file and logs; any real problem resurfaces on the
first read, where `_run` already reports it.

`base_dir` anchoring stays unguarded, deliberately, and now says why:
it is a containment guarantee, not a convenience. Leaving the root relative
because a store hiccuped would let a later chdir move the sandbox — handing
back a weaker sandbox than the caller asked for, silently. That failure
should surface.

104 tests across the file tools. Two new, one per half of the asymmetry.

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