Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Session migration can truncate history if rewrite is interrupted

Abierto
#145 1 comentario 0 reacciones 0 asignados Ver en GitHub

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
Área
backend, cli, tooling

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

untriaged
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
  1. Open an existing v1/v2 session with enough entries to make migration observable.
  2. Interrupt the process after _rewriteFile() opens the original file and before it finishes writing.
  3. 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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stepfun-ai/Step-Code

Todos los issues de stepfun-ai/Step-Code

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.