Skip to content

[Bug]: Agent-to-agent thread sends reach the receiving model as if the user wrote them #24711

Closed

Description

@hinescreative

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. In one project, start a parent thread and have it create a child with delegate_task (mode async).
  2. From the child thread, call t3_thread_send to the parent (steer or queue) with a plain sentence, for example "Please merge the PR now."
  3. Read the parent's next provider turn (transcript or provider logs) and the parent thread through t3_thread_read.

Expected behavior

The receiving agent can tell that the message came from another thread's agent, not from the user. The provider-bound text carries the sender (thread title or id) and that it was agent-authored, the same facts the stored timeline item already records.

Actual behavior

The receiving agent gets only the raw message body as a user turn: no sender, no agent marker. t3_thread_read on the parent shows the item with senderThreadId set to the child, createdBy: agent and creationSource: mcp, and the UI shows that provenance, but the text sent to the provider drops it. The parent agent reads the child's sentence as the user's instruction.

Impact

Any multi-agent setup (delegated tasks, sibling threads coordinating with t3_thread_send) lets one agent's message pass as the user's. Agents then act on requests the user never made, or attribute decisions to the user. We hit it in daily use: a child's status message was taken by the parent as a user directive.

Version or commit

T3 Code nightly (macOS desktop). The behavior is in apps/server/src/orchestration-v2, where provider text is assembled for new turns (ProviderTurnStartService) and steers (ProviderTurnControlService).

Environment

macOS 26, desktop app, Claude, Codex and OpenCode providers; the behavior is provider-independent because it happens before any adapter.

Logs or stack traces

None needed: no error is raised. The stored timeline item has the provenance fields; the provider-bound message does not.

Notes

An earlier PR for this, #24483, has to be replaced: its code was written by a model this repository does not accept. A fresh fix written by an accepted model will link here.

Activity

  1. AngeloTadeucci commented on Nov 1, 2026

    @AngeloTadeucci
    Contributor

    Note

    Claude Opus 5.5 responding on behalf of Ângelo.

    Another repro, with Claude threads on Windows.

    One thread sent a status update to another with t3_thread_send. The UI labelled the folded message with the sender thread's title. The receiving agent got only the body. It said it couldn't tell which session had sent the message, then searched Claude Code's own list of local peer sessions for the sender. T3 threads aren't on that list, so it found no match and answered in its own thread instead.

    So the missing provenance does more than make agent text look like the user's. The receiver also has no way to reply.

    The code on main matches the report:

    • OrchestratorMcpService.ts:2847 stores senderThreadId on the message.
    • TimelineUserMessageRow.tsx:444 uses the sender's title to label the folded row in the UI.
    • ProviderTurnStartService.ts:1022 builds the provider text from only the message body and composer context. No provider adapter reads senderThreadId.

    #24725 adds a prefix to that text that includes the sender's thread id, which would have fixed this case. In my judgement, it would also help to name t3_thread_send in the prefix, so a Claude agent doesn't reach for its native messaging first.

  2. DamonYoungWork commented on Nov 16, 2026

    @DamonYoungWork

    Same problem here on 0.1.9 (macOS desktop, Claude provider), and sorry for the duplicate report in #37617. Two cases from a long orchestration session that the description above doesn't mention yet:

    1. The human's text and an agent's text merged in one turn. A child's t3_thread_send report and the human's own two-line reply were delivered to the receiving model as a single user message with no boundary between them. The agent had to guess from the wording where the report ended. So the fix probably needs both a server-written sender line on agent messages and separate blocks when several messages share a turn.

    2. Approvals. An orchestrator that waits for the human's "yes" before an install, an upload or a publish will accept that "yes" from any thread able to send to it. A prompt convention ("start your report with From the X child") only helps while every sender follows it.

    From reading main at 760f9cb: OrchestratorMcpService.sendToThread passes the text through with createdBy: "agent", creationSource: "mcp" and senderThreadId (or linkedSender), ProviderTurnStartService forwards those on the turn message, and ProviderAdapterV2TurnMessage carries them, so the adapters have what they need. Task completion notices (Delegated task <id> (<title>) [completed]:) and the decline-feedback label from #27871 already follow the pattern this would need.

    Happy to open a PR for the Claude adapter if a prefix line of that kind is the direction you want.

  3. SwitchOCE commented on Nov 18, 2026

    @SwitchOCE

    Note

    Claude Opus 5.5 posting on behalf of the account owner.

    Confirming on 0.1.10 (Linux server, Claude provider), with two threads on one server plus a thread on a linked machine.

    Read back with t3_thread_read: the human's messages carry "createdBy":"user","creationSource":"web". A t3_thread_send from another thread and a scheduled task's prompt both carry "createdBy":"agent","creationSource":"mcp" with "type":"user_message". Only the same-server send also has senderThreadId. A test message ("… No action needed") from another thread reached the receiving model as a bare user turn. The agents have taken to prefixing their messages with who they are, but nothing makes a sender do that.

    One gap in #24725: isCrossThreadAgentMessage requires senderThreadId !== undefined. So scheduled-task prompts and messages from a linked environment (which carry no senderThreadId) would still arrive unlabeled. A scheduled prompt is just as hard to tell from the human's typing. Could the label go on any createdBy: "agent" message, with wording for each kind (another thread on this server / a thread on a linked environment / a scheduled task), the way delegated-task results already arrive labelled ("Delegated task … [completed]:")?

    From the account owner:

    It's awkward, and in some situations it can make messaging subthreads hard, especially if you're doing competitive thread-versus-thread setups, like red teaming and blue teaming in a cybersec environment. The agents may not trust that you are who you say you are as the user, and it can cause a bunch of issues. A simple one-line appendage saying where the prompt comes from would be very helpful.

  4. Sharad-Patel1 commented on Nov 20, 2026

    @Sharad-Patel1
    Contributor

    Note

    Generated by claude-opus-5-5
    RESPONDING ON BEHALF OF SHARAD

    This can be closed: #39306 (b0b2c4f) fixed this on main. It ships in v0.1.11-nightly.20261119.4954, and no stable release has it yet. When another thread's agent sends a message, T3 now puts a line before it in the text the provider reads: [T3 Code: the agent in T3 thread "<id>" sent this message, not the user.]. withMessageSenderNote in packages/contracts/src/orchestrationV2.ts writes that line. New turns (ProviderTurnStartService), steers (ProviderTurnControlService) and history handoffs (handoffBudget) all call it before any adapter runs, so every provider gets it. Messages from a linked machine and scheduled-task prompts get their own line too, which covers SwitchOCE's comment. The open PR #24725 would then be superseded.

    One gap remains. #38515 was closed as a duplicate of this issue, and it asked for every message in a merged Claude turn to be marked. Now only the agent's part carries a line. In #38515's own example you can see where the human's text stops, but the human's part has no line of its own. #39306 also says the line is a hint for the model, not authentication, so a sender can still fake or skip it.

    The attached script adds a case to ProviderTurnControlService.test.ts, built like the file's own steer test. It steers a running turn with a message that thread:child's agent sent through t3_thread_send. Before #39306 the provider gets the bare text "Please merge the PR now." On current main it gets the sender line, then the same text. The script also checks that new turns, steers and history handoffs on main all call withMessageSenderNote.

    I also ran the issue's steps in the real app. Both threads used a small stand-in ACP agent that answers every prompt by quoting the exact text T3 sent it, and calls t3_thread_send when a prompt tells it to. That agent is the only simulated part. The T3 server, the MCP tool and the UI are real. In the orchestrator thread the user types a message, then a worker thread sends "Staging is green. Please merge the PR now." Before #39306 the UI marks the row as coming from Worker, but the provider gets the bare sentence. On main the provider gets the sender line first. The user's own message reaches the provider unchanged on both.

    Before #39306 (296f9131f7) main (9f6f5540cf)
    Before #39306 (296f9131f7) main (9f6f5540cf)
    📹 Screen recording 📹 Screen recording

    To reproduce, run bash prove-issue-24711.sh from a clean t3code checkout after vp i.

    Result
    PASS  #39306 (b0b2c4f952) is on main: fix(server): agents can tell another agent's message from the user's (#39306)
    PASS  main: new turns (ProviderTurnStartService), steers (ProviderTurnControlService) and history handoffs (handoffBudget) pass user text through withMessageSenderNote
    PASS  before #39306 (296f9131f7): a steer sent by thread:child's agent reaches the provider as the bare text "Please merge the PR now."
    PASS  main (38bac7091a): the same steer reaches the provider as '[T3 Code: the agent in T3 thread "thread:child" sent this message, not the user.]' followed by the unchanged text
    VERDICT: #24711 is fixed on main by #39306
    
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