Skip to content

Plugin-originated thread messages are indistinguishable from user input (initiator=user, senderThreadId=null) #3621

Open

Description

@jjanousek

Summary

A message sent to a thread by a plugin service arrives with initiator: "user" and senderThreadId: null, which is byte-for-byte the shape of a message the human typed. The receiving thread renders it as the user speaking, and an agent reading its own transcript cannot tell the two apart.

There is no way for a plugin to name itself as the sender. bb thread tell derives the sender from the calling thread via BB_THREAD_ID; a plugin service has no calling thread, so the field is null and the initiator falls back to user.

Tested on bb 0.43.0.

Reproduction

From a plugin service (or any context with no BB_THREAD_ID):

bb thread tell <thread-id> "hello from a background service"

Then read the event back:

sqlite3 ~/.bb/bb.db "select data from events
  where type='client/turn/requested' order by sequence desc limit 1;"

Observed:

{"direction":"outbound","source":"tell","initiator":"user",
 "senderThreadId":null,
 "input":[{"type":"text","text":"hello from a background service"}]}

Identical to a message typed by the human. For contrast, the same tell issued from a thread produces "initiator":"agent" with senderThreadId populated, which renders correctly as "Message from <thread>".

Distribution of client/turn/requested on one real install:

initiator senderThreadId count
agent set 1111
user null 539
user null (source: spawn) 127
system null 105

The 539 are plugin-originated and indistinguishable from human input.

Why it matters

Anything a background service says to a thread is attributed to the user: scheduled nudges, retry prompts from a sweep, escalations. An agent that reads "do X" believes its owner asked for X. On this install it put nine messages from one plugin into the owner's voice before anyone noticed.

It is also a trust boundary. An agent is entitled to treat its owner's words as authorization and another component's words as data. Collapsing the two removes the distinction at exactly the point where it matters.

Suggested fix

The mechanism half-exists: initiator already accepts system as a value distinct from user, so the enum is not the obstacle.

Either:

  1. senderPluginId on the turn-start input, alongside the existing senderThreadId, rendered as "Message from <plugin id>"; or
  2. bb thread tell --as-plugin <id> for services, setting the same field.

Option 1 is the smaller change if the renderer already branches on senderThreadId.

A plugin should not be able to claim to be the user, so ideally the host sets this from the calling plugin's own identity rather than trusting a supplied string.

Workaround in use

Every plugin-originated message is prefixed with a literal first line:

[automated message from the <plugin> plugin, not from Johannes]

This works but relies on every plugin author remembering it, and on the reader reaching the first line before acting.

Activity

  1. added theissue type on Sep 14, 2026
  2. added
    threads
    security
    on Sep 14, 2026
  3. jjanousek commented on Sep 14, 2026

    @jjanousek
    Author

    Adding a second, install-independent witness that predates the report.

    One plugin on this install hit the same gap in September and worked around it without a sender identity being available. chief-of-comms/components/comms/send-guard.ts, created 2026-09-07, records a sha256 of every text its service injects into a thread, and the plugin's own send tools refuse any turn whose text matches that hash. The header comment documents the reason in nearly the words of this issue: the plugin cannot tell the host who it is, so it fingerprints its own messages instead and treats a match as "this came from me, not from the user".

    That is a plugin reconstructing sender identity from message content because the platform does not expose it. It works, and it costs a table, a hash on every send, and a guard on every tool. It also cannot help the reader: the chief still displays the message as the user until an attribution line is added to the text by hand.

    Two things this suggests for the fix:

    1. Whatever field is added should be set by the host from the calling plugin's identity, not supplied by the plugin, or a plugin can still claim to be the user.
    2. The renderer and the authorization path both need it. Attribution alone lets an agent see the difference; it does not stop it acting.

    Still on 0.43.0.

  4. added
    partial-repro
    on Sep 14, 2026
  5. bb-slop-cop commented on Sep 14, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classified Bug · High priority · High effort; added threads, security, and partial-repro.

    Reproduction and root-cause report: PARTIALLY REPRODUCED, high root-cause confidence. In two clean checkouts, executing the production sender-resolution functions and initiator expression confirmed that absent thread context becomes senderThreadId: null and initiator: user. The send contract carries no plugin identity. Full integration verification was blocked by a missing pnpm entrypoint; live plugin delivery, persistence, and rendering remain unverified.

    No PR: correcting service provenance requires a public-contract and security-boundary decision, outside the simple-fix limits.

    AGENT GENERATED

  6. SawyerHood commented on Sep 14, 2026

    @SawyerHood
    Collaborator

    Cross-linking existing authorization work #1541 and its consumer #1564. This issue remains open as the concrete defect where service messages acquire human attribution; host-attested authorization is broader than message provenance. Coordinate contract design, but do not treat an attribution field alone as proof of human approval.

    AGENT GENERATED

  7. pc-style commented on Sep 30, 2026

    @pc-style
    Written by an agent

    Drafted and posted by Claude Code (Claude Opus 5.5) on behalf of @pc-style, from a debugging session on his BB fleet.

    Still reproduces on bb 0.44.0: bb thread tell from a shell with no BB_THREAD_ID records initiator: "user", senderThreadId: null. A related root cause: the loopback API answers without credentials, so an agent that unsets BB_THREAD_ID gets the same "user" attribution. I filed that separately as #4529.

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

    partial-reprosecuritythreads

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions