Session migration can truncate history if rewrite is interrupted
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- node.js, typescript
Línea de trabajo
The issue is in packages/coding-agent/src/core/session-manager.ts around line 980. Look at the _rewriteFile() method and the openSync call with mode 'w'. Understand the session migration flow in SessionManager._setSessionFile(). Research Node.js atomic write patterns, like the linked write-file-atomic library. A fix involves writing to a temporary file first, then renaming it over the original on success. Test by creating a v1/v2 session file and simulating an interruption during migration.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happened?
Opening a v1/v2 session migrates it and rewrites the same JSONL file. _rewriteFile() opens the original with "w", truncating it before writing entries back. If the process or write fails during migration, previously saved history can be left truncated. This is the path in SessionManager._setSessionFile() on current main.
Steps to reproduce
- Open an existing v1/v2 session with enough entries to make migration observable.
- Interrupt the process after
_rewriteFile()opens the original file and before it finishes writing. - Reopen the session: the original file contains only the prefix written before interruption.
This follows directly from openSync(this.sessionFile, "w") in session-manager.ts. I have not observed a production incident.
Expected behavior
Build the complete migrated file in a unique sibling temporary file, flush and close it, then rename it over the original. Keep the original on any error. Node's atomic-write implementation uses this pattern.
Version
main @ cb5fc1456d49d49c62e072bfed2926220083214e
AI-assisted report; source path checked against the stated commit.
- Lenguaje dominante
- TypeScript
- Estrellas
- 54
- Forks
- 20
- Merge medio
- 4 h 1 min
- PR fusionados (30 d)
- 12
Preparar el entorno
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 stepfun-ai/Step-Code
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#190 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#186 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#185 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#184 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#179 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de stepfun-ai/Step-Code
Issues similares
-
Add: Digi World (Romania) SDAbiertocheck:passed streams:add
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 88/100
Fission-AI/OpenSpec#1986 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nestjs/docs.nestjs.com#3554 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
publicodes/publicodes#868 ·
-
namespace operations
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
EclipseFdn/open-vsx.org#13488 ·
Los mantenedores suelen responder en 2 días