Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(chat): integrate guarded output with ask questions

Bingxi Zhao (Frank)693772a54225
diff --git a/deeptutor/agents/chat/agent_loop.py b/deeptutor/agents/chat/agent_loop.py
index 5ed3c3917..71f57bb0d 100644
--- a/deeptutor/agents/chat/agent_loop.py
+++ b/deeptutor/agents/chat/agent_loop.py
@@ -315,9 +315,7 @@ class AgentLoop:
max_tokens=self.pipeline.loop_max_tokens,
tool_schemas=self.tool_schemas,
defer_visible_output=self.pipeline._has_capability_finish_guard(self.context),
- tool_choice=(
- self.pipeline.initial_tool_choice if state.rounds == 0 else None
- ),
+ tool_choice=(self.pipeline.initial_tool_choice if state.rounds == 0 else None),
)
except Exception as exc:
# A mid-loop LLM failure (timeout / transient network) must not
diff --git a/tests/capabilities/test_loop_registry.py b/tests/capabilities/test_loop_registry.py
index b9281fa41..81bbc0b3b 100644
--- a/tests/capabilities/test_loop_registry.py
+++ b/tests/capabilities/test_loop_registry.py
@@ -239,5 +239,6 @@ def test_capability_tool_owners_includes_external(monkeypatch) -> None:
owners = registry.capability_tool_owners()
assert owners["demo_tool"] == "demo_loop"
- builtin_tool = LOOP_CAPABILITIES[0].owned_tools[0]
- assert owners[builtin_tool] == LOOP_CAPABILITIES[0].name
+ builtin = next(cap for cap in LOOP_CAPABILITIES if cap.owned_tools)
+ builtin_tool = builtin.owned_tools[0]
+ assert owners[builtin_tool] == builtin.name
diff --git a/tests/services/session/test_sqlite_store.py b/tests/services/session/test_sqlite_store.py
index aeaa2e891..ddd4409b3 100644
--- a/tests/services/session/test_sqlite_store.py
+++ b/tests/services/session/test_sqlite_store.py
@@ -333,6 +333,8 @@ def test_delete_last_turn_leaves_prefix_intact(store: SQLiteSessionStore) -> Non
assert remaining[0]["parent_message_id"] is None
assert remaining[1]["parent_message_id"] == remaining[0]["id"]
assert remaining[1]["id"] == a1
+
+
# ── Context messages ──────────────────────────────────────────────