mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-17 09:51:35 +00:00
fix: foreground sub-agent loses its partial output at the tool-call limit (#33269)
When a foreground sub-agent stopped at the tool-call limit, the parent model got only the error, so everything the sub-agent had written before the limit was lost, while a background sub-agent in the same state reported it as partial output. A foreground sub-agent now returns the error followed by its partial output, the same way the background report does. The error in both modes is now the plain message, such as "Tool-call limit reached (30 iterations).", instead of raw internal data around it. Fixes #33267
This commit is contained in:
parent
1c572c49bc
commit
e77204559b
1 changed files with 6 additions and 1 deletions
|
|
@ -526,6 +526,8 @@ async def delegate(
|
|||
if len(summary) > max_output:
|
||||
summary = f'{summary[:max_output]}\n\n[output truncated]'
|
||||
error = message.get('error')
|
||||
if isinstance(error, dict):
|
||||
error = error.get('content') or 'Sub-agent failed.'
|
||||
return {
|
||||
'status': 'error' if error else 'completed',
|
||||
'summary': summary or ('Sub-agent produced no output.' if not error else ''),
|
||||
|
|
@ -713,5 +715,8 @@ async def delegate(
|
|||
return f'Error: {exc}'
|
||||
|
||||
if result.get('status') != 'completed':
|
||||
return f'Error: {result.get("error") or "sub-agent failed."}'
|
||||
error_text = f'Error: {result.get("error") or "sub-agent failed."}'
|
||||
if result.get('summary'):
|
||||
return f'{error_text}\nPartial output:\n{result["summary"]}'
|
||||
return error_text
|
||||
return result.get('summary') or 'Sub-agent produced no output.'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue