You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sub-agent errors and un-yielded completions are silently dropped without injecting results into parent context #742
When delegating tasks to sub-agents in the agent loop:
Silent Error Swallowing: If a sub-agent encounters an exception (e.g. model API error, rate limit, invalid tool parameters), the error is never reported back to the parent agent. The parent receives no output and may hang or stall waiting for results.
In cecli/helpers/agents/service.py, _run_generate() calls await self._inject_sub_agent_result(info) inside the except Exception as exc: block before setting info.status = SubAgentStatus.ERROR and info.error = str(exc).
_inject_sub_agent_result(info) checks if info.status == SubAgentStatus.ERROR: ... elif info.status == SubAgentStatus.FINISHED: ... else: return. Because info.status is still RUNNING, it returns immediately and drops the error completely.
Missing Output on Normal Completion without Yield: If a sub-agent completes its turns by replying with assistant text or writing files without explicitly invoking Yield(summary="..."):
_inject_sub_agent_result(info) is also called while info.status is still RUNNING, dropping the output.
When info.status is subsequently updated to FINISHED, _inject_sub_agent_result is not re-invoked, and info.summary defaults to "Task completed" without extracting the actual response generated by the worker.
Task Gather Crash in wait(): In AgentService.wait(), await asyncio.gather(*tasks) does not specify return_exceptions=True. An exception in one sub-agent causes wait() to fail immediately instead of returning summaries and statuses.
Model Token Leaks in File Paths on Windows: When local or open-weights models leak tool delimiter tokens into arguments (e.g., doc/test.md}<tool_call|><|channel>...), file resolution fails on Windows with OSError: [Errno 22] Invalid argument.
Proposed Solution
Fix Result Injection Lifecycle:
In cecli/helpers/agents/service.py (_run_generate), update info.status and info.error / info.summarybefore calling await self._inject_sub_agent_result(info).
Add info.result_injected guard to guarantee results/errors are injected exactly once.
Fallback Summary Extraction:
Implement _extract_sub_agent_summary(info) to extract the sub-agent's last assistant reply from its conversation if no explicit summary was passed via Yield.
Resilient wait():
Pass return_exceptions=True to asyncio.gather(*tasks) in AgentService.wait().
Path Sanitization:
Add sanitize_file_path() in cecli/tools/utils/helpers.py to strip enclosing quotes and trim hallucinated tool tokens (}<tool_call, <|tool_call, <|channel, </tool_call>) before resolving paths.
Activity