Skip to content

[codex] fix mastery choice persistence and grading#604

Merged
pancacake merged 1 commit into
HKUDS:devfrom
spring618:codex/fix-mastery-choice-persistence
Jun 30, 2026
Merged

[codex] fix mastery choice persistence and grading#604
pancacake merged 1 commit into
HKUDS:devfrom
spring618:codex/fix-mastery-choice-persistence

Conversation

@spring618

Copy link
Copy Markdown

Summary

  • require Guided Learning choice quizzes to register complete option bodies
  • normalize textual or prefixed expected answers to stable option labels before grading
  • recover option descriptions from matching legacy ask_user turn events when possible
  • persist normalized choice data to the Question Bank and add regression coverage
  • update English and Chinese mastery prompts to describe the option contract explicitly

Root cause

mastery_quiz previously described its options argument as choice labels, so
the model could register only ["A", "B", "C", "D"] while ask_user held the
actual descriptions. The Question Bank then persisted the label-only array.

The same boundary also allowed expected_answer values such as Step 6, while
the interactive card returned C. Deterministic grading compared those values
directly and marked a correct selection as wrong.

User impact

Choice questions now retain the same full option text shown to learners, and
correct card selections are graded against normalized labels. Bare label-only
registrations fail fast so the agent can retry with complete data.

Validation

  • ruff check deeptutor/capabilities/mastery/tools.py deeptutor/learning/tests/test_mastery_tools.py
  • ruff format --check deeptutor/capabilities/mastery/tools.py deeptutor/learning/tests/test_mastery_tools.py
  • python -m pytest -q deeptutor/learning/tests/test_mastery_tools.py (16 passed)
  • manual Docker smoke test for full option persistence and Step 6C normalization
  • browser verification of Question Bank rendering and Wrong Only filtering

Fixes #603

@spring618
spring618 marked this pull request as ready for review June 30, 2026 13:00
@pancacake
pancacake changed the base branch from main to dev June 30, 2026 13:37
@pancacake
pancacake merged commit 0bbd466 into HKUDS:dev Jun 30, 2026
@pancacake

Copy link
Copy Markdown
Collaborator

Thanks for your contribution! btw, try to submit pr towards dev branch instead of main next time :)

vaskoyudha added a commit to vaskoyudha/deeptutor-for-programmer-fork that referenced this pull request Jul 25, 2026
…persistence

[codex] fix mastery choice persistence and grading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Guided Learning choice options are lost and correct answers may be graded incorrectly

3 participants