fix: scope a session's "her notes" to its own time window
The HUD's notes list filtered journal/note entries by `created_at >= started_at` with no upper bound, so a *closed* session kept absorbing every note she wrote afterward — a session from last Saturday would show a note jotted 25 minutes ago. Cap the window at `ended_at` for closed sessions; live sessions (no end yet) stay open-ended as before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -1298,12 +1298,17 @@ def hud(session_id: int | None = None) -> dict | None:
|
||||
for h in list_hands(sid)
|
||||
]
|
||||
|
||||
# Notes she jotted during this session: journal/note entries since it started.
|
||||
# Notes she jotted *during* this session: journal/note entries inside its
|
||||
# [started_at, ended_at] window. A live session has no end yet, so it stays
|
||||
# open-ended; without the upper bound a closed session would keep absorbing
|
||||
# every note she writes long after it's over.
|
||||
started = s.get("started_at") or ""
|
||||
ended = s.get("ended_at") or None
|
||||
notes = [
|
||||
{"created_at": j["created_at"], "kind": j["kind"], "content": j["content"]}
|
||||
for j in memory.list_journal(kinds=("note", "journal"))
|
||||
if (j["created_at"] or "") >= started
|
||||
and (ended is None or (j["created_at"] or "") <= ended)
|
||||
][:20]
|
||||
|
||||
stats = session_stats(sid)
|
||||
|
||||
Reference in New Issue
Block a user