DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

[Bug]: mastery_assess grades only the current message, so a clarification reply is graded as the whole explanation

Open brunadileo opened this issue 1 month ago • 2 comments

Description

mastery_assess builds the learner answer from the current message only:

# deeptutor/capabilities/mastery/tools.py, MasteryAssessTool.execute
learner_answer = str(kwargs.get("_learner_message") or "").strip()

(line 2000 on dev at 88d46c2, same code in 1.7.0)

When an assessment comes back needs_clarification: true, the tutor asks the learner to clarify one point. The learner answers just that point, and the next mastery_assess call grades that short reply as if it were the full explanation. The explanation from the earlier turn is not considered, so a correct answer plus a correct clarification is recorded as partial, final: true.

The same rule also means an explanation written in an earlier turn can never be graded later. If an assessment fails for an unrelated reason (for example the "teaching slice" refusal in #2070), the learner has to paste the whole explanation again.

Steps to reproduce

  1. Mastery Path, concept objective in review. The learner writes a multi-part explanation.
  2. mastery_assess returns result: "ungraded", needs_clarification: true, with feedback asking to correct one sentence.
  3. The learner replies with one corrected sentence only.
  4. mastery_assess grades that sentence alone and records result: "partial", final: true, with feedback that the other parts are missing.

Observed in one session (DeepTutor 1.7.0, anthropic binding, claude-opus-5-5):

Turn Message Result
1 Full explanation (three parts) ungraded, needs_clarification: true (one sentence wrong)
2 Only the corrected sentence partial, final: true: "you leave out the authentication responsibility"
3 Full explanation again, with the correction correct, final: true

Expected behavior

A reply to a clarification request is assessed together with the explanation it clarifies. One of these would work:

  • keep the pending explanation from the needs_clarification turn and assess it combined with the next learner message, or
  • treat a reply to a clarification request as non-final when it covers only the clarified point, or
  • have the tutor tell the learner to send the full corrected explanation in one message.

Related

  • #2070 / #2103 (assessment refused as "teaching slice"). That bug made learners resend explanations several times, which is when this one shows up.

Environment

  • DeepTutor 1.7.0 (PyPI), Python 3.14, macOS
  • Checked against dev at 88d46c2 (2026-10-31): unchanged

brunadileo avatar Oct 31 '26 11:10 brunadileo

Two more cases from daily use that come from the same rule (only _learner_message is graded). #2261 covers the needs_clarification path, but not these two.

1. A final partial followed by the missing part. When the first answer is graded partial with final: true, the tutor asks for the missing piece. The learner adds it in the next message, and that message is graded alone, so it comes back partial again, this time missing what the first message had. In one session this happened three times in a row on the same objective, alternating between the two halves of the answer. Nothing was unlocked although the learner had covered every part across the messages. With #2261 applied this still happens, because nothing is kept as pending after a final grade.

2. Probe answers spread over several turns are never graded. In a probe on a concept objective, the learner gave a correct explanation over three messages (definition, then application to the case, then a correction of a wrong assumption by the tutor). The tutor discussed each message but never called mastery_assess. When the learner wrote "fine, that point is done, let's go to the next one", the tutor called mastery_defer_objective. The learner then asked why it was not passed. Since no single message contained the full explanation, the tutor had no way to grade it. It asked the learner to resend the explanation and at one point even claimed it could not see the earlier messages (it can, and admitted that after being challenged).

From the learner's side both cases feel like the tutor is ignoring correct answers. A way to assess an explanation that is spread over several messages in the same session (for example by passing the message IDs to mastery_assess, or by keeping a pending explanation per objective after a partial as well) would cover both. Until then, the tutor should at least tell the learner up front that only one message is graded, and ask for a summary in one message before it defers or grades.

Setup: DeepTutor 1.7.1 with #2261 applied, openai_codex binding (GPT-6.1 Terra), sessions in German.

BenjiAvH avatar Nov 01 '26 18:11 BenjiAvH

Fixed on local dev (92ce9a27f467ef11ee59a3bb0c84cc78b3204174). fix(mastery): retain explanations across failed assessment attempts. Failed assessments preserve the learner explanation without a grade; retries do not append twice. Existing clarification and partial-grade accumulation remains. For earlier discussion never submitted for grading, the tutor now requests a consolidated explanation rather than claiming history is invisible. Targeted Python suite: 323 passed, 1 skipped.

will be fixed in the next releases!

pancacake avatar Nov 14 '26 17:11 pancacake