aaif-goose / aaif-goose/goose

Recipe-backed sessions should remain loadable when recipe metadata is incomplete or invalid

Đang mở
#10,113 3 bình luận 2 reaction 1 người được giao Được @lifeizhou-ap 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 2 giờ
Pull request đã merge (30 ngày)
262

Mô tả

## Summary

A session with an attached recipe can fail to load in ACP if the stored recipe is now considered invalid. The session transcript itself is still valid, so the session should remain visible/loadable even if recipe hydration fails.

Observed while testing ACP remote server TLS: loading session `20260626_83` failed with:

```text
recipe: Invalid recipe:
Unnecessary parameter definitions: pr.
```

That error is unrelated to TLS, but it exposed a broader recipe/session persistence issue.

## Problems

1. **ACP `loadSession` fails hard when applying the stored recipe fails.**
`handle_load_session` calls `apply_session_recipe` and returns the error, which prevents the whole session from loading.

Relevant path:
- `crates/goose/src/acp/server/load_session.rs`
- `crates/goose/src/acp/server/recipe/mod.rs`

2. **CLI recipe runs do not persist the same recipe metadata as ACP-created recipe sessions.**
ACP new-session stores the recipe plus `user_recipe_values`. CLI recipe runs store the recipe, but not the parameter values/block needed to faithfully reload the recipe-backed session later.

Relevant paths:
- `crates/goose/src/acp/server/new_session.rs`
- `crates/goose-cli/src/session/builder.rs`

3. **CLI recipe runs should likely be implicitly trusted.**
If a user explicitly ran a local recipe from the command line, the resulting session should not later be treated like an untrusted/imported recipe in Desktop/ACP flows.

4. **The original recipe base directory is not preserved for reload.**
ACP re-renders stored session recipes using the global recipe library dir. That can break recipes that depend on `recipe_dir`, file parameters, or relative sub-recipes if the original recipe came from somewhere else.

## Expected behavior

- Loading a historical session should be best-effort with respect to recipe metadata.
- If recipe hydration/rendering/application fails, the transcript should still load.
- The server should log the recipe hydration failure and surface enough metadata for the UI to show a warning if needed.
- CLI recipe sessions and ACP recipe sessions should persist enough metadata to reload consistently: original recipe, user parameter values, base/source directory, and trust state.

## Notes

This may need a small session metadata cleanup rather than a point fix. Recipe validation rules can change over time, so old sessions should remain readable even when their saved recipe no longer passes current validation.

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

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

Đánh giá

Issue này chưa được đánh giá.

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.