134 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
e347c0c2e0 fix: preserve tutoring replies and stabilize preview runtime
Keep learner-facing explanations visible across finish checks, persistence, and replay. Remove mastery prose heuristics and prioritize learner objections.

Coordinate service shutdown and descendant cleanup, and preserve video lesson identity and playable results across chat completion and reload.
2026-10-27 17:58:46 +08:00
Bingxi Zhao (Frank)
be596676f7 fix: restore preview calendar and navigation workspace boundaries 2026-10-27 02:04:20 +08:00
Bingxi Zhao (Frank)
9d822fcdf0 fix(ci): align preview fixtures and formatting with current contracts 2026-10-27 01:44:57 +08:00
Bingxi Zhao (Frank)
6bbcc00c55 Merge dev into preview, preserving preview features
Integrate dev fixes with preview's Python/TypeScript schedulers, chat queue, learning navigation, and live turn persistence.
2026-10-27 01:16:58 +08:00
Bingxi Zhao (Frank)
28c11e2ae8 feat: update notes, chat interactions and workspace UI on preview
Remove course pages, APIs and the course_study capability. Add anchored note
threads and reviewed learning-block generation, queued and withdrawable chat
messages, quote attachments, side chats, and the calendar/favorites/navigation
updates.

Keep preview's existing backend architecture. Wire the new features through
its Python application and existing chat engine, retain legacy selected-text
requests, persist mid-turn messages in replay, and restore note context when
regenerating. Leave stored user data intact.

Validate frontend contracts, dependency boundaries, types, 1290 node tests,
840 rendered tests, lint, localization and the production build. Exercise
session/notes/API regressions, 53 chat-engine tests and 20 Python/native
integration tests with isolated runtime data.
2026-10-26 22:13:34 +08:00
Bingxi Zhao (Frank)
4fe1b5b24a fix(mastery): finish bounded memory and count preparation usage (#1920, #1926) 2026-10-19 03:44:51 +08:00
Bingxi Zhao (Frank)
e28c803636 fix(runtime): persist live prefixes and reclaim completed streams (#1971) 2026-10-19 03:29:21 +08:00
Bingxi Zhao (Frank)
583bdfc714 Merge PR #1945: fence edited submissions and isolate recovery by account and backend support 2026-10-19 01:03:40 +08:00
Bingxi Zhao (Frank)
8b73efbaeb Merge PR #1958: stabilize cached prefixes with bounded sources and complete summary accounting 2026-10-19 00:59:30 +08:00
Bingxi Zhao (Frank)
1497994c9f Merge PR #1938: bound tutoring history and retain exact recall when condensation fails 2026-10-19 00:57:48 +08:00
Bingxi Zhao (Frank)
0fd8dc8384 Merge PR #1953: source-bound assessment with portable lexical page lookup 2026-10-19 00:43:33 +08:00
Bingxi Zhao (Frank)
59cdd81170 Merge PR #1943: preserve grouped questions through reviewed outline revisions 2026-10-19 00:40:44 +08:00
Bingxi Zhao
2c4a02f7cc Merge pull request #1830 from dajiaohuang/fix/turn-admission-lease
fix(session): release admission leases after preference failures
2026-10-19 00:20:58 +08:00
Bingxi Zhao
3de64fdd02 Merge pull request #1834 from dajiaohuang/fix/pocketbase-message-cursors
fix(session): preserve opaque PocketBase message cursors
2026-10-19 00:20:34 +08:00
Bingxi Zhao (Frank)
399297e7f0 feat: preserve TypeScript engine migration and workspace updates 2026-10-18 23:09:10 +08:00
zane-i
00b92f20c6 fix(session): stop the rolling summary from breaking the prompt cache
The summary was prepended inside the replayed history, so every
compaction rewrite changed bytes at the head of the request and threw
away the whole cached prefix behind it. Measured on a six-turn session
on a custom OpenAI-compatible route: the turn that rewrote the summary
dropped the shared prefix to one message and ran 21,629 prompt tokens
for 5,888 cached (27.2%).

Deliver it where the runtime-snapshot machinery already puts per-turn
context: as a trailing role=user message tagged _context_snapshot. A
rewrite is then a pure append, and an unchanged revision is a no-op.
replay_history no longer injects the summary, which is what kept it
mid-request whatever position it was given.

Two smaller fixes ride along, both in the same summary path:

* The summariser's scratchpad leaked into compressed_summary when the
  route emits reasoning inline. The stored summary was 6,933 characters,
  half of them the model's drafting monologue under an unclosed think
  tag, and the real summary was truncated by it. clean_thinking_tags
  cannot be used here - it deletes through end of text for an unclosed
  block - so the tag is honoured only when it is closed, and an unclosed
  one is cut at the first heading.

* _model_tokens counts the summary the way the request carries it.

The two regression tests that pinned the summary inside model_history
now assert the new delivery: the history starts at the oldest retained
turn and the summary still reaches the model.
2026-10-13 23:46:59 +08:00
yepyhun
ccac56eec1 fix(mastery): bind semantic assessment to verified question evidence 2026-10-13 12:21:04 +02:00
yepyhun
f986774b87 fix(chat): durably replace uncertain submissions and isolate recovery owners 2026-10-13 12:07:47 +02:00
yepyhun
9cfa5cb8fd fix(mastery): retain incremental grouped replies and partial feedback 2026-10-13 08:24:38 +02:00
yepyhun
c3301c0055 feat(mastery): support independently graded question groups 2026-10-12 21:03:14 +02:00
yepyhun
499e6bc75f feat(mastery): bound tutoring memory with exact branch recall 2026-10-12 11:16:34 +02:00
YizukiAme
e747f28705 fix(session): budget projected image replay before compaction 2026-10-10 00:33:40 +08:00
dajiaohuang
019ed329c6 fix(session): preserve opaque PocketBase message cursors 2026-10-08 12:45:32 +08:00
dajiaohuang
8ef659c4ce Merge commit '6cf793bd868ba5ecbe64722936d4be8fab5a01df' into fix/turn-admission-lease
# Conflicts:
#	deeptutor/services/session/turns/request_preparer.py
2026-10-08 12:42:35 +08:00
dajiaohuang
489b399cd4 fix(turns): release admission leases after preparation failures 2026-10-08 12:40:44 +08:00
Bingxi Zhao (Frank)
d15e35a378 fix(turns): make lost-ack resends reuse the original conversation (#1793) 2026-10-08 01:20:23 +08:00
Bingxi Zhao (Frank)
4042093490 test(chat): verify legacy pair deletion after branch migration 2026-10-07 20:41:51 +08:00
Bingxi Zhao (Frank)
2046f71888 fix(chat): delete paired messages by branch ancestry 2026-10-07 20:39:30 +08:00
Wenjun Li
fdebb2761e fix(chat): keep parked ask_user turns alive across deletion and reload (#1789)
* fix(session): delete a message's own turn and refuse active-turn deletion

Resolve the owning turn via `turns.assistant_message_id` for assistant rows
and the user row's `metadata.turn_id`, falling back to the last turn created
at or before the user row for legacy data. The previous `created_at >=` match
selected the *next* turn, because a turn row is always written before its user
row (`begin_turn` -> `add_message`); deleting a completed turn's message could
therefore destroy a later `waiting_input` turn's record while its task still
held the session lease.

Refuse the delete whenever the resolved turn is in `ACTIVE_TURN_STATUSES`
(queued/running/waiting_input) instead of only "running"; the API answers 409
with "running or waiting for input".

* fix(chat): resubscribe a parked turn on load so its ask_user card survives a reload

A `waiting_input` turn keeps the session lease while it waits, and its
ask_user card exists only in the live event stream: no assistant row is
persisted until the turn settles. Loading a session only resubscribed
"running" turns, and through `sendThroughRunner`, whose retry gate drops a
non-streaming session -- so after a reload the card was unreachable while the
turn kept waiting, and the conversation could neither be answered nor used.

Parked turns now subscribe through the client's durable command queue (sent
once the socket opens), once per turn per tab. The replayed stream rebuilds
the card so it can be answered.

* test(chat): align the loader-gate assertion with the parked-turn resubscribe

The source-shape assertion pinned the previous loader line
(`if (loadedStatus === "running" && (activeTurn?.turn_id || activeTurn?.id))`).
The parked-turn resubscribe extracts `activeTurnId` first and adds a
`waiting_input` branch, so update the assertion to the new gate and cover the
parked branch's status check as well.
2026-10-07 20:37:04 +08:00
evan188199-tech
a282bcd6d6 test(session): cover pocketbase_store failure branches and pagination edges (#1773)
* test(session): cover pocketbase_store failure branches and pagination edges

* docs: add PR evidence for pocketbase_store fallback coverage

---------

Co-authored-by: XZH <cto@xzh.ai>
2026-10-07 20:14:24 +08:00
Bingxi Zhao
36e5ea1189 Merge pull request #1659 from ZyPulse-zy/fix/image-context-budget
fix(session): budget image blocks without tokenizing encoded payloads
2026-10-04 15:01:56 +08:00
Bingxi Zhao
b3ee1c7ca9 Merge pull request #1682 from evan188199-tech/codex/fix/tutor-latex-selection
fix(session): ground rendered LaTeX selections (#1676)
2026-10-04 14:10:53 +08:00
Bingxi Zhao
d9aa28ef30 Merge pull request #1615 from MohammadHijjawi97/fix/question-bank-counts-skip-recycled
fix: keep recycled sessions out of question bank counts
2026-10-04 14:02:14 +08:00
XZH
3dad78fcbc fix(session): ground rendered LaTeX selections (#1676) 2026-10-01 03:35:43 -07:00
ZyPulse
05aabcbdf8 fix(session): budget image blocks without tokenizing encoded payloads 2026-09-29 23:08:11 +08:00
Mohammad Hijjawi
dbdecf114b fix: keep recycled sessions out of question bank counts
The question bank list hides entries whose session is in the recycle
bin, but question_bank_stats, list_question_bank_materials and
list_categories still counted them. The filter chips, material chips and
category badges then reported entries the list could not show.

Share one NOT EXISTS fragment between the list filter and the three
count queries so they apply the same rule.
2026-09-28 09:47:31 +01:00
Mohammad Hijjawi
f3e2407e48 fix(sessions): keep recycled chats out of history search
Moving a chat to the recycle bin hides it from the session list, but
history search still matched it: the SQLite search condition and the
PocketBase search filter only excluded imported sessions, not soft-deleted
ones. Search results (and the total used for paging) therefore included
chats the user had already deleted.

Exclude rows with deleted_at set in both stores, matching list_sessions.
A restored chat becomes searchable again.
2026-09-27 11:12:56 +01:00
Bingxi Zhao (Frank)
469f1e096b fix(turns): suppress answered PocketBase worker-loss retries (#1570) 2026-09-27 10:17:15 +08:00
Bingxi Zhao (Frank)
3a0ed2b560 fix(turns): surface and retry orphaned worker loss (#1570) 2026-09-27 04:55:15 +08:00
Bingxi Zhao (Frank)
550268e1e3 fix: support Malay as a persistent reply language 2026-09-27 04:37:15 +08:00
Bingxi Zhao (Frank)
a053fecf6e release: v1.6.11
The interface ships in French and Ukrainian alongside English and
Chinese, and /language pins a reply language for one conversation.
Immersive reading organizes collections as colored folders, adds a
fullscreen learning mode, and turns Explain / Translate / Guide me on a
selection into ordinary messages in the reading chat; "Quiz me on this
page" runs one quiz turn without changing the conversation's mode, which
retires the reading-openers endpoint and its task model. Images embedded
in DOCX, PPTX and PDF are extracted in place and reach vision models.

Office files preview as paged PDFs through LibreOffice (now in the Docker
image), falling back to the in-browser renderers without it. Web sources
re-sync on a durable schedule, linked folders sync on demand, .bib files
index, and a zotero_search tool queries Zotero. Settings gains Learning
progress and credential-free presets; admins import users from CSV;
split deployments can hand a session to a public device. Grok CLI joins
the subagents, Unifically the providers, ChatGPT exports the importers.

Gate cleanup: mypy/bandit findings in the new launcher, audio-overview,
web-source, reading-store and textbook modules; the task-model copy test
follows the retired reading_openers kind.

See assets/releases/ver1-6-11.md for the full notes, and the README
Releases row plus its eleven translations.
2026-09-24 09:59:56 +08:00
Bingxi Zhao (Frank)
f363e5f119 fix(chat): persist explicit reply language per conversation 2026-09-23 13:07:39 +08:00
Bingxi Zhao (Frank)
8880529c65 Merge PR batch with local follow-up fixes
Preserve precise learner KB route guards, combine UI and response language domains, carry normalized EPUB extraction, and regenerate frontend contracts.

Update locale fallback coverage for the completed Ukrainian translation bundle.
2026-09-23 12:01:14 +08:00
Bingxi Zhao (Frank)
adf8c4d8cf fix(chat): preserve prior answer when regenerate admission fails 2026-09-23 11:30:24 +08:00
Bingxi Zhao (Frank)
0ec3c1644f fix(session): keep current preferences when resending saved turn 2026-09-23 11:22:34 +08:00
Bingxi Zhao (Frank)
5868e8acfa fix(session): replay saved request on failed turn resend 2026-09-23 11:06:35 +08:00
Bingxi Zhao (Frank)
1829ae23f0 Fix PDF image mapping, caption refresh, and Grok detection 2026-09-23 10:48:36 +08:00
ZQR1101
436028e0ab fix(session): name the reply language in the compaction instruction
The rolling summary is replayed as a system row on every later turn, so the
language it happens to be written in keeps steering the answer long after the
turns it condensed have scrolled out. The summarizer meta-prompt never stated
a language, so a session held in a language other than the prompt's own came
back to en/zh at the first compaction — #1511's "drifts after a few rounds".

Both the English and Chinese meta-prompt now say which language the summary
body itself must use, via the same language_label() the reply directive uses.
2026-09-21 22:47:56 +08:00
Bingxi Zhao (Frank)
9083d5fe3c fix(attachments): surface PDF processing stages (#1523) 2026-09-21 14:50:37 +08:00
Bingxi Zhao (Frank)
1fe74df0ed fix(notebook): decouple evidence from chat sessions (#1519) 2026-09-21 14:50:02 +08:00