From bcfd5fb1a54f1aef0a5f45df9495e345ee57d5dc Mon Sep 17 00:00:00 2001 From: ttbombadil Date: Sat, 5 Dec 2026 18:20:37 +0100 Subject: [PATCH] fix(tutor): continue LEARN in the next Concept when a weak answer leaves no fresh question Co-Authored-By: Claude Sonnet 5.5 --- docs/OPEN_POINTS.md | 1 - .../tutor/curriculum/learning-planner.ts | 19 +++++++++++++++++-- ...t_function_definition_LearningQuestions.md | 1 + .../tutor/session-question-repetition.test.ts | 6 ++++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/OPEN_POINTS.md b/docs/OPEN_POINTS.md index 2fd5a53866..8fd21b9a02 100644 --- a/docs/OPEN_POINTS.md +++ b/docs/OPEN_POINTS.md @@ -28,7 +28,6 @@ Statuswerte: `BLOCKED_DECISION` (wartet auf eine Entscheidung) · `DEFERRED` | ID | Befund | Risiko | Beleg | Status | Nötige Entscheidung | |---|---|---|---|---|---| | T3 | Vom Client gesendete `answerRating`-Werte zählen als Mastery-Evidenz, solange für die Frage keine gespeicherte Evidenz existiert. Wirkt nur auf den eigenen Lernstand, widerspricht aber der deterministischen Mastery aus ADR 0007. | gering | [curriculum-tutor-adapter.ts:493-515](../server/services/tutor/curriculum-tutor-adapter.ts#L493-L515), [learning-planner.ts:193-200](../server/services/tutor/curriculum/learning-planner.ts#L193-L200) | BLOCKED_DECISION | Dürfen Client-Ratings Mastery beeinflussen? | -| D1 | LEARN nach schwacher oder mittlerer Antwort, wenn das aktuelle Concept keine frische Frage mehr hat, das Topic aber noch andere Fragen bietet. Die SSOT regelt nur den Fall, dass das ganze Topic nicht mehr abfragbar ist (`content-exhausted`). | gering | [LearningQuestions §Zustandsübergänge](../ssot/ssot_function_definition_LearningQuestions.md) | BLOCKED_DECISION | Gewünschtes Tutor-Verhalten festlegen, dann SSOT ergänzen | | D4 | Tutor-Sessions laufen nach einer absoluten TTL ab (Default 1 h, per `TUTOR_SESSION_TTL_MS` einstellbar), auch bei laufender Nutzung. | gering | [config.ts:412](../server/config.ts#L412), [course-content-session.ts:107](../server/services/course-content/course-content-session.ts#L107) | BLOCKED_DECISION | Absolute oder gleitende TTL? | | D5 | Nur Host-Mock (Browser-Läufe belegen keinen Server-Slot): Ein laufender Sketch hält seinen Simulationsslot bis zum Lauf-Timeout (Default 60 s, Client-Maximum 300 s). Pausierte Läufe enden nach `SIMULATION_MAX_PAUSED_SECONDS` (600 s), jeder Container nach `SANDBOX_MAX_LIFETIME_SECONDS` (2 h). Einen Inaktivitäts-Timeout für laufende Simulationen gibt es nicht. | gering | [input-limits.ts:40-42](../shared/input-limits.ts#L40-L42), [config.ts:246-247](../server/config.ts#L246-L247) | BLOCKED_DECISION | Reichen die vorhandenen Grenzen, oder soll eine Simulation ohne Nutzerinteraktion früher enden? | | HOSTMOCK-REMOVAL | Der Host-Mock bleibt nach ADR 0009 (E9) als Rückfallebene neben der Browser-Emulation; zwei Laufzeiten bedeuten doppelte Wartung (Runner-Pool, Laufzeit-Sandbox, WebSocket-Simulation, Mock-Tests). | gering | [ARCHITECTURE.md, Host-Mock als Rückfallebene](ARCHITECTURE.md#host-mock-als-rückfallebene) | DEFERRED | Nach `v2.0.0` und einem Semester ohne Rückfall: eigene ADR über den Abbau nach den dort festgeschriebenen Kriterien und Umfang | diff --git a/server/services/tutor/curriculum/learning-planner.ts b/server/services/tutor/curriculum/learning-planner.ts index 6d7857a06c..de9fe4c351 100644 --- a/server/services/tutor/curriculum/learning-planner.ts +++ b/server/services/tutor/curriculum/learning-planner.ts @@ -282,7 +282,8 @@ function selectRemediation(context: RatingSelectionContext): { concept: Curricul const target = topic.concepts.find(({ id }) => id === scaffoldQuestion.concept); if (target) return { concept: target, question: scaffoldQuestion, scaffold }; } - return chooseQuestionInConcept(topic, facts, concept, currentQuestion, usedQuestionIds, difficulty, context.strategy); + return chooseQuestionInConcept(topic, facts, concept, currentQuestion, usedQuestionIds, difficulty, context.strategy) + ?? selectOtherConceptQuestion(context); } function selectClarification(context: RatingSelectionContext): { concept: CurriculumConcept; question: CurriculumQuestion } | null { @@ -290,7 +291,21 @@ function selectClarification(context: RatingSelectionContext): { concept: Curric const indicatorQuestion = strategy?.clarification === "new-indicator" ? topic.questions.find((question) => question.concept === concept.id && question.indicator !== currentQuestion.indicator && questionApplies(question, facts) && !usedQuestionIds.has(question.id)) : topic.questions.find((question) => question.concept === concept.id && question.indicator === currentQuestion.indicator && questionApplies(question, facts) && !usedQuestionIds.has(question.id)); - return indicatorQuestion ? { concept, question: indicatorQuestion } : chooseQuestionInConcept(topic, facts, concept, currentQuestion, usedQuestionIds, difficulty, strategy); + return indicatorQuestion + ? { concept, question: indicatorQuestion } + : chooseQuestionInConcept(topic, facts, concept, currentQuestion, usedQuestionIds, difficulty, strategy) ?? selectOtherConceptQuestion(context); +} + +/** + * A weak or medium answer in a Concept that has no fresh question left must not end LEARN while the Topic + * still offers questions (LearningQuestions SSOT, LEARN transitions): the next unmastered Concept whose + * prerequisites are mastered continues the dialog. The weak Concept stays unmastered and can be asked again later. + */ +function selectOtherConceptQuestion(context: RatingSelectionContext): { concept: CurriculumConcept; question: CurriculumQuestion } | null { + const { topic, facts, concept, observations, usedQuestionIds, difficulty, strategy } = context; + const nextConcept = selectNextConcept(topic, facts, observations, usedQuestionIds, concept.id, strategy); + const question = nextConcept ? selectQuestion(topic, nextConcept, facts, usedQuestionIds, difficulty, undefined, strategy) : null; + return nextConcept && question ? { concept: nextConcept, question } : null; } function selectAdvance(context: RatingSelectionContext): { concept: CurriculumConcept; question: CurriculumQuestion } | null { diff --git a/ssot/ssot_function_definition_LearningQuestions.md b/ssot/ssot_function_definition_LearningQuestions.md index f383303f50..18e2483431 100644 --- a/ssot/ssot_function_definition_LearningQuestions.md +++ b/ssot/ssot_function_definition_LearningQuestions.md @@ -586,6 +586,7 @@ without formal Topic mastery claims. | Current phase | Condition | Next phase | Active Topic | Strategy behavior | |---|---|---|---|---| | LEARN | Topic mastery criteria not all true | LEARN | unchanged Topic | LEARN precedence | +| LEARN | Weak or medium answer, the current Concept has no fresh question left, another unmastered Concept of the Topic with mastered prerequisites has one | LEARN | unchanged Topic | next such Concept in Topic order; the weak Concept stays unmastered and is not marked as exhausted | | LEARN | Topic A mastered; applicable unmastered Topic B exists | LEARN | highest-precedence unmastered Topic | acquisition precedence; mastered Topics skipped | | LEARN | No probeable unmastered Topic, but unresolved unmastered Topic remains | LEARN (blocked) | highest-precedence unresolved Topic | `progressionBlockedReason: content-exhausted`; bounded free fallback only | | LEARN | All relevant acquisition Topics mastered or no longer fact-applicable; no unresolved blocker | DEEPEN | same mastered Topic | post-mastery resolution begins | diff --git a/tests/server/services/tutor/session-question-repetition.test.ts b/tests/server/services/tutor/session-question-repetition.test.ts index c9478d97ec..a64c4aea9b 100644 --- a/tests/server/services/tutor/session-question-repetition.test.ts +++ b/tests/server/services/tutor/session-question-repetition.test.ts @@ -221,11 +221,13 @@ describe("relaxed repetition keeps its normative revisit", () => { expect(new Set(ids.slice(0, firstRepeat))).toEqual(new Set(valuesQuestions)); }); - it("strict never revisits once the weak learner has used every question of the Concept", async () => { + it("strict never revisits; a weak learner who used every question of the Concept moves on to the next Concept (D1)", async () => { const { served } = await runSession({ turns: 5, window: 0, rating: () => 1 }); const ids = plannedIds(served); expect(duplicates(ids)).toEqual([]); - expect(new Set(ids)).toEqual(new Set(["values-application", "values-concept", "values-prediction"])); + expect(ids.slice(0, 3).sort()).toEqual(["values-application", "values-concept", "values-prediction"]); + expect(ids.slice(3).every((id) => id.startsWith("output-"))).toBe(true); + expect(ids.length).toBeGreaterThan(3); }); });