mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:49:26 +08:00
Four defects this month were the same failure: a step asks a model for a whole payload in one shot, the model spends its whole max_tokens on hidden thinking, and the provider returns a truncated body or none at all — with no error. Book's spine collapsed to a single "Overview" chapter (#1316), the quiz plan emitted zero templates (#1318), the non-streaming path handed the scratchpad back as the answer (#1352). Each fix grew its own retry. Book got `book/json_retry.py`; question got `LabeledStepResult.reasoning_only`; research got nothing, so its decompose step still degraded a topic to one sub-topic in silence, and its report outline still lost the whole report structure. Moves the rule out of `book/` — it was never Book's — into `services/llm/structured_retry.py`, and points it at the streaming-side detector so the two halves read as one rule: two ways to notice a budget spent on hidden tokens, one remedy, which is to ask again with thinking turned down. Applies it to research's two one-shot payloads, which needed the step wrapper to accept a per-call reasoning effort the way question's already did. The generic entry point takes the caller's own `is_usable` rather than imposing the object shape. Research's decompose accepts a bare array of sub-topics; judging that unusable would have retried a good answer and then discarded it — a regression the object-shaped helper would have caused as the only entry point. The object form still guarantees a dict, because its callers index the result directly. 6902 passed, 24 skipped.