fix: keep ACP stdout protocol-clean
Route AIAgent print output to stderr via _print_fn for ACP stdio sessions. Gate quiet-mode spinner startup on _should_start_quiet_spinner() so JSON-RPC on stdout isn't corrupted. Child agents inherit the redirect. Co-authored-by: Git-on-my-level <Git-on-my-level@users.noreply.github.com>
This commit is contained in:
@@ -197,6 +197,18 @@ def _build_child_agent(
|
||||
# total iterations across parent + subagents can exceed the parent's
|
||||
# max_iterations. The user controls the per-subagent cap in config.yaml.
|
||||
|
||||
child_thinking_cb = None
|
||||
if child_progress_cb:
|
||||
def _child_thinking(text: str) -> None:
|
||||
if not text:
|
||||
return
|
||||
try:
|
||||
child_progress_cb("_thinking", text)
|
||||
except Exception as e:
|
||||
logger.debug("Child thinking callback relay failed: %s", e)
|
||||
|
||||
child_thinking_cb = _child_thinking
|
||||
|
||||
# Resolve effective credentials: config override > parent inherit
|
||||
effective_model = model or parent_agent.model
|
||||
effective_provider = override_provider or getattr(parent_agent, "provider", None)
|
||||
@@ -226,6 +238,7 @@ def _build_child_agent(
|
||||
skip_context_files=True,
|
||||
skip_memory=True,
|
||||
clarify_callback=None,
|
||||
thinking_callback=child_thinking_cb,
|
||||
session_db=getattr(parent_agent, '_session_db', None),
|
||||
providers_allowed=parent_agent.providers_allowed,
|
||||
providers_ignored=parent_agent.providers_ignored,
|
||||
@@ -234,6 +247,7 @@ def _build_child_agent(
|
||||
tool_progress_callback=child_progress_cb,
|
||||
iteration_budget=None, # fresh budget per subagent
|
||||
)
|
||||
child._print_fn = getattr(parent_agent, '_print_fn', None)
|
||||
# Set delegation depth so children can't spawn grandchildren
|
||||
child._delegate_depth = getattr(parent_agent, '_delegate_depth', 0) + 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user