feat(core): emit SubagentProgress for child tool/turn milestones#36
Closed
ZhiXiao-Lin wants to merge 1 commit into
Closed
feat(core): emit SubagentProgress for child tool/turn milestones#36ZhiXiao-Lin wants to merge 1 commit into
ZhiXiao-Lin wants to merge 1 commit into
Conversation
The `SubagentProgress` event variant exists but until now was never sent —
the subagent task tracker introduced in the previous commit observed
Start and End but had no mid-task signal to update from.
Adds a `synthesize_subagent_progress()` helper called by the mpsc → broadcast
forwarder inside `TaskExecutor::execute_with_task_id`. It translates two
child-loop events into compact progress milestones on the parent broadcast:
- `ToolEnd` → `status = "tool_completed"`, metadata `{ tool, exit_code,
output_bytes, error_kind? }`
- `TurnEnd` → `status = "turn_completed"`, metadata `{ turn, total_tokens,
prompt_tokens, completion_tokens }`
Noisy events (TextDelta / ToolStart / ToolOutputDelta / nested Subagent*)
are intentionally not translated — consumers needing token-level detail
should subscribe to the raw event stream directly.
The original child events are still forwarded unchanged; progress is
additive, so downstream consumers see both the synthesized milestone
and the underlying event.
This was referenced May 23, 2026
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
SubagentProgressevent variant existed but was never emitted — the tracker from #35 had no mid-task signal to update from. This PR fills that gap so dashboards see meaningful intermediate state, not just Start → End.Adds
synthesize_subagent_progress()intools/task.rs, called by the mpsc → broadcast forwarder insideTaskExecutor::execute_with_task_id. It translates two child-loop events into compact progress milestones on the parent broadcast:ToolEnd→status = \"tool_completed\",metadata = { tool, exit_code, output_bytes, error_kind? }TurnEnd→status = \"turn_completed\",metadata = { turn, total_tokens, prompt_tokens, completion_tokens }Noisy events (TextDelta, ToolStart, ToolOutputDelta, nested Subagent*) are intentionally not translated — consumers needing token-level streaming should subscribe to the raw event stream.
The original child events are still forwarded unchanged; progress is additive.
What this unlocks
Test plan
synthesize_subagent_progresscover ToolEnd, ToolEnd with error_kind, TurnEnd, and the negative cases (TextDelta / ToolStart / TurnStart / nested SubagentStart).parallel_task_executor_emits_subagent_events_for_each_childto assert at least 2turn_completedprogress events arrive on the broadcast for a 2-task parallel run.subagent_progress_events_accumulate_in_trackerverifies progress events flow throughRuntimeEventSinkinto the tracker'sprogressVec.cargo test --lib -p a3s-code-core: 1656 passed / 0 failed (4 new).cargo test --tests -p a3s-code-core: all integration binaries green.cargo clippy --lib --tests -p a3s-code-core: no new warnings.cargo fmtclean.Out of scope (follow-ups)
subagentTask/subagentTasks/pendingSubagentTasks.runs/run_eventsfamily).JoinHandle+CancellationTokentracking).