Repository navigation
feat(serve): list past sessions with a name, folder and last activity - #970
Merged
Merged
Conversation
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
GET /sessions/index?limit=&cursor=totole serve: the past sessions on disk, newest first, as metadata only. Closes #572 (part of #523).Why
A remote client could only show sessions it created itself:
GET /sessionslists live sessions, andPOST /sessions {"resume"}needs an id the client already knows. After a restart, or on a second device, there was no way to learn the ids.Changes
crates/tole-cli/src/serve/past_sessions.rs;serve.rsonly gets the route arm (before/sessions/{id}) and themodline.{"sessions": [{id, name, folder, lastActivity, entries, turns, parent, live, busy}], "nextCursor", "skipped", "scanTruncated"}. No prompt, preview, tool output or transcript text.--sessions-dir(possibly shared), a session whose recorded folder is outside the workspace is not listed. Thecwdof serve-opened sessions is not recorded in their header, so they show the workspace as folder.limitdefault 50, clamped to 100 (0 or non-number is 400); cursor<mtime_ms>.<session id>, validated with the session-id charset, malformed is 400. Order: file mtime desc, id as tie-break.docs/mobile-control.mdand CHANGELOG ([Unreleased]/ Added, Behavior Change) updated. An id from the list works withPOST /sessions {"resume"}.Decision for review: workspace-only scope (the issue's recommendation) rather than the machine-wide global index; the label is the
fact/session_nameregister only, not the first user message, to keep transcript text out of the listing.Testing
cargo test -p tole-cli --bin tole -- past_sessions): shape and paging, newest first, ties, bad limit/cursor 400, no transcript text, other folders never listed, unreadable/oversized/foreign files skipped, scan/open/byte bounds.tests/serve_past_sessions.rs: sessions listed after a restart, paging, bad cursor, resume of a listed id, 401 without a token.cargo fmt --all; clippy-D warningsin default,--no-default-features,--no-default-features --features shell-tools;cargo test -p tole-cli: 1614 passed, 0 failed.