8 Commits

Author SHA1 Message Date
Benjamin Schwing
7938c6f40c fix(mastery): accept retained archive ids in tutoring memory coverage (#2947)
The fold prompt lets memory entries cite previously retained archive IDs,
but covered_archive_ids had to equal the newly supplied set exactly. A
model that also lists retained IDs as covered failed every fold, so the
watermark never moved and the session stayed on degraded raw history.

Accept covered IDs that are the newly supplied ones plus IDs the prior
memory already covered or cited. Still reject omitted, invented or unseen
IDs, and store only the newly folded IDs as covered.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-28 18:24:06 +08:00
Harsh
f76de28db9 fix(mastery): count the whole memory request against the history plan
The fold loop counted only each exchange's archive text and always folded
the oldest exchange, so one exchange over the plan was sent whole, and
prior learner memory could push a fitting exchange over it.

Fold the longest prefix of whole exchanges whose complete request fits:
prior memory, the system instruction and the exchanges as _summarize()
serializes them, plus a reserve for the length line. If even the oldest
exchange doesn't fit, send no memory call; the watermark stays and the
exchange stays in exact recall.
2026-11-11 11:32:20 +05:30
Harsh
4ddaf9c0aa fix(mastery): stop tutoring-memory retries from growing every turn
A failed tutoring-memory call keeps the watermark, so the next turn
retried with the same backlog plus the newest exchange, and the call
grew without limit (#2496). Fold in only the oldest whole exchanges
that fit one history plan, at least one, and leave the rest
unsummarized so the watermark moves only past what was covered.

Related to #2496
2026-11-07 10:40:37 +05:30
x-labb
15c79b4356 fix(mastery): stop retrying a truncated tutoring memory on every turn 2026-11-02 18:44:34 +01: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)
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
yepyhun
499e6bc75f feat(mastery): bound tutoring memory with exact branch recall 2026-10-12 11:16:34 +02:00