aaif-goose / aaif-goose/goose

No CLI command resumes a recipe session with both history and recipe context

Offen
#11,943 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @DOsinga Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
54.2k
Forks
6.2k
Ø Merge
3 T. 4 Std.
Gemergte PRs (30 T.)
240

Beschreibung

**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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cli
Bereich
ai-infra-agents, cli
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.