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:
@@ -181,6 +181,13 @@ class HistoryStore:
|
||||
(ts, user_id, channel_id))
|
||||
self._conn.commit()
|
||||
|
||||
def close_open_presence(self, ts: float) -> int:
|
||||
"""Close every open interval (at start, after a run that ended without closing them)."""
|
||||
with self._lock:
|
||||
n = self._conn.execute("UPDATE presence SET left_at=? WHERE left_at IS NULL", (ts,)).rowcount
|
||||
self._conn.commit()
|
||||
return n
|
||||
|
||||
def presence_close_channel(self, channel_id: str, ts: float) -> None:
|
||||
with self._lock:
|
||||
self._conn.execute("UPDATE presence SET left_at=? WHERE channel_id=? AND left_at IS NULL",
|
||||
|
||||
@@ -71,7 +71,9 @@ Setting `since` (default none, meaning the whole history) drops records older th
|
||||
## Writes and maintenance
|
||||
|
||||
- `add_voice`, `add_reply`, `add_chat`, `edit_chat`, `delete_chat`.
|
||||
- `presence_join`, `presence_leave`, `presence_close_channel`.
|
||||
- `presence_join`, `presence_leave`, `presence_close_channel`, and `close_open_presence(ts)`, which the
|
||||
host calls at start: a run that was killed never closed its intervals, and nobody is heard until
|
||||
the app reports who is there again.
|
||||
- `records_of(person)` and `forget_person(person)`: the person's own records (authored by them or
|
||||
replies to them), for the data screen's per-person view and delete. Deleting also removes their
|
||||
presence intervals.
|
||||
|
||||
Reference in New Issue
Block a user