Repository navigation
feat(acp): paginate replayed messages in load_session - #10365
SarthakB11 wants to merge 3 commits into
Conversation
Read optional messageLimit/messageOffset from the load_session request
meta and slice the replayed conversation counting back from the most
recent message, mirroring the pagination proposed for the removed REST
GET /sessions/{id} endpoint. When neither is set the replay is
unchanged, so this stays backwards-compatible.
Refs aaif-goose#9358
Signed-off-by: SarthakB11 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3dd7bfa911
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| .map(|c| c.messages().to_vec()) | ||
| .unwrap_or_default(); | ||
| let messages = if limit.is_some() || offset.is_some() { | ||
| paginate_messages(&messages, limit, offset) |
There was a problem hiding this comment.
Filter hidden messages before paginating replay
When messageLimit or messageOffset is set, this slices the raw conversation before the replay loop skips !message.metadata.user_visible messages below. In compacted sessions the raw history includes agent-only summary/continuation messages, so a page can be spent partly or entirely on hidden entries; for example, if the newest two raw messages are agent-only, load_session with { "messageLimit": 2 } replays no visible history even though older visible messages exist. Paginate the user-visible replay set instead of the unfiltered session messages.
Useful? React with 👍 / 👎.
Pagination sliced the raw conversation before the replay loop filtered out hidden agent-only messages, so in compacted sessions a page could be spent partly or entirely on summary/continuation entries. A request with messageLimit=2 could replay no visible history even when older visible messages existed. Filter to the user-visible set first, then paginate, so messageLimit always yields that many visible messages when they exist. Signed-off-by: SarthakB11 <[email protected]>
|
Good catch. Now filtering to the user-visible set before paginating, so hidden agent-only messages no longer consume the page budget. Added tests. |
…-pagination # Conflicts: # crates/goose/src/acp/server/load_session.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd0075ed5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .map(messages_for_acp_replay) | ||
| .unwrap_or_default(); | ||
| let messages = if limit.is_some() || offset.is_some() { | ||
| paginate_messages(&messages, limit, offset) |
There was a problem hiding this comment.
Keep tool requests and responses in the same replay page
When a page boundary falls between a ToolRequest and its following ToolResponse—for example, messageLimit: 1 selects a final tool-response message—this slices the pair independently, so replay sends a ToolCallUpdate without the preceding ToolCall. The desktop adapter creates a response-only user message for that update (ui/desktop/src/acp/adapter/tools.ts), which ProgressiveMessageList deliberately suppresses, while the inverse page renders the request as permanently pending. Paginate logical tool-call pairs together, or otherwise ensure each replayed response has its request.
Useful? React with 👍 / 👎.
|
Thanks for the work on paginating ACP session replay. The linked issue targeted the former |
Adds optional
messageLimitandmessageOffsetfields on theload_sessionrequest meta so clients can replay session history in chunks instead of receiving every message inline (#9358). Both count back from the most recent message; when neither is set the replay is byte-for-byte unchanged. The slicing runs through a smallpaginate_messageshelper that clamps oversized values.This is the ACP re-do of #9473, which targeted the old
goose-serverRESTGET /sessions/{id}endpoint that was removed in #10224.Tested:
cargo test -p goose acp::server::load_session(8 pass),cargo clippy -p goose --lib -- -D warnings,cargo fmt.Fixes #9358