mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 12:10:15 +08:00
Course Study turns were ending on "I could not produce a useful response from the model output", with the real recommendation sitting collapsed in the trace above it — and, in one observed turn, written out three times. The loop treats prose emitted alongside a tool call as a preamble: it is streamed into the trace, and the answer is whatever a later tool-less round says. That is right for tools that fetch something. It is wrong for this playbook, which asks for the opposite shape — recommend the next action, say why it is timely, then call `course_handoff`. The recommendation and the call are one thought, and models write them in one round. Dropped from the answer, the model had nothing new to add on the next round, so it called `course_handoff` again until the budget ran out and the turn finished empty. The partner-group capability documents the same failure for `invoke_other` and already carries the remedy: classify the tool round's prose, then end the turn on it. Course Study now implements both hooks. Two details worth keeping: `_capability_answer_published` is deliberately not set. It means "the learner has already seen this text, do not emit it again", which holds for capabilities that buffer output behind a protocol. This mode buffers nothing, so claiming it left the message body empty with the whole recommendation hidden a click away — the original symptom, differently caused. A bare `course_handoff` with nothing said is left alone rather than ending the turn: there is no answer to rescue, and the model still gets its ordinary finish round to write one. The flag was named `_partner_group_formal_answer_published` while living in the generic loop, which now has a second caller; renamed to match what it is.