Repository navigation
Upload CLI image paths before thread requests - #2579
Merged
Merged
Conversation
ymichael
force-pushed
the
bb/fix-github-issue-2449-thr_bmix86vce4
branch
from
August 27, 2026 18:39
4492b55 to
971ead3
Compare
ymichael
force-pushed
the
bb/fix-github-issue-2449-thr_bmix86vce4
branch
from
August 28, 2026 05:09
971ead3 to
bf4c190
Compare
Collaborator
|
This is an automated message. We have closed this pull request because it has been open for more than two weeks. |
ymichael
added a commit
that referenced
this pull request
Sep 15, 2026
## Human comments ## What was wrong `bb thread ... --file /absolute/report.pdf` sent the path verbatim, so the execution host tried to read a path belonging to the CLI machine. The previous image-upload change (#2579) explicitly preserved this behavior for files, creating an inconsistent attachment boundary: `--image` uploaded local bytes while `--file` depended on the execution host's filesystem. ## What changed Generalize the CLI image-upload helper to handle both file and image inputs before spawn, tell, fork, and queued-message update requests. Absolute paths and `file:` URLs are read on the CLI machine and uploaded through the existing SDK project attachment API; the thread receives the returned relative attachment token. Existing relative attachment tokens pass through unchanged, and repeated references to the same local path share one upload. For example, `bb thread tell THREAD "Review this" --file "$PWD/report.pdf"` now attaches the invoking machine's file even when the thread executes elsewhere. This intentionally changes absolute `--file` paths from execution-host paths to CLI-local paths. CLI help, guide templates, and skill references describe the new behavior. There are no server/daemon wire changes. ## How you verified - `pnpm exec turbo run test typecheck build --filter=@bb/cli`: 620 tests passed; typecheck and build passed. - Regression coverage checks multipart bytes, filenames, MIME types, target project selection, file URLs containing spaces, unchanged relative tokens, and failure before thread creation for missing files, directories, and rejected uploads. - Started `pnpm start:worktree` with a fresh data directory and verified server/daemon health and the connected test host. Used the built BB CLI against that server with explicit endpoint settings and cleared inherited thread context. - Spawned a Codex thread with an absolute local file, deleted the original after upload, and verified the agent read the uploaded copy and returned the exact verification code and UTF-8 text. CLI attachment download matched the original bytes. - Sent a scheduled follow-up with a `file:` URL and PNG; both uploaded attachments downloaded byte-for-byte. Updated the queued message with binary data, confirmed path/URL deduplication and existing file/image token preservation, then removed the scheduled test message. - Forked the completed thread with a file URL attachment and verified the forked agent returned its contents. A missing local file failed with exit code 1. - Live testing used one local execution host; execution across two different machines was not exercised. > AGENT GENERATED
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.
Human comments
What was wrong
bb thread ... --image /absolute/path.pngpersisted the CLI argument as though it were readable on the eventual execution host. That is the wrong boundary: the CLI may run on a different machine, and the timeline interprets the persisted path as a project attachment. The result is a broken thumbnail and unreliable cross-host delivery. See #2449.What changed
file:image paths are now read by the invoking CLI and uploaded through the existing project attachment API before a thread request is sent.--filekeeps its existing execution-host path semantics.This deliberately replaces the earlier server-side approach. There are no app changes, server behavior changes, database changes, attachment-lifecycle changes, or server/daemon wire changes;
HOST_DAEMON_PROTOCOL_VERSIONis unchanged.How you verified
pnpm exec turbo run test --filter=@bb/cli— 609 tests passed.pnpm exec turbo run typecheck build --filter=@bb/cli— passed.pnpm start:worktree: spawning a scheduled thread with an absolute PNG persisted only the returned relative attachment path. Downloading that attachment produced byte-for-byte identical content.browserCLI family; this PR does not touch it.Fixes #2449