No CLI command resumes a recipe session with both history and recipe context
- Lingua principale
- Rust
- Stelle
- 54.2k
- Fork
- 6.2k
- Merge medio
- 3g 2h
- PR unite (30g)
- 262
Descrizione
**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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
The issue is in session persistence and resume logic. Look at the `Session` struct to see what fields are stored, and the `build_session` function to see how a session is reconstructed. The recipe instructions are added via `extend_system_prompt` but not saved. Check how `extension_data` is used in `EnabledExtensionsState::for_session`. The fix likely involves adding a field for the system prompt to the session metadata and ensuring it's restored on resume. Run the reproduction steps to verify the bug and test the fix.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cli, rust
- Ambito
- ai-infra-agents, cli
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 55/100