Self-hosted AI workspace.
Python
fix: drop thinking deltas from background agent loops
adabarbulescub534d1977ad4
diff --git a/src/bg_monitor.py b/src/bg_monitor.pyindex d732771a6..8cf8ccc15 100644--- a/src/bg_monitor.py+++ b/src/bg_monitor.py@@ -55,6 +55,8 @@ async def _drain_agent(sess, messages):if "delta" in d:delta = d.get("delta")if isinstance(delta, str):+ if d.get("thinking"):+ continuefull += deltaelif d.get("type") == "agent_step":round_num = d.get("round", round_num)diff --git a/src/task_scheduler.py b/src/task_scheduler.pyindex 4b71ff8f6..881c06240 100644--- a/src/task_scheduler.py+++ b/src/task_scheduler.py@@ -1649,6 +1649,8 @@ class TaskScheduler:data = json.loads(event_str[6:])# Capture text from all event types, not just deltaif "delta" in data:+ if data.get("thinking"):+ continuefull_text += data["delta"]elif data.get("type") == "tool_output":# Tool results — capture summary so we have SOMETHING evendiff --git a/src/teacher_escalation.py b/src/teacher_escalation.pyindex 94d9ee81c..29dabd076 100644--- a/src/teacher_escalation.py+++ b/src/teacher_escalation.py@@ -594,6 +594,8 @@ async def run_teacher_inline("exit_code": payload.get("exit_code"),})if "delta" in payload and isinstance(payload["delta"], str):+ if payload.get("thinking"):+ continuecaptured_text_parts.append(payload["delta"])yield 'data: ' + json.dumps(payload) + '\n\n'continuediff --git a/tests/test_document_editor_scroll.py b/tests/test_document_editor_scroll.pyindex b556252f3..89cbc7b81 100644--- a/tests/test_document_editor_scroll.py+++ b/tests/test_document_editor_scroll.py@@ -12,8 +12,8 @@ from pathlib import PathROOT = Path(__file__).resolve().parents[1]-DOC_JS = (ROOT / "static/js/document.js").read_text()-STYLE_CSS = (ROOT / "static/style.css").read_text()+DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")+STYLE_CSS = (ROOT / "static/style.css").read_text(encoding="utf-8")def test_document_textarea_scrollbar_is_visible():