Fix: no emitir deltas del planner/reviewer al frontend

El planner genera JSON interno que no debe mostrarse al usuario.
Solo coder y collector emiten AGENT_DELTA al stream.

Para direct_response, el engine emite como agent=coder para que
el ClaudeFormatEmitter lo procese correctamente.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jordan Diaz
2026-04-03 20:53:00 +00:00
parent 56c8a9c066
commit 151596a52d
2 changed files with 13 additions and 10 deletions

View File

@@ -96,15 +96,18 @@ class BaseAgent:
):
if chunk.delta:
full_text += chunk.delta
await self.sse.emit(
EventType.AGENT_DELTA,
{
"agent": self.profile.role,
"delta": chunk.delta,
"step": step,
},
session_id=session.session_id,
)
# Only emit deltas for user-facing agents (coder, collector)
# Planner/reviewer output is internal
if self.profile.role not in ("planner", "reviewer"):
await self.sse.emit(
EventType.AGENT_DELTA,
{
"agent": self.profile.role,
"delta": chunk.delta,
"step": step,
},
session_id=session.session_id,
)
if chunk.tool_name and chunk.tool_call_id:
if chunk.tool_call_id not in active_tools:

View File

@@ -129,7 +129,7 @@ class OrchestratorEngine:
# Emit as text streaming for the frontend
await self.sse.emit(
EventType.AGENT_DELTA,
{"agent": "planner", "delta": plan_result, "step": 0},
{"agent": "coder", "delta": plan_result, "step": 0},
session_id=session.session_id,
)