Skip to content

Python: [Bug]: InMemoryAgentFileStore truncates Unicode display paths after lowercasing #8623

Closed

Description

@Shy7777

Description

InMemoryAgentFileStore.list_children() and search() return incorrect display paths when a directory contains a Unicode character whose lowercase representation has a different length. For example, İ (U+0130) lowercases to i followed by a combining dot.

After writing İstanbul/notes.md, the root listing reports a directory named İstanbul/, and listing or searching that directory returns otes.md. Reading the returned search path then returns None, even though the original file is present.

Expected: root listing returns İstanbul; child listing and search return notes.md, which can be read using the returned name. The existing case-insensitive lookup behavior should remain unchanged.

Actual: the methods use character offsets from lowercased lookup keys to slice the original display paths. Those offsets no longer refer to the same positions after length-changing Unicode lowercasing.

Code Sample

import asyncio

from agent_framework import InMemoryAgentFileStore


async def main() -> None:
    store = InMemoryAgentFileStore()
    directory = "\u0130stanbul"
    await store.write(f"{directory}/notes.md", "memory")

    print([(entry.name, entry.type) for entry in await store.list_children()])
    print([(entry.name, entry.type) for entry in await store.list_children(directory)])
    for result in await store.search(directory, "memory"):
        print(result.file_name, await store.read(f"{directory}/{result.file_name}"))


asyncio.run(main())

Observed output:

[('İstanbul/', 'directory')]
[('otes.md', 'file')]
otes.md None

Error Messages / Stack Traces

No exception is raised. The returned file names are incorrect and cannot be used to retrieve the stored content.

Package Versions

agent-framework-core 1.19.0, installed from the source checkout at a8acb4e0e9d7e4712b01b9c888cf943a2dfbee91 on 2026-09-22.

Python Version

Python 3.12.14, macOS 15.5, arm64.

Additional Context

I would like to fix the relative display-path extraction in the existing list_children() and search() methods by using path components rather than lowercased character offsets, with regression coverage for root and nested listings, case-variant lookups, and reading search results back. This does not change path normalization, key comparison rules, or the public API.

I searched existing issues and pull requests for InMemoryAgentFileStore Unicode, file store casing, and Unicode path and did not find a matching report. #8567 concerns file/directory write collisions; this report concerns display-path extraction for otherwise valid stored files.

Activity

  1. added
    python
    triage
    on Sep 22, 2026
  2. added
    reproduced
    on Sep 22, 2026
  3. github-actions commented on Sep 22, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    The bug occurs in python/packages/core/agent_framework/_harness/_file_access.py::InMemoryAgentFileStore.list_children around lines 1113-1135 and search around lines 1165-1184. It triggers when a directory contains a character such as U+0130 whose lowercase representation changes length, because a lowercased prefix offset slices the original display path. Minimal repro: write İstanbul/notes.md, list or search İstanbul, and verify the returned otes.md cannot be read back.

    • Failing test: python/packages/core/tests/core/test_harness_file_memory.py
    • Files examined: python/packages/core/agent_framework/_harness/_file_access.py, python/packages/core/agent_framework/_harness/_file_memory.py, python/packages/core/tests/core/test_harness_file_memory.py, python/packages/core/pyproject.toml
    • Tests run: python/packages/core/tests/core/test_harness_file_memory.py (35 passed baseline), python/packages/core/tests/core/test_harness_file_memory.py::test_in_memory_store_preserves_unicode_display_paths (failed)
    • Reported version: 1.19.0
    • Current version: 1.19.0
  4. added
    harness
    and removed
    triage
    on Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

harnesspythonreproduced

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions