write_file overwrites changes made after the agent read the file
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
Línea de trabajo
Start by reading src/main/tools/files.ts:204-213 and types.ts:392 to understand how requireRead records reads, then inspect session.ts:409 for saved-session migration. Trace how write_file checks the read state and compare the current file with the recorded value. Done means stale reads are rejected with the specified message and existing saved readFiles: string[] sessions are migrated safely.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Found in the 2026-10-07 code review and confirmed with a probe (the file ended as agent, not user edit).
Problem
The read-before-write rule (src/main/tools/files.ts:204-213, requireRead) records only that a path was read (readFiles: Set<string>, types.ts:392), not what was read. edit_file and apply_patch are safer, because their context or old_string must still match. write_file replaces the file outright.
Scenario
The agent reads config.ts. The user edits it in their editor while the agent keeps working. The agent then calls write_file with content built from the old read, and in Auto mode the user's edit is silently lost.
Fix
Make readFiles a Map<string, string> (path → sha256 of the bytes read). In write_file, refuse when the current hash differs: "${path} changed since you read it. Read it again first.". This needs a migration for saved readFiles: string[] (session.ts:409).
- Lenguaje dominante
- TypeScript
- Estrellas
- 2
- Forks
- 2
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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.
Issues similares
-
desktop v3 windows
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
esengine/DeepSeek-Reasonix#15016 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
FR: Support CJK brackets, symbols and full-width markers in footnoteHeuristics (EBPAJ support)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
readest/readest#7413 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue priority: medium size: XS
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
content triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
eliasstravik/herdr-projects#788 ·