Same-day maintenance follow-up to v1.5.3, focused on how chat feels.
- Chat responsiveness: the post-answer "generating" stall is gone (DONE
carries the persisted message ids so the frontend reconciles in place
instead of refetching the session), turn events flush in one
transaction (#678), the streaming autoscroll stops forcing per-frame
layouts, and Enter during streaming no longer fires an interleaved
message (#674).
- Partners: markdown-table row splitting unified across channels — empty
cells survive Slack (#679) and Feishu (#683) tables, and empty rows are
no longer misread as header separators (#682).
- LLM-output parsing: <think> reasoning tags stripped before parsing
(#675), adjacent JSON values no longer break Deep Research extraction
(#680), and the parser returns the longest decodable value instead of
the first prefix (#692).
- Assorted: streaming quiz cards stay scoped to their own turn (#677),
the create-KB form survives the background indexing poll (#691), and
Math Animator reads ms as milliseconds, not minutes (#681).
- Typing: SQLite session store add_message accepts str parents to match
SessionStoreProtocol (PocketBase record ids).
Release notes: assets/releases/ver1-5-4.md
Two quizzes in one chat session share positional question ids
(q_1..q_N), so answer state is turn-scoped (#487). But during
streaming generation the QuizViewer received turnId=null — the result
event only lands at turn end — which bypassed that scoping: the card
hydrated the previous quiz's answers through the legacy cross-turn
lookup, showed them as already answered, and auto-reported them back
with an empty turn_id while questions were still being generated.
- derive the quiz turn id from the streamed events themselves
(extractQuizTurnId); the result event stays authoritative
- QuizViewer: without a turn identity the card is local-only — no
notebook hydration, no auto-report, no upserts
- sqlite store: a lookup without turn_id now only matches the legacy
namespace (turn_id='') instead of falling back to other turns' rows
Post-stream finalisation appended buffered events one at a time, each in
its own fsync'd commit (connection open + turn lookup + MAX(seq) + INSERT
+ UPDATE + COMMIT per event). On slow storage this dominates turn
finalisation: on a NAS with spinning disks each commit took ~0.65 s, so a
550-event turn kept the client spinner running for ~6 minutes after the
answer had fully streamed, because the terminal done event is only
published after the flush.
Add SQLiteSessionStore.append_turn_events, which assigns seqs and inserts
the whole batch inside one transaction (measured: 501 events in ~6 ms),
and make _flush_buffered_events prefer it, keeping the per-event path as
a fallback for stores without batch support. When the turn has vanished
(session deleted mid-drain) the flush now logs one summary line instead
of one warning per buffered event.
#493 (sqlite): route _initialize() through the _connect() contextmanager
(the one remaining raw sqlite3.connect FD leak); document the auto-commit
contract so the redundant explicit commits are understood.
#529 (book):
- _strip_thinking_preamble: guard `{ not in text` before rindex() so plain
prose (refusals/errors) no longer raises ValueError -> ERROR block;
hoist json import to module top.
- llm_json: honor caller max_tokens as max(max_tokens, 2600) instead of
discarding it; bump default to 2600; fix stale 'minimal' docstring -> 'low'.
- engine.compile_page: rebuild OVERVIEW pages deterministically via
_materialize_overview_page on force, instead of running the generic LLM
compiler over hand-built intro/concept-graph/index blocks.
- kb_health.scan_log_health: key repeated-failure detection on the op, not
the free-text message, removing false positives/negatives + dead block_error.
- services/__init__: drop orphaned notebook_manager lazy-import + __all__ entry.
- PageReader.tsx: restore t() i18n on regenerate buttons; add 'Regenerating…'.
- remove PATCHES.md (developer-local scratch notes).
#484 (zulip): also match the disambiguated @**Name|user_id** mention form;
make the docstring truthful; add coverage.
#500: remove stray PR_DESCRIPTION.md committed to repo root.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wrap _connect() in a contextmanager that closes the connection after use,
preventing one leaked file descriptor per query.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rebased onto dev (post-#348) and resolved two UI conflicts (`web/app/(workspace)/chat/[[...sessionId]]/page.tsx` drops the now-dead `replaySnapshot` helper; `web/components/chat/home/ChatMessages.tsx` switches the last-assistant action button from the old `RotateCcw`/Retry to `RefreshCcw`/Regenerate). Smoke tests green (199 passed) and all required checks pass.
Merging: adds a `regenerate` capability wired through CLI (`/regenerate` · `/retry`), WebSocket (`type: "regenerate"`), and Web UI (per-message Regenerate button). Backend rolls back the trailing assistant via `SQLiteSessionStore.delete_message`, reuses `start_turn` through `_persist_user_message=False` / `_regenerate=True`, skips `memory_service.refresh_from_turn` on regeneration, and surfaces non-fatal `regenerate_busy` / `nothing_to_regenerate` errors. Also includes empty-response diagnostics in `_stage_responding`. 18 new tests.
Persist structured quiz mistakes on submission and expose them in a
new review page accessible from the utility sidebar.
Backend:
- New wrong_answers SQLite table (cascade on session delete) with
add/list/count/update/delete store methods
- Hook POST /api/v1/sessions/{id}/quiz-results to also insert one row
per incorrect answer, preserving the existing [Quiz Performance]
text message consumed by the LLM context builder
- New GET /api/v1/wrong-answers (resolved filter + pagination),
PATCH /{id} (resolved toggle), DELETE /{id}
Frontend:
- New /wrong-answers page under the (utility) route group with
unresolved/all filter, mark-as-resolved, delete, and session link
- Sidebar nav entry using the NotebookPen icon
- English and Chinese i18n strings for all new UI text
Tests:
- 8 store tests covering filter, cascade, resolved toggle, delete
- 6 router tests including a regression test that record_quiz_results
still writes the [Quiz Performance] text message