Skip to content

Upload CLI-local file attachments before thread requests - #3750

Merged
ymichael merged 1 commit into
mainfrom
bb/fix-file-cli-flag-attachment-asymmetry-thr_9p5dep7325
Sep 15, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/fix-file-cli-flag-attachment-asymmetry-thr_9p5dep7325

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

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

@ymichael
ymichael merged commit ca4b7ba into main Sep 15, 2026
16 checks passed
@ymichael
ymichael deleted the bb/fix-file-cli-flag-attachment-asymmetry-thr_9p5dep7325 branch September 15, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant