Python: FileSessionStore.set fails on Windows for long session IDs because its temp file name is 38 characters longer than the snapshot
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Đọc FileSessionStore.set() và _session_file_path() trong kho lưu trữ phiên Python, sau đó kiểm tra tests/core/test_sessions.py, đặc biệt là TestFileSessionStore::test_opaque_session_id_round_trips_through_safe_filename. Tái hiện lỗi đường dẫn dài trên Windows được mô tả trong issue và so sánh cách đặt tên tệp tạm được dùng bởi FileCheckpointStorage và _filesystem._atomic_write_text. Hoàn tất khi một bài kiểm thử hồi quy xác nhận tên tệp tạm không phụ thuộc vào ID phiên và phiên được lưu khi đường dẫn dài bị tắt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
FileSessionStore.set() writes each snapshot through a sibling temp file named .<snapshot name>.<uuid hex>.tmp, which is 38 characters longer than the snapshot file. On Windows with long paths disabled (the default, LongPathsEnabled = 0), a session ID at MAX_SESSION_ID_LENGTH (128) whose snapshot path fits under the 260-character limit can still fail to save, because the temp path does not fit.
This shows up as a failing unit test on my Windows 11 machine: tests/core/test_sessions.py::TestFileSessionStore::test_opaque_session_id_round_trips_through_safe_filename[xxx...x-False] fails with FileNotFoundError on the .tmp path. CI on windows-latest passes, I believe because GitHub's Windows runners enable long paths.
Minimal repro (Windows, long paths off, agent-framework-core at 67ba500):
import asyncio, tempfile
from pathlib import Path
from agent_framework import AgentSession, FileSessionStore
async def main():
base = Path(tempfile.mkdtemp())
sid = "x" * FileSessionStore.MAX_SESSION_ID_LENGTH
storage = base / ("d" * (240 - (len(str(base)) + 1 + len(sid) + 5) - 1))
store = FileSessionStore(storage)
print(len(str(store._session_file_path(sid)))) # 240: the snapshot path itself fits
await store.set(sid, AgentSession(session_id="s")) # FileNotFoundError on the .tmp path
asyncio.run(main())
Expected: the session saves, since its snapshot path is under the limit. Actual: FileNotFoundError: [Errno 2] No such file or directory: '...\.xxx...x.json.<uuid>.tmp'.
Environment: Windows 11, Python 3.11.9, agent-framework-core 1.23.0 from main.
Proposed fix: name the temp file .maf-session-<uuid hex>.tmp, independent of the session ID, the way FileCheckpointStorage (.maf-ckpt-<uuid>.tmp) and _filesystem._atomic_write_text (.maf-state-<uuid>.tmp) already do, plus a regression test that checks the temp name does not grow with the ID. I have this ready and would like to open the PR if the direction is fine.
AI assistance: an AI coding assistant helped find the cause and draft this issue; the failing test and the repro above were run on my Windows 11 machine.
- Ngôn ngữ chính
- Python
- Star
- 14.3k
- Fork
- 2.5k
- Merge trung bình
- 2 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 337
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/agent-framework
-
Python: foundry-hosting drops request `metadata` from the stored response — `_create_response_event_stream` never passes `request` to `ResponseEventStream`Có thể làm lại được @its-amann đã nhận 7 ngày trước và không có pull request nào đang mở. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/agent-framework#9529 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeoutCó thể đã có người làm @jpalvarezl đã nhận 13 ngày trước. Đang mởpython
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/agent-framework#9313 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET: Proposal: add an llms.txtĐang mở.NET python triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
microsoft/agent-framework#9092 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: raw-data content mappings lose annotations and attachment metadataCó thể đã có người làm @moonbox3 đã nhận 27 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/agent-framework#8632 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: Clarify when to use platformCó thể đã có người làm @eavanvalkenburg đã nhận 26 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/agent-framework#8599 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/agent-framework
Issue tương tự
-
Web transport: small test gapsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
scikit-learn-contrib/category_encoders#553 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tests/strategies_test.py:174 goes uncovered on about 1 run in 100, failing the coverage ratchetĐang mởflaky-watch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
btclib-org/btclib#2839 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BarrelList constructor drops false-valued iterable contentsCó thể đã có người làm @Gambit-Checkmate đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 19 ngày
-
[Performance]: Redundant object-storage pull when model and tokenizer share the same RunAI URIĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
vllm-project/vllm#63863 ·
Maintainer thường phản hồi trong vòng 1 ngày