Repository navigation
feat(sessions): global session index, sessions --all, resume from any dir - #454
Merged
Merged
Conversation
… dir (#439) Every face that starts a session appends one line (id, absolute session file, cwd, face, start time — never prompt text) to $CODECORA_HOME/tole/sessions-index.jsonl: owner-only, append-only, a bad line skipped, best effort. `tole sessions --all [--grep <text>]` lists every project's sessions newest first with cwd and a first-prompt preview read from the session file; `tole resume <id>` falls back to the index (and a missing local sessions dir is no longer an error there). TOLE_NO_SESSION_INDEX=1 turns recording off.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…lines (#439) Cora (alerts #122/#123): a corrupt index line whose file is not <id>.jsonl made resume recurse without bound, and the first non-UTF-8 line ended the index read. find() now only returns an entry whose file is <dir>/<id>.jsonl and resume only looks up a valid id, so the recursive call always resolves locally; the index is read as raw byte lines and an unparsable one is skipped.
Cora (alert #124): the index fallback resumed project A's session with project B's cwd, workspace jail, config and trust, so its tools could act on the wrong tree under an untrusted config. `tole resume <id>` for a session of another project now refuses and prints the command to run in that project (`cd <project> && tole resume <id>`, plus --sessions-dir when it is not the default), so that project's own config and trust gate apply.
Merged
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
A global session index so sessions can be found and resumed across projects:
tole sessions --all [--grep <text>], andtole resume <id>naming the project a session belongs to.Closes #439.
Why
Sessions live per cwd (
.tole/sessions/); on a multi-project machine there was no way to find which project a session was in, and resuming required remembering the cwd.Changes
tole-cli/src/session_index.rs(new):$CODECORA_HOME/tole/sessions-index.jsonl(next to the trust store, rather than XDG, so all tole state shares one root). One line per session START — id, absolute session file, cwd, face, start time — written in one append-modewrite, owner-only (0600); the last line per id wins, malformed/torn lines are skipped. No prompt text in the index: preview, status and turn count are read from the session file when listing. Recording is best effort (never fails a session);TOLE_NO_SESSION_INDEX=1disables it.run,chat(new sessions),missionand the session host (serve / ACP / MCP).tole sessions --all— newest first, id, name, pc, turns, start time, cwd and a sanitized one-line preview; sessions whose file is gone are hidden.--grep(requires--all) filters case-insensitively on first prompt, name or cwd.tole resume <id>: when the id is not in the current sessions dir but the index knows it, resume REFUSES and prints the command to run in the owning project (cd <project> && tole resume <id>, with--sessions-dirwhen non-default). Deliberate deviation from the issue's "cwd-independent resume" (Cora alert fix: check provider HTTP status; drive-letter paths in git add jail #124): resuming from here would apply this directory's workspace jail, project config and trust to another project's session. A missing local sessions dir is now "no local match" instead of an error. The index fallback only accepts a valid id whose indexed file is<dir>/<id>.jsonl, and the index is read as raw byte lines (a non-UTF-8 line is skipped) — Cora alerts fix: read_file rejects non-regular files (FIFO hang in the jail) #122/fix(storage): poison on failed append + O(new) commit id validation #123.docs/epics.md,docs/threat-model.md.chat --resumedoes not consult the index yet.Testing
findignores gone files.CODECORA_HOME, mock provider): a session started in project A is invisible to B'ssessions, listed bysessions --allwith A's cwd and preview, matched by--grep,resume <id>from B refused with the exactcd <A> && tole resume <id>command and nothing written, then resumed from A; the index holds no prompt text;TOLE_NO_SESSION_INDEX=1records nothing;--grepwithout--allis refused.cargo fmt, clippy (workspace all-targets, bare, shell-tools, mcp),cargo test --workspace: green (one run hit the known load-sensitiveweb::fetch_and_search_round_trip_against_local_mockflake, untouched here; green on rerun). Cora agent review (prepare + finalize): 0 findings,should_block: false.Note: e2e tests elsewhere that do not isolate
CODECORA_HOMEadd their temp sessions to a developer's real index;--allhides them once their files are deleted.