No CLI command resumes a recipe session with both history and recipe context
- Lenguaje dominante
- Rust
- Estrellas
- 54.2k
- Forks
- 6.2k
- Merge medio
- 3 d 4 h
- PR fusionados (30 d)
- 240
Descripción
**Describe the bug**
Resuming a recipe session via `goose session` does not restore what the recipe put into
the system prompt, so the resumed session is not the same session the recipe created.
Follow-up to #11892 — same root cause, narrowed down.
When a recipe starts a session, its `instructions` are added to the system prompt via
`extend_system_prompt("additional", ...)`. This is not persisted in the session metadata:
the `Session` record stores `recipe`, `extension_data`, `conversation`, `provider/model`,
but there is no field for the system prompt. On resume, `build_session` gets
`additional_system_prompt: None` (unless `--system` is passed manually) and the recipe
components are never re-applied, so the recipe instructions are lost.
Meanwhile the enabled tools/extensions list does survive resume (it is re-read from the
session's `extension_data` via `EnabledExtensionsState::for_session`).
**To Reproduce**
1. Create a recipe session:
`goose run --recipe some-recipe --interactive --name test-session`
2. Exit, then resume without re-passing the recipe:
`goose session --resume --name test-session`
3. The conversation history and enabled extensions are restored, but the recipe
instructions are missing from the system prompt.
**Expected behavior**
Resuming a recipe session should restore the full state the recipe configured, most
importantly the **system prompt** (recipe instructions) — not just the history and the
extension list. The recipe context should be in effect without re-running the recipe
prompt.
Acceptable outcomes:
- `goose session --resume` restores the recipe instructions into the system prompt
(e.g. from the recipe stored in the session metadata), or
- `goose run` gets a `--history` flag so `goose run --resume --recipe X --history`
shows the previous conversation alongside the recipe context.
**Environment**
- Goose version: 1.49.0
- OS: Linux
- Interface: CLI
Guía de contribución
Línea de trabajo
El problema está en la persistencia de sesiones y la lógica de reanudación. Consulta la estructura `Session` para ver qué campos se almacenan y la función `build_session` para ver cómo se reconstruye una sesión. Las instrucciones de la receta se añaden mediante `extend_system_prompt`, pero no se guardan. Comprueba cómo se utiliza `extension_data` en `EnabledExtensionsState::for_session`. La corrección probablemente implique añadir un campo para el system prompt a los metadatos de la sesión y asegurarse de que se restaure al reanudar. Ejecuta los pasos de reproducción para verificar el error y probar la corrección.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cli
- Área
- ai-infra-agents, cli
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Activo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 55/100