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
[BUG] Subtask does sometimes not return to main task #2677
Describe the bug
I don't know if that is a regression from #566 or a new issue. But sometimes a sub-agent does not return to the orchestrator. It writes its final response which usually gets then copied over to the orchestrator, but it just stops there. I then have to manually copy that response, go back to the parent task and paste it there with a comment from where it comes. It usually works but sometimes I just forget about it and keep chatting with the sub-agent for a while until I realize I should have returned to the orchestrator a while ago. And then everything is out of sync and it gets complicated.
I even tried to explain to the sub-agent that he should give back his task to the parent task but then it usually just repeats the final answer and stops again, without returning. Maybe it would be a good idea to add a button that does exactly what the subagent should do. So basically summarize everything that was done and return to the orchestrator.
To Reproduce
There is no deterministic way to reproduce that behavior.
Expected behavior
When a subagent wrote his final answer it should always pass the ball back to the orchestrator.
Screenshots
Add screenshots if they help.
Does not help.
Video
Add a video of the bug. A video helps us find the cause.
Doesn't help either.
What version of zoo are you running
3.98.0
Additional context
I use ZooCode with DeepSeek in VSCodium on CachyOS.
Triage + fix attempt (spec-driven, per the repo's TLA+ policy): PR #2856.
Root cause. The handoff can be skipped exactly once by any guarded exit of the delegation branch in AttemptCompletionTool.execute (a transient reopenParentFromDelegation failure, a history-read throw, a parent-gate mismatch, or a swallowed AskIgnoredError). The tool then falls through to the plain completion_result ask. When the user clicks yes there, the provider's onTaskCompleted listener recorded the child completed unconditionally — while the parent was still delegated with awaitingChildId === child.id. The lifecycle machine (completeDelegatedChild) never ran, so the parent was never reopened, and from then on the stale-replay guard read completed and skipped delegation on every retry. That is the "repeats the final answer and stops again" part of this report: the first skip is transient, but the recorded status makes every later return attempt impossible.
Fix. The yes button of a still-awaited subtask's completion ask now re-attempts the handoff, and the TaskCompleted listener no longer records a still-awaited child completed (only completeDelegatedChild may, and it frees the parent in the same atomic step).
Spec. New module docs/architecture/tla/SubtaskReturn.tla; invariant NoPoisonedCompletion (no child recorded completed while its parent still awaits it). TLC: SubtaskReturn.cfg pass (3 states); SubtaskReturn.Poison.cfg (pre-fix behavior) fails exactly that invariant (4 states) — the model-level reproduction.
Tests. Red-verified on the unfixed code (9 failing across the three touched specs, including the real listener behavior); sabotage-verified after the fix; full test:core (5328) and test:api (6417, node 22.23.4) green; tsc, eslint, prettier clean.
Activity
mikomausebaer-ux commentedon Nov 30, 2026
danke
gh311 commentedon Dec 5, 2026
Triage + fix attempt (spec-driven, per the repo's TLA+ policy): PR #2856.
Root cause. The handoff can be skipped exactly once by any guarded exit of the delegation branch in
AttemptCompletionTool.execute(a transientreopenParentFromDelegationfailure, a history-read throw, a parent-gate mismatch, or a swallowedAskIgnoredError). The tool then falls through to the plaincompletion_resultask. When the user clicks yes there, the provider'sonTaskCompletedlistener recorded the childcompletedunconditionally — while the parent was stilldelegatedwithawaitingChildId === child.id. The lifecycle machine (completeDelegatedChild) never ran, so the parent was never reopened, and from then on the stale-replay guard readcompletedand skipped delegation on every retry. That is the "repeats the final answer and stops again" part of this report: the first skip is transient, but the recorded status makes every later return attempt impossible.Fix. The yes button of a still-awaited subtask's completion ask now re-attempts the handoff, and the
TaskCompletedlistener no longer records a still-awaited child completed (onlycompleteDelegatedChildmay, and it frees the parent in the same atomic step).Spec. New module
docs/architecture/tla/SubtaskReturn.tla; invariantNoPoisonedCompletion(no child recordedcompletedwhile its parent still awaits it). TLC:SubtaskReturn.cfgpass (3 states);SubtaskReturn.Poison.cfg(pre-fix behavior) fails exactly that invariant (4 states) — the model-level reproduction.Tests. Red-verified on the unfixed code (9 failing across the three touched specs, including the real listener behavior); sabotage-verified after the fix; full
test:core(5328) andtest:api(6417, node 22.23.4) green; tsc, eslint, prettier clean.