Skip to content

Upload CLI image paths before thread requests - #2579

Merged
ymichael merged 7 commits into
mainfrom
bb/fix-github-issue-2449-thr_bmix86vce4
Sep 15, 2026
Merged

ymichael merged 7 commits into
mainfrom
bb/fix-github-issue-2449-thr_bmix86vce4

Conversation

@ymichael

@ymichael ymichael commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb thread ... --image /absolute/path.png persisted 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

  • Absolute and file: image paths are now read by the invoking CLI and uploaded through the existing project attachment API before a thread request is sent.
  • Spawn, tell, fork, and queued-message update persist the returned project-relative attachment path. Existing relative attachment tokens pass through unchanged.
  • --file keeps its existing execution-host path semantics.
  • CLI help and the generated BB guide describe the new boundary.

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_VERSION is 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.
  • Focused spawn, tell, fork, and queue tests — 60 tests passed.
  • Source CLI smoke against 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.
  • Verify-BB inventory reported one pre-existing unmapped browser CLI family; this PR does not touch it.

Fixes #2449

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/fix-github-issue-2449-thr_bmix86vce4 branch from 971ead3 to bf4c190 Compare August 28, 2026 05:09
@SawyerHood

Copy link
Copy Markdown
Collaborator

This is an automated message. We have closed this pull request because it has been open for more than two weeks.

@SawyerHood SawyerHood closed this Sep 11, 2026
@ymichael ymichael reopened this Sep 15, 2026
@ymichael ymichael changed the title Persist absolute prompt images as durable attachments Upload CLI image paths before thread requests Sep 15, 2026
@ymichael
ymichael merged commit b9a43d7 into main Sep 15, 2026
16 checks passed
@ymichael
ymichael deleted the bb/fix-github-issue-2449-thr_bmix86vce4 branch September 15, 2026 03:46
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
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.

Host-readable absolute --image paths render as broken thumbnails in project threads

2 participants