Workspace removal deletes a sub-agent's spend when the usage roll-up fails

Abierto
#7,883 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
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend

Línea de trabajo

Start in the workspace removal path of src/node/services/workspaceService.ts, where rollUpUsageIntoParent and rollUpTimingIntoParent are called before the child's session folder under ~/.xum/sessions is deleted. Trace how getSessionUsage errors are caught and logged, then make a roll-up throw in a test to reproduce the lost session-usage.json. Done when a failed roll-up no longer deletes the only copy of the child's spend, either by retrying once or by keeping the usage file, and a test covers that path. Pick an option with a maintainer first, since the issue lists two.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

When workspace removal cannot roll a sub-agent's usage into its parent, Xum still deletes the sub-agent's session folder. The parent then loses that sub-agent's spend for good.

Where

WorkspaceService removal path (src/node/services/workspaceService.ts, the rollUpUsageIntoParent call). A failure in getSessionUsage or rollUpUsageIntoParent (for example a one-time EIO) is caught and logged with log.error("Failed to roll up child session usage into parent"). Removal then continues and deletes ~/.xum/sessions/<child>/, which holds the only copy of session-usage.json.

The timing roll-up just above it (rollUpTimingIntoParent) has the same shape.

Expected

A failed roll-up does not destroy the only copy of the child's spend. Options:

  1. Retry the roll-up once before deleting the folder.
  2. Keep the child's usage file (or move it under the parent) when the roll-up fails, so a later read can fold it in.

Context

Found during #7862 follow-up work (a prep owner on #7868 reported it). It does not fail a user action, so it was out of scope there. The behavior exists on main today (96a0916ecc).


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Lenguaje dominante
TypeScript
Estrellas
2.1k
Forks
139
Merge medio
4 h 38 min
PR fusionados (30 d)
926

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

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 coder/xum

Todos los issues de coder/xum

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.