DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

[Bug]: Mastery Path objective with incomplete objective-scoped packet can never be assessed; each answer re-runs preparation for minutes

Open BenjiAvH opened this issue 1 month ago • 0 comments

Do you need to file an issue?

  • [x] I have searched the existing issues and this bug is not already filed.
  • [x] I believe this is a legitimate bug, not just a question or feature request.

Related: #1940 (tracking), #2070 (same error text, different cause: focus-scoped packets; fixed).

Describe the bug

On a source-grounded Mastery Path, a CONCEPT objective whose objective-scoped lesson packet comes back with coverage.complete = false can never be assessed, and every learner answer for that objective costs several minutes.

prepare_lesson() stores the objective-scoped packet in assessment_evidence[kp_id] even when the preparation model reports a gap (lesson_evidence.py, coverage dict around L1050 and commit around L1088 on dev f7aed0744). validate_evidence() then refuses every mastery_assess call because coverage.complete is not True (L395–L399):

This packet supports a teaching slice, not an arbitrary assessment. Prepare assessment-bound source evidence before grading.

The tutor follows that instruction and calls mastery_prepare_lesson again without focus. That runs the full retrieval + page inspection + repair cycle again (60–210 s per run in our case), usually ends with the same gap, and the next mastery_assess is refused again. After two rounds the tutor gives up and replies in prose. Result per learner answer:

  • 4–5 minutes of "thinking" in the UI (almost all inside mastery_prepare_lesson; plain tutor turns take 6–20 s with the same model),
  • no grading, no evidence stored, objective stays open,
  • the learner is not told that the answer was not recorded.

There is no state in which the path recovers on its own: the gap is a property of the objective vs. the preparation model's judgement, so re-preparing does not change it.

In our case the gap was not even real: the "missing" norm text was one of the objective's own topic_source_ids (indexed, retrievable), and the preparation model additionally demanded proof that the retrieved statute text was valid for each case year. A narrower objective would likely pass, but the learner has no way to know that, and path generation does not check that each objective is coverable by its sources.

Steps to reproduce

  1. Create a source-grounded path with a broad CONCEPT objective that combines two rule sets (e.g. a national-law test plus a treaty-law test) and attach several statute/treaty PDFs as sources.
  2. Start learning; the tutor prepares the lesson and teaches.
  3. Answer the tutor's question.
  4. Observe in the turn trace: mastery_prepare_lesson → mastery_assess (refused, "teaching slice") → mastery_prepare_lesson → mastery_assess (refused) → prose reply. Turn duration 220–310 s.
  5. assessment_evidence[kp].coverage = {"complete": false, "scope": "objective", "missing": "..."}; no new learning_evidence entry.

Observed on 1.7.1 (+ PR #2261, #2324, #2325 applied locally; none of them touch preparation or validate_evidence), model gpt-6.1-terra, reasoning low.

Expected behavior

At least one of these, ideally all:

  1. No re-preparation loop: if an objective-scoped packet for the current objective/scope/model fingerprint is already stored with complete=false, mastery_prepare_lesson should return it (or a clear "coverage gap" result) instead of rebuilding, and mastery_assess should return a structured coverage_gap result that tells the tutor not to re-prepare.
  2. Grade what is covered: allow assessment of the covered part of the objective (e.g. partial/correct limited to coverage.covered, flagged as such), or let the learner mark the gap explicitly, instead of blocking the objective forever.
  3. Surface it: tell the learner the answer was not recorded and why.
  4. Prevent it at path creation: when a path is created/confirmed (or when sources change), run a cheap coverage check per objective and split or rephrase objectives whose sources cannot cover them, so learners do not hit this mid-course and do not have to edit objectives (which also changes objective IDs).

Related Module

Mastery Path – deeptutor/learning/lesson_evidence.py (prepare_lesson, cached_lesson, validate_evidence), deeptutor/capabilities/mastery/tools.py (mastery_assess, mastery_prepare_lesson).

Additional Information

Timing breakdown of one affected turn (310 s): prepare 7→75 s, assess refused 80 s, prepare 85→293 s, assess refused 297 s, prose reply 304→310 s.

BenjiAvH avatar Nov 02 '26 09:11 BenjiAvH