diff --git a/ai-hub/app/core/orchestration/stream.py b/ai-hub/app/core/orchestration/stream.py index 22cc1d1..48d4db7 100644 --- a/ai-hub/app/core/orchestration/stream.py +++ b/ai-hub/app/core/orchestration/stream.py @@ -53,15 +53,22 @@ if len(self.prefix_buffer) > 200: async for event in self._flush_prefix("", turn_header): yield event - else: + strategy_text = self.tag_buffer + # Update: If this is the start of a turn, always emit header to reasoning first if not self.header_sent: self.header_sent = True yield {"type": "reasoning", "content": turn_header} - strategy_part = self._apply_turn_header(self.tag_buffer) - if strategy_part: - yield {"type": "content", "content": strategy_part} self.tag_buffer = "" + strip_boilerplate = r"(?i)Strategy: Executing orchestrated tasks in progress\.*" + + # Separate boilerplate strategy from real content + if re.fullmatch(rf"\s*{strip_boilerplate}\s*", strategy_text): + yield {"type": "reasoning", "content": strategy_text} + else: + processed = self._apply_turn_header(strategy_text) + if processed: + yield {"type": "content", "content": processed} else: # Inside thinking tag @@ -110,6 +117,7 @@ strip_patterns = [ r"(?i)^.*\[Turn\s*\d+\].*$", r"(?i)Turn\s*\d+:\s*architecting\s*next\s*step\.*", + r"(?i)Strategy: Executing orchestrated tasks in progress\.*", r"(?i)🏗️\s*BRIDGE\s*ANALYSIS:?", r"(?i)Analysis: ", r"(?i)---"