Python: [Bug]: InMemoryAgentFileStore permits a path to be both a file and a directory
维护者通常 1 天内回复
@westey-m 已经在做这个了。
开始于 2026年9月21日。
评估
这个 Issue 还没有评估数据。
描述
Description
InMemoryAgentFileStore permits both Reports and Reports/q1.txt to exist. Consequently, list_children("") returns two entries named Reports, one reported as a file and one as a directory. A caller cannot tell which path to use, and this state cannot occur in FileSystemAgentFileStore.
This happens in either write order. write() checks only whether the exact file key exists; it does not reject a file ancestor or an existing descendant. Its case-insensitive key normalization means Reports and reports/q1.txt conflict as well.
Expected: Reject the second write without changing the existing content. A file path cannot also serve as a directory, regardless of casing.
Actual: Both writes succeed and the root listing contains a same-named file and directory.
Code Sample
import asyncio
from agent_framework import InMemoryAgentFileStore
async def main() -> None:
store = InMemoryAgentFileStore()
await store.write("Reports", "file")
await store.write("Reports/q1.txt", "nested")
print([(entry.name, entry.type) for entry in await store.list_children()])
# [('Reports', 'directory'), ('Reports', 'file')]
asyncio.run(main())
The new regression test fails against the unmodified package (Failed: DID NOT RAISE NotADirectoryError) and passes against the local fix.
Error Messages / Stack Traces
None. The inconsistent state is accepted silently.
Package Versions
Source checkout at 999dda7970fe969c0901d524365ce34ecbda6227 (agent-framework-core version 1.18.0); the relevant write() implementation was also checked against the repository's current default branch on 2026-09-21. The public API reproduction and regression tests used this source checkout through an existing virtual environment, not a separately installed release package.
Python Version
Python 3.12.0 for the isolated source execution.
Additional Context
FileSystemAgentFileStore uses real filesystem paths, where a file cannot be the parent of another file and a nonempty directory cannot be replaced by a file. The in-memory store is used for tests and lightweight use, so matching this basic path invariant avoids testing a state the disk store cannot represent.
Local draft fix: reject a write if any ancestor is already a file or if the target path already has descendants. A focused regression test covers both write orders and verifies the existing content remains intact. The new test fails on the baseline and passes with the fix. The full test_harness_file_access.py file passes with the fix: 73 passed, 6 skipped. Ruff check, Ruff format check, py_compile, and git diff --check also pass. The reused virtual environment lacks pytest-timeout, causing an unrelated pytest configuration warning.
Searches of repository issues and PRs for InMemoryAgentFileStore conflict, file and directory same name, and file store path collision found no matching report or implementation on 2026-09-21.
- 主要语言
- Python
- 星标
- 14.2k
- 派生
- 2.5k
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 384
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/agent-framework 的其他 Issue
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeout可能已有人在做 @jpalvarezl 于 6 天前认领。 未关闭python
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/agent-framework#9313 · 已指派 1 人 ·
维护者通常 1 天内回复
-
.NET python triage
难度 1/5 1 小时以内 新手友好度 85/100
microsoft/agent-framework#9092 · 1 条评论 ·
维护者通常 1 天内回复
-
Python: raw-data content mappings lose annotations and attachment metadata可能已有人在做 @moonbox3 于 20 天前认领。 未关闭python triage
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/agent-framework#8632 · 2 条评论 ·
维护者通常 1 天内回复
-
Python: Clarify when to use platform可能已有人在做 @eavanvalkenburg 于 19 天前认领。 未关闭python triage
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/agent-framework#8599 · 1 条评论 ·
维护者通常 1 天内回复
-
.NET compaction documentation
难度 1/5 1 小时以内 新手友好度 82/100
microsoft/agent-framework#4629 · 1 条评论 ·
维护者通常 1 天内回复
查看 microsoft/agent-framework 的全部 Issue
相似的 Issue
-
good first issue tools
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug deferred domain:ci P1
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
docling-project/docling-mcp#147 ·
-
issue: A pipe model's Valves button ignores the Allow Chat Valves permission可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug confirmed issue
难度 2/5 1-3 小时 新手友好度 72/100
open-webui/open-webui#32771 · 1 条评论 ·
维护者通常 1 天内回复
-
Scheduled Security Scan is failing on main可能已有人在做 @pkupt 今天认领。 未关闭security-scan-failure
难度 1/5 1-3 小时 新手友好度 74/100
semantica-agi/semantica#2045 ·
维护者通常 2 天内回复