The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge remote-tracking branch 'origin/main' into fix/async-batch-task-failure-notice
Tekniumd0090a147c3c
diff --cc tools/delegate_tool_dispatch.pyindex e6f89170c20,8fe142ecbc2..5d41ba42b56--- a/tools/delegate_tool_dispatch.py+++ b/tools/delegate_tool_dispatch.py@@@ -125,28 -131,23 +131,33 @@@ def _run_children_parallel(batch: _Batcfor future in done:entry = _entry_of(future, futures[future])results.append(entry)- _report_child_done(parent_agent, spinner_ref, entry, _tag, task_labels, n_tasks, n_tasks - len(results))- if detached and entry.get("status") in SUBAGENT_FAILURE_STATUSES and len(results) < n_tasks:- # The parent is not watching a spinner: tell it NOW, not when the last sibling finishes.+ if not honor_parent_interrupt and batch.unit_id:+ # Detached unit: a crash before the join must not lose children that already finished.+ record_unit_child(batch.unit_id, entry)+ _report_child_done(parent_agent, spinner_ref, entry, _tag, task_labels, n_tasks, n_here - len(results))++ if (not honor_parent_interrupt and batch.unit_id and entry.get("status") in SUBAGENT_FAILURE_STATUSES++ and len(results) < n_here):++ # Detached unit, a sibling is still running: tell the parent NOW, not when the last one finishes.++ # Non-durable and separate from the unit's final result (which is still delivered once).+ with _quiet("task failure notice failed", exc_info=True):+ from tools.async_delegation import push_task_failure_notice+ _i = entry.get("task_index", -1)+ _live = batch.live_paths[_i] if isinstance(_i, int) and 0 <= _i < len(batch.live_paths) else None+ push_task_failure_notice(- batch.live_deleg_id, {**entry, **({"live_transcript": _live} if _live else {})}, n_tasks=n_tasks)++ batch.unit_id, {**entry, **({"live_transcript": _live} if _live else {})}, n_tasks=n_tasks)results.sort(key=lambda r: r["task_index"]) # match input order- def _execute_and_aggregate(batch: _Batch, *, honor_parent_interrupt: bool = True, detached: bool = False) -> dict:- """Run all built children, join, finalize (hooks + cost rollup), return the combined dict. Shared by the sync path- and the background runner: even in the background the batch JOINS on itself here so ONE consolidated results- block re-enters the conversation. Live transcripts are finalized but retained as the full-fidelity record- (retention pruning happens on future dispatches)."""+ def _execute_and_aggregate(batch: _Batch, *, honor_parent_interrupt: bool = True) -> dict:+ """Run the batch's built children, join, finalize (hooks + cost rollup), return the combined dict. Shared by the+ sync path and the background runner; a background runner receives a per-group unit (a subset of the call's+ children) so each group JOINS only on itself. Live transcripts are finalized but retained as the full-fidelity+ record (retention pruning happens on future dispatches)."""from tools.delegation_live_log import update_manifest_statusesresults: list = []- if len(batch.task_list) == 1:+ if len(batch.children) == 1:results.append(batch.run_child(*batch.children[0]))else:- _run_children_parallel(batch, results, honor_parent_interrupt=honor_parent_interrupt)+ _run_children_parallel(batch, results, honor_parent_interrupt=honor_parent_interrupt, detached=detached)_finalize_child_results(results, batch.task_list, batch.children, batch.parent_agent)total_duration = round(time.monotonic() - batch.overall_start, 2)