aaif-goose / aaif-goose/goose

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

Đang mở
#11,943 0 bình luận 0 reaction 1 người được giao Được @DOsinga nhận Xem trên GitHub
Ngôn ngữ chính
Rust
Star
54.2k
Fork
6.2k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
240

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cli
Lĩnh vực
ai-infra-agents, cli
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.