Python: FileSessionStore.set fails on Windows for long session IDs because its temp file name is 38 characters longer than the snapshot
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Lee FileSessionStore.set() y _session_file_path() en el almacén de sesiones de Python y, después, revisa tests/core/test_sessions.py, especialmente TestFileSessionStore::test_opaque_session_id_round_trips_through_safe_filename. Reproduce el fallo con rutas largas de Windows descrito en el issue y compara cómo se nombra el archivo temporal en FileCheckpointStorage y _filesystem._atomic_write_text. El trabajo estará terminado cuando una prueba de regresión confirme que el nombre temporal es independiente del ID de sesión y que la sesión se guarda con las rutas largas desactivadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 14.3k
- Forks
- 2.5k
- Merge medio
- 2 d 15 h
- PR fusionados (30 d)
- 370
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/agent-framework
-
needs-maintainer-triage python triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microsoft/agent-framework#9742 ·
Los mantenedores suelen responder en 1 día
-
.NET triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
microsoft/agent-framework#9704 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Python: foundry-hosting drops request `metadata` from the stored response — `_create_response_event_stream` never passes `request` to `ResponseEventStream`Posiblemente ocupada @its-amann la tomó hace 1 día. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#9529 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
.NET: Proposal: add an llms.txtAbierto.NET python triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
microsoft/agent-framework#9092 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: raw-data content mappings lose annotations and attachment metadataPosiblemente ocupada @moonbox3 la tomó hace 28 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#8632 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/agent-framework
Issues similares
-
component:benchmark
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
agentic-os-org/ANOLISA#9177 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
distrochooser/distrochooser#520 ·
Los mantenedores suelen responder en 2 días
-
Status: Needs confirmation Status: Needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startupPosiblemente ocupada @AlessandroSpallina la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
headroomlabs-ai/headroom#4513 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
codespell-project/codespell#4060 ·
Los mantenedores suelen responder en 1 día