Skip to content

protected_patterns filters paths on read-only operations #322

Description

@joaotgouveia

Capability

FileSystem

Bug Description

list_directory, search_files and find_files use protected_patterns to filter out matching paths:

if not self._is_accessible(rel, write=True):

if not self._is_accessible(rel_str, write=True):

if not self._is_accessible(rel, write=True):

This seems unintended, given that these operations are all read-only and the documentation for protected_patterns states: "Matching paths are read-only -- reads succeed, writes are rejected."

If this behavior is indeed incorrect, I can open a patch addressing it.

Minimal Reproduction

from pydantic_ai_harness import FileSystem
import asyncio
print(
    asyncio.run(FileSystem(protected_patterns=["*"]).get_toolset().list_directory())
)
# prints '(empty directory)'

pydantic-ai-harness version

0.4.0

pydantic-ai version

2.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds:triageNeeds maintainer attention

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions