DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix(research): resume ask_user replies from shared loop helpers (#1600)
Bingxi Zhao (Frank)9d3e7c310231
diff --git a/deeptutor/agents/research/pipeline.py b/deeptutor/agents/research/pipeline.pyindex bf348c87e..7527fdb38 100644--- a/deeptutor/agents/research/pipeline.py+++ b/deeptutor/agents/research/pipeline.py@@ -3105,7 +3105,7 @@ class _RephraseLoopHost:return outcomeasync def resolve_pause(self, dispatch: DispatchOutcome) -> bool:- from deeptutor.agents.chat.agentic_pipeline import (+ from deeptutor.agents.loop.pipeline import (_format_user_reply_body,_normalise_user_reply,)diff --git a/tests/agents/research/test_rephrase_loop_host.py b/tests/agents/research/test_rephrase_loop_host.pyindex 35eff9910..62f55f44f 100644--- a/tests/agents/research/test_rephrase_loop_host.py+++ b/tests/agents/research/test_rephrase_loop_host.py@@ -16,6 +16,7 @@ import pytestfrom deeptutor.agents.research.pipeline import ResearchPipeline, _RephraseLoopHostfrom deeptutor.core.context import UnifiedContext+from deeptutor.runtime.agentic import DispatchOutcomefrom deeptutor.runtime.stream_bus import StreamBus@@ -106,6 +107,31 @@ async def test_rephrase_round_cap_short_circuits_dispatch(assert host._rounds_used == 2+async def test_rephrase_pause_resumes_with_user_answers(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """A displayed ask_user card must consume its reply before decomposition."""+ pipeline = _make_pipeline(monkeypatch)+ host = _make_host(pipeline)++ async def reply() -> dict:+ return {"answers": [{"questionId": "scope", "text": "Graph theory"}]}++ host._context.runtime.wait_for_user_reply = reply+ dispatch = DispatchOutcome(+ pause=True,+ pause_payload={"ask_user": {"questions": [{"id": "scope", "prompt": "Which subject?"}]}},+ pause_tool_call_id="ask-1",+ tool_messages=[{"role": "tool", "tool_call_id": "ask-1", "content": ""}],+ )++ assert await host.resolve_pause(dispatch) is True+ assert "Which subject?" in dispatch.tool_messages[0]["content"]+ assert "Graph theory" in dispatch.tool_messages[0]["content"]+ assert any(event.metadata.get("ask_user_resolved") for event in host._stream._history)++@pytest.mark.asyncioasync def test_rephrase_force_finalize_returns_empty_text(monkeypatch: pytest.MonkeyPatch,