FileArtifactService changes CRLF and CR line endings in text artifacts
Los mantenedores suelen responder en 4 días
@sanketpatil06 ya está trabajando en esto.
Desde el 2/11/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 85/100
Línea de trabajo
Empieza con google/adk/artifacts/file_artifact_service.py y sigue cómo se guarda y carga el texto; el script de reproducción del issue muestra los casos de saltos de línea que hay que comprobar. Ejecuta ese script y verifica después que los artefactos respaldados por archivos devuelvan el texto guardado sin cambios, incluidos los finales de línea CRLF y CR aislado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔴 Required Information
Describe the Bug:
FileArtifactService changes the line endings of text artifacts. A text artifact containing \r\n or a lone \r loads back with \n in their place. The payload is read with Path.read_text, whose universal newline mode rewrites both. It is written with Path.write_text, which translates \n to os.linesep, so on Windows every \n is stored as \r\n.
InMemoryArtifactService and GcsArtifactService return the saved text unchanged, so the same artifact differs only on the file backend. That backend is what adk web and adk run use by default (use_local_storage=True, via create_local_artifact_service). CSV files (RFC 4180 uses CRLF), patches, and Windows-authored text a tool saves therefore load back different from what was saved.
Steps to Reproduce:
pip install google-adk(reproduced onmainat 8cd3b12c8)- Run:
import asyncio, tempfile
from google.genai import types
from google.adk.artifacts.file_artifact_service import FileArtifactService
from google.adk.artifacts.in_memory_artifact_service import InMemoryArtifactService
async def main():
text = "id,name\r\n1,a\r\n2,b\rc\n"
for svc in (FileArtifactService(root_dir=tempfile.mkdtemp()), InMemoryArtifactService()):
await svc.save_artifact(app_name="a", user_id="u", session_id="s",
filename="t.csv", artifact=types.Part(text=text))
got = await svc.load_artifact(app_name="a", user_id="u", session_id="s",
filename="t.csv")
print(type(svc).__name__, repr(got.text), got.text == text)
asyncio.run(main())
Expected Behavior:
Both services return the saved text unchanged.
Observed Behavior:
FileArtifactService 'id,name\n1,a\n2,b\nc\n' False
InMemoryArtifactService 'id,name\r\n1,a\r\n2,b\rc\n' True
Environment Details:
- ADK Library Version (pip show google-adk): 2.13.0 (main at 8cd3b12c8)
- Desktop OS: macOS (the read-side rewrite is platform independent; the write-side translation affects Windows)
- Python Version (python -V): 3.11
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A (artifact service only)
🟡 Optional Information
Regression:
Not that I know of. The file backend has read and written text payloads with read_text / write_text.
Additional Context:
I would like to contribute a focused fix for this. Would writing artifact.text.encode("utf-8") with write_bytes and decoding read_bytes() on load be an acceptable approach? This keeps the stored payload exactly equal to the saved text. The error handling stays the same (OSError / UnicodeDecodeError are still caught and logged). Metadata JSON reads and writes are unaffected, since JSON escapes CR/LF inside strings.
How often has this issue occurred?:
- Always (100%)
- Lenguaje dominante
- Python
- Estrellas
- 22.1k
- Forks
- 4.3k
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- 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 google/adk-python
-
[LiteLLM] role='tool_responses' for Gemma 4 breaks tool calling on Vertex AI Model Garden MaaS (400 INVALID_ARGUMENT)Posiblemente ocupada @surajksharma07 la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
google/adk-python#7977 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
ContainerCodeExecutor drops output files that are hard linksPosiblemente ocupada @llalitkumarrr la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
google/adk-python#7906 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
GCS skill loaders ignore a skill.md manifest that the local and zip loaders acceptPosiblemente ocupada @surajksharma07 la tomó hace 6 días. Abiertotools
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
google/adk-python#7842 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
RestApiTool crashes on a request body media type that has no schemaPosiblemente ocupada @llalitkumarrr la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/adk-python#7838 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
LiteLlm with SSE streaming records the answer twice in gen_ai.output.messagesPosiblemente ocupada @surajksharma07 la tomó hace 14 días. Abiertomodels
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/adk-python#7630 · 11 comentarios · 1 asignado ·
Los mantenedores suelen responder en 4 días
Todos los issues de google/adk-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FinanceFlash/unvibecode#509 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
FAIRmat-NFDI/nomad-distro-dev#161 ·
-
bug v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
modelcontextprotocol/python-sdk#3821 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug severity:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
-
Log-odds calibration uses upper middle score instead of median for even candidate setsPosiblemente ocupada @flysheep-ai la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día