DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
chore(ci): format dev baseline for ruff
XZH0cb0a269a79c
diff --git a/deeptutor/api/routers/sessions.py b/deeptutor/api/routers/sessions.pyindex 5de7f410e..13d9305f4 100644--- a/deeptutor/api/routers/sessions.py+++ b/deeptutor/api/routers/sessions.py@@ -114,6 +114,8 @@ async def list_sessions(MAX_EVENT_PAYLOAD = 1024 * 1024_TRUNCATION_NOTICE = "\n\n[... content truncated]"_TRUNCATABLE_EVENT_TYPES = ("tool_result", "observation")++def _redact_private_message_metadata(messages: list[dict[str, Any]]) -> None:"""Remove provider-only state before session details cross the API."""_redact_provider_state_metadata(messages)diff --git a/deeptutor/reading/references.py b/deeptutor/reading/references.pyindex 2fdbcb66a..b4052ca3e 100644--- a/deeptutor/reading/references.py+++ b/deeptutor/reading/references.py@@ -57,8 +57,7 @@ def normalize_reading_references(value: Any) -> list[dict[str, Any]]:key = (material_id, revision)target = by_reference.get(key)if target is None and (- material_id not in material_ids- and len(material_ids) >= MAX_READING_REFERENCE_MATERIALS+ material_id not in material_ids and len(material_ids) >= MAX_READING_REFERENCE_MATERIALS):continuefor candidate in locators:diff --git a/deeptutor/services/llm/provider_core/openai_compat_provider.py b/deeptutor/services/llm/provider_core/openai_compat_provider.pyindex cae235ebf..b0892a0a9 100644--- a/deeptutor/services/llm/provider_core/openai_compat_provider.py+++ b/deeptutor/services/llm/provider_core/openai_compat_provider.py@@ -307,9 +307,7 @@ class OpenAICompatProvider(LLMProvider):clean["_provider_response_state"] = {"responses_output_items": output_items}else:state = normalize_provider_response_state(message.get("_provider_response_state"))- reasoning_content = (- state.get("reasoning_content") if state is not None else None- )+ reasoning_content = state.get("reasoning_content") if state is not None else Noneif (isinstance(reasoning_content, str)and reasoning_contentdiff --git a/deeptutor/services/llm/provider_core/openai_responses/converters.py b/deeptutor/services/llm/provider_core/openai_responses/converters.pyindex 80152c126..71c17898a 100644--- a/deeptutor/services/llm/provider_core/openai_responses/converters.py+++ b/deeptutor/services/llm/provider_core/openai_responses/converters.py@@ -38,9 +38,7 @@ def convert_messages(messages: list[dict[str, Any]]) -> tuple[str, list[dict[str{"responses_output_items": msg.get("_responses_output_items")})state_items = (- legacy_state.get("responses_output_items")- if legacy_state is not None- else None+ legacy_state.get("responses_output_items") if legacy_state is not None else None)if isinstance(state_items, list) and state_items:input_items.extend(dict(item) for item in state_items if isinstance(item, dict))diff --git a/tests/reading/test_references.py b/tests/reading/test_references.pyindex 5dd025f3d..bd7da78c6 100644--- a/tests/reading/test_references.py+++ b/tests/reading/test_references.py@@ -21,9 +21,7 @@ def test_reference_normalization_rejects_paths_and_deduplicates_locators() -> No},{"material_id": "abcdef0123456789", "revision": 2, "locators": [4]},]- ) == [- {"material_id": "abcdef0123456789", "revision": 2, "locators": [2, 3, 4]}- ]+ ) == [{"material_id": "abcdef0123456789", "revision": 2, "locators": [2, 3, 4]}]def test_reference_normalization_bounds_the_total_unit_count() -> None:@@ -42,8 +40,7 @@ def test_reference_normalization_bounds_the_total_unit_count() -> None:def test_empty_rows_do_not_consume_the_material_limit() -> None:empty_rows = [- {"material_id": f"{index:016x}", "revision": 1, "locators": []}- for index in range(20)+ {"material_id": f"{index:016x}", "revision": 1, "locators": []} for index in range(20)]assert normalize_reading_references(@@ -118,8 +115,5 @@ def test_references_resolve_the_persisted_revision_not_current_content(tmp_path:def test_references_fail_closed_without_a_content_revision() -> None:assert (- normalize_reading_references(- [{"material_id": "abcdef0123456789", "locators": [1]}]- )- == []+ normalize_reading_references([{"material_id": "abcdef0123456789", "locators": [1]}]) == [])diff --git a/tests/reading/test_turn_wiring.py b/tests/reading/test_turn_wiring.pyindex 5a9bc1cb8..9825cd556 100644--- a/tests/reading/test_turn_wiring.py+++ b/tests/reading/test_turn_wiring.py@@ -105,9 +105,7 @@ def test_explicit_reading_references_are_normalized_at_the_turn_boundary() -> No},{"material_id": "../../etc", "revision": 1, "locators": [1]},]- ) == [- {"material_id": "abcdef0123456789", "revision": 4, "locators": [2, 3]}- ]+ ) == [{"material_id": "abcdef0123456789", "revision": 4, "locators": [2, 3]}]# ---------------------------------------------------------------------------@@ -226,9 +224,7 @@ def test_explicit_reading_references_are_persisted_for_retry() -> None:partner_group_references=[],question_notebook_references=[],book_references=[],- reading_references=[- {"material_id": "abcdef0123456789", "revision": 1, "locators": [1, 2]}- ],+ reading_references=[{"material_id": "abcdef0123456789", "revision": 1, "locators": [1, 2]}],persona="",memory_references=[],llm_selection=None,diff --git a/tests/services/search/test_web_search_runtime.py b/tests/services/search/test_web_search_runtime.pyindex 852e0372f..88ce50cd2 100644--- a/tests/services/search/test_web_search_runtime.py+++ b/tests/services/search/test_web_search_runtime.py@@ -40,9 +40,7 @@ def _patch_runtime()monkeypatch.setattr("deeptutor.services.search.load_system_settings",- lambda: {- "web_search_source_filtering": (config or {}).get("source_filtering", {})- },+ lambda: {"web_search_source_filtering": (config or {}).get("source_filtering", {})},)monkeypatch.setattr("deeptutor.services.search.resolve_search_runtime_config",diff --git a/tests/services/session/test_source_inventory.py b/tests/services/session/test_source_inventory.pyindex 61b21f05f..4eedafcd7 100644--- a/tests/services/session/test_source_inventory.py+++ b/tests/services/session/test_source_inventory.py@@ -464,9 +464,7 @@ async def test_build_inventory_adds_server_resolved_reading_units(],)- assert seen == [- {"material_id": "abcdef0123456789", "revision": 3, "locators": [2]}- ]+ assert seen == [{"material_id": "abcdef0123456789", "revision": 3, "locators": [2]}]assert inv.entries[0].sid == "rd-abcdef0123456789-r3-2"assert inv.entries[0].kind == "reading"assert inv.entries[0].fresh is True