Repository navigation
Allow cross-project sender attribution for thread messages - #235
Merged
Merged
Conversation
`bb thread tell <target>` auto-attaches the caller's BB_THREAD_ID as
senderThreadId. The shared send/queue resolver rejected a sender whose
project differed from the target's, so a worker thread in one project
could not message a coordinator thread in another (HTTP 400 "Sender
thread is invalid"), forcing an `env -u BB_THREAD_ID` workaround that
dropped attribution entirely.
Drop the cross-project guard in resolveMessageSenderThreadId (covers both
the immediate-send and queued paths). Existence and not-deleted are still
required so the reply target is a live thread, and the round-trip reply
via `bb thread tell {{senderThreadId}}` now works bidirectionally across
projects. The create/fork hierarchy guard (assertValidParentThread) is
intentionally left project-scoped.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bb thread tell <target>auto-attaches the caller'sBB_THREAD_IDassenderThreadId. The shared send/queue resolver (resolveMessageSenderThreadId) rejected any sender whose project differed from the target's, so a worker thread in one project could not message a coordinator thread in another — it returnedHTTP 400: Sender thread is invalidand forced anenv -u BB_THREAD_IDworkaround that dropped attribution entirely (losing the reply-back affordance).This drops the cross-project guard so any thread can message any other thread with attribution preserved.
Changes
thread-send.ts—resolveMessageSenderThreadIdno longer rejects cross-project senders (covers both the immediate-send and queued paths, which share this resolver). Existence and not-deleted checks remain so the reply target is a live thread.lifecycle-api-errors.ts— narrowedthrowSenderThreadInvalid's reason type to"deleted" | "not_found"sincewrong_projectis no longer a sender outcome.public-thread-data.test.ts— flipped the regression test: a cross-projectsenderThreadIdnow queues the message (200) with the sender preserved, instead of returning 400.The create/fork hierarchy guard (
assertValidParentThread) is intentionally left project-scoped — that governs parent/fork structure (sidebar grouping, depth caps), not peer-to-peer messaging. The round-trip reply viabb thread tell {{senderThreadId}}now works bidirectionally across projects.Tests
pnpm exec turbo run typecheck --filter=@bb/server— passespnpm exec turbo run test --filter=@bb/server -- public-thread-data— 59 passedRisks
Low. Single-user local tool with no cross-tenant boundary; cross-project messaging is a deliberate workflow (coordinator/worker dispatcher pattern). Behavior change only takes effect once the updated server is running.
🤖 Generated with Claude Code