Skip to content

[Bug]: Delegated threads from one parent session share a single provider event log #29744

Closed

Description

@onlydole

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

  1. From one parent thread, have the agent start several delegated tasks with delegate_task.
  2. Let each child run a turn, ideally with different providers (for example, one Claude child and one Codex child).
  3. Open <T3 home>/userdata/logs/provider/ and look for the events.<thread segment>.log files of those children.

The filename comes from resolveThreadSegment in apps/server/src/provider/EventNdjsonLogger.ts, which calls toSafeThreadAttachmentSegment in apps/server/src/attachmentStore.ts. That function cuts the sanitized thread ID to ATTACHMENT_ID_THREAD_SEGMENT_MAX_CHARS (80) characters. Delegated thread IDs start with a long shared prefix, thread:delegated-task:command%3Amcp%3A<parent provider session id>%3Adelegate-task%3A..., so the cut lands before the part that differs between children:

thread:delegated-task:command%3Amcp%3A00000000-0000-4000-8000-000000000000%3Adelegate-task%3Areview-the-diff
thread:delegated-task:command%3Amcp%3A00000000-0000-4000-8000-000000000000%3Adelegate-task%3Awrite-the-tests

Both map to thread-delegated-task-command-3amcp-3a00000000-0000-4000-8000-000000000000-3adel, so both write to the same file.

Expected behavior

Each thread writes to its own provider event log file. Threads whose IDs fit in the current segment keep their current filenames.

Actual behavior

Delegated threads started by the same parent session share one log file, and their events are interleaved in it. One install had 28 delegated threads spread over only 7 log files. One file held 15 threads. Another held 7 threads and mixed 1,052 Claude lines with 1,444 Codex lines. You cannot tell which child wrote a given line without parsing every record, so the logs are not usable for debugging delegated work.

Impact

Minor bug or occasional failure

Version or commit

main @ 5b9731c

Environment

Any OS. Reproduces with delegated Claude and Codex children.

Workaround

None known.

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