prepare_lesson tells the model to pick at most MAX_LESSON_PAGES pages, but
models regularly return more (a free reasoning model did so in most runs on a
real course). The whole preparation then failed with "Invalid source selection
count: too many distinct physical pages", and the tutor retried it in a loop.
Keep the model's ranked picks within the cap and drop context-only neighbour
pages first. The lesson stays bounded; every kept page is still inspected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>