Repository navigation
Let several conversations share one corpus - #46
Merged
Merged
Conversation
A corpus held a single conversation: two spear-chat processes on the same tree read and rewrote the same history file, and the last to save won. Conversations now have names. `spear-chat --session <name>` opens one and `/session [list|new|switch|rm]` manages them in the chat; each keeps its history beside the default one, which keeps the file it always had. A conversation is held by one process through an flock on a lock file beside its history, so a second spear-chat (another terminal, or another container on the same state directory) is refused it and pointed at another name, and the kernel drops the lock with a crashed process. A switch drops what the previous answer engaged, through the same helper as /clear. /cd keeps the conversation and takes its lock in the new corpus, staying put if that one is held elsewhere. Training episodes record the conversation's name in their provenance (None for the default one).
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.
A corpus held a single conversation: two spear-chat processes on the same tree read and rewrote the same history file, and the last to save won.
What changes
spear-chat --session <name>opens a named conversation; in the chat,/session [list|new <name>|switch <name>|rm <name>]manages them (switch defaultreturns to the unnamed one).history-adhoc-<tag>-<name>.json); the default keeps the file it always had, so nothing changes for whoever never names one.flockon<history>.lock, held for the life of the process (the kernel drops it with a crashed one). A second spear-chat, in another terminal or another container on the same state directory, is refused the conversation and pointed at another name;/sessionlists conversations open elsewhere./clear./cdkeeps the conversation and takes its lock in the new corpus, staying put if that one is held elsewhere.provenance.conversation(None for the default one).using/usage.rst,using/context.rst.Verification
tests/test_conversation_sessions.py(names, paths, listing, lock refusal across processes, switch and reset, the flag and the command); the 59 test modules touching the CLI, its settings and training capture: 1293 tests OK.alphaandbeta; the second launch onalphawas refused,/sessionshowedbetaas open elsewhere andswitch betawas refused,new/switch/rmbehaved, and the episode recorded inalphacarriesconversation: alpha.