Repository navigation
Description
The workflow
One agent thread messages another with POST /threads/{id}/send and senderThreadId. bb records such a message as the sending agent's: initiator agent, a link to the sender thread, the agent message header, and permission escalation off. That works for a thread that has already started. It does not work when the send is the message that starts a thread that is still pending, for example a thread created ahead of its first turn whose first dispatch was held by a scheduled sendAt or a message.dispatch wait. Agents that open a conversation with another agent's dedicated thread hit this on every first message.
What happens today
The send goes through attemptDispatch (
| const outcome = await attemptDispatch(deps, { |
| const author = resolveDispatchAuthor({ |
message.dispatch hooks see it: | senderThreadId: author.senderThreadId, |
admitPendingThread (| admitted.value = await admitPendingThread(deps, { |
startedOnBehalfOf (| startedOnBehalfOf: startContext.startedOnBehalfOf, |
requestThreadProvision then resolves the author with senderThreadId: null (| senderThreadId: null, |
So the thread's first client/turn/requested event has initiator: "user" and senderThreadId: null, and the input has no agent message header. In the timeline the first message reads as the person's own words. Every later send into the same thread is attributed correctly.
Setting startedOnBehalfOf at creation does not help: it is accepted only with a sourceThreadId or parentThreadId (
| "startedOnBehalfOf requires a sourceThreadId or parentThreadId", |
Repro against main (fd31b75)
Server test, using the harness the dispatch-hook tests use:
- Install a
message.dispatchhook that answerswait, then callcreateThreadFromRequest(codex, host environment, any input,startedOnBehalfOf: null). The thread stayspending. - Remove the hook, and seed a second thread in the same project to act as the sender.
- Call
acceptThreadSendRequeston the pending thread with{ input: textInput("Please review the plan"), mode: "auto", senderThreadId: sender.id }. - Read the thread's
client/turn/requestedevent.
Actual: initiator "user", senderThreadId null, input "Please review the plan"
Expected: initiator "agent", senderThreadId <sender id>, input with the agent message header naming the sender
The same send into an idle, started thread gives the expected result, through sendThreadMessage (
| ? formatAgentThreadInput({ |
Expected behaviour
The message that starts a pending thread is attributed like any other send. When the attempt carries a sender thread, the thread-start request records initiator agent and that senderThreadId, and the input carries the agent message header. Three cases stay as they are today: a send without a sender, a retry, and a creation's own startedOnBehalfOf, which still seeds a fork or child thread without running.
I'm filing this as a feature request rather than a bug because it changes what a first dispatch records.
Open question: the provisioned first run still uses the user permission escalation (ask) whatever the initiator is. An agent-sent message into a started thread gets deny. Matching that would mean persisting the initiator in the startup request. The prototype below leaves it unchanged.
Prototype
RIMTHAN-LAB@3709504 (branch thread-start-sender-attribution, on main @ fd31b75)
admitPendingThreadreceives the attempt's sender thread, null on a retry, and passes it torequestThreadProvision, which gives it toresolveDispatchAuthor. The input getsformatAgentThreadInput.test/threads/thread-start-sender-attribution.test.tscovers both cases, the attributed send and the plain send. The attributed case fails onmain.test/threads,test/publicandtest/services/threadspass (118 files, 1,281 tests), and so does the servertsc.
Happy to open it as a PR once approved.
Context and alternatives
- Alternative: let
startedOnBehalfOfbe set on a top-level thread. That still seeds without running, and it describes why a thread was started, not who sent a message. - Workaround today: the sending side writes the sender's name into the visible text of the first message. The text then says who sent it, but bb's attribution, link and policy initiator do not.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 6, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotthreads.confirmed-repro.main(fd31b75fb) in two clean checkouts: one failing pending-agent case and three passing controls each. All 89 relevant existing tests pass. Captured startup options also useaskinstead of the idle-agent path'sdeny.Route edit, compaction and /clear through the dispatcher and keep que…
Route edit, compaction and /clear through the dispatcher and keep que…