镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Bug]: A parent is woken twice with the same delegated task result (after a restart cuts the delivery run, or when a follow-up repeats it) #32279

Open

Description

@royalaid

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

Case A, restart:

  1. A parent waits on delegate_task; the child completes; the delivery run starts on the parent and the agent reads the result, writes a reply and calls tools.
  2. Restart the server before that run finishes.
  3. After the restart, the same completion is delivered again.

Case B, repeated or unlabelled follow-up:

  1. A child returns its result, then runs again on its own (a background-command wake) and replies with the same text, or with a new text.
  2. The parent receives a second "Delegated task () [completed]" with no sign that it follows the first task.

Deterministic: in DelegatedCompletionDelivery.test.ts terms: (A) cut a delivery run that already wrote assistant output and finalize it; the task returns to pending and is re-sent. (B) start a child follow-up whose reply equals the last result; the parent gets a second delivery.

Expected behavior

A: a delivery the agent already answered counts as delivered, even if a restart cuts its run. A delivery run that started but wrote nothing is still re-offered, as #15323 intends.
B: a follow-up wake names the task it follows ("..., a follow-up of task after the child ran again"), and a follow-up the child started on its own whose reply repeats the last result is recorded (readable with task_status) without waking the parent. A follow-up started by a parent send or a user message always wakes.

Actual behavior

A: finalizeDelegatedCompletionDelivery returns every task of a cancelled delivery run to pending, so a restart that cut a run the agent had acted on sends the same completion again. B: the parent gets a second wake that looks identical to the first. Agents reacted with "This is the same review result again"; five parents saw a repeat between 24 Oct and 6 Nov.

Impact

Minor bug or occasional failure

Version or commit

0.1.8-nightly.20261106.4262 (c55db3e); code read at main 6577c6b, unchanged at 240446e.

Environment

macOS and Linux; Claude and Codex parents and children.

Logs or stack traces

None kept beyond the agents' replies; the deterministic cases fail on main.

Workaround

None; agents usually notice and ignore the repeat, at the cost of a turn.

Proposed fix (for the PR, once triaged)

A cut delivery run counts as delivered when it wrote answer items (assistant message, reasoning, tool calls). The follow-up wake label names the original task. A self-started follow-up whose reply equals the last result does not wake the parent. Follow-up command ids are deterministic so restart replays do not duplicate. Tests: "a delivery its run already answered is not sent again when the run is cut", "a restart that cuts an answered delivery does not send it again", "a follow-up wake names the task it follows", "a follow-up repeating the last result does not wake the parent" (fail on main); guards "a delivery cut before its run started is sent again once" and "a parent-sent repeat still wakes" pass on both.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions