fix(voice_worker): keep history and the brain's output scoped to who was there
- A final is stored under the channel, speaker name and time fixed when its end was decided. Decoding takes a while; a move, rename or late joiner meanwhile used to change where and when it was said, and who heard it. - At start the worker closes presence a killed run left open (HistoryStore.close_open_presence), so a person who is gone no longer hears new speech after a restart. - run_reply_engine(legacy_memory=False) skips v1's single-user memory (warm profile, extractor, diary, graph, digest); the v2 brain uses it so another user's profile or diary never reaches the prompt. - While a brain reply runs, stdout and stderr are muted (also helper threads such as the web fetch pool); the worker logs through voice_worker/log.py to the original stderr. - Live check: Ollama's /v1 fixes the context at 2,048 tokens and cut the prompt in earlier runs; with an 8k tag the chat-record question was answered 4 of 4 and nothing reached the output. Noted in llm_contexts and the eval. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -202,12 +202,16 @@ which carry Discord's own time.
|
||||
<- {"type": "reply_text", "id": "r1", "text": "...", "failed": false}
|
||||
```
|
||||
|
||||
- At start the worker closes every presence interval a previous run left open (it may have been
|
||||
killed); the app then reports who is there.
|
||||
- `voice_join` closes the presence of everyone in the previous channel and starts a new one;
|
||||
`voice_leave` and the end of the session close it, because nothing said after that is heard.
|
||||
`member_join` opens the user's presence in the current channel and remembers their name;
|
||||
`member_leave` closes it. Members outside a voice channel are ignored.
|
||||
- Every non-empty `final` is stored as a `voice` record of the current channel under the speaker's
|
||||
name (the user ID until `member_join` names them). A final outside a voice channel is not stored.
|
||||
- Every non-empty `final` is stored as a `voice` record under the channel, the speaker's name (the
|
||||
user ID until `member_join` names them) and the time of the moment its end was decided, all fixed
|
||||
then: decoding takes a while, and a move, a rename or a late joiner meanwhile must not change where
|
||||
or when it was said, or who heard it. A final said outside a voice channel is not stored.
|
||||
- Chat messages are stored only as given; the app sends only registered channels.
|
||||
- `reply` asks the brain to answer `user`'s `text`. The worker builds the history context for that
|
||||
user (their scope only) and runs the reply engine on a worker thread, one reply at a time.
|
||||
@@ -216,7 +220,12 @@ which carry Discord's own time.
|
||||
answer is stored when the app reports the sent message as `chat_message` with `to`. With
|
||||
`speak: true` the answer is also spoken through the TTS path under the same id (audio frames and
|
||||
`tts_done`), and `tts_cancel` with that id stops it. Each user keeps their own short-term dialogue
|
||||
memory (tool carry-over) across replies.
|
||||
memory (tool carry-over) across replies. The brain runs the reply engine with v1's single-user
|
||||
memory off (`legacy_memory=False`: no warm profile, diary or graph), because several people share
|
||||
this assistant and only the asker's scoped history may reach the prompt.
|
||||
- While a reply runs, the process's stdout and stderr are muted: the v1 engine and its tools print
|
||||
questions, answers, tool arguments and memory text, also from helper threads. The worker's own log
|
||||
(`voice_worker/log.py`) writes to the original stderr and keeps working.
|
||||
- Memory settings, optional in `hello` as `"memory": {...}` and changeable with
|
||||
`{"type": "memory_config", ...}`: `chat` (true), `others` (true), `off` (false), `since_days`
|
||||
(null: whole history), `recent_minutes` (30), `recent_records` (20), `matches` (5),
|
||||
|
||||
Reference in New Issue
Block a user