Repository navigation
claude-code: pass prompt attachments as text markers (parity with Codex's reference-not-content model) - #30
Merged
SawyerHood merged 1 commit intoMay 19, 2026
Conversation
The Claude Code bridge's `extractInputText` filter dropped every `localImage`, `localFile`, and `image` entry from `PromptInput[]` before constructing the SDK user message, so files attached in the bb UI never reached Claude Code sessions. Replace the text-only filter with `buildPromptText`, which keeps text fragments as-is and converts each attachment to a path-bearing text marker — `[Attached image: <url>]` for remote URLs and `[Attached <kind> "<name>" (<mime>, <sizeBytes> bytes). It is on disk at <staged abs path> — use the Read tool to view it.]` for staged files. Name / MIME / size are included only when present in the input. The bridge stays synchronous and pushInput still takes a plain string. This matches Codex's "pass references, not content" model so the provider-agnostic attachment plumbing stays uniform: the daemon stages files on disk and the adapter hands the model a path it can Read. Supersedes the closed multimodal-inlining PR. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Aug 19, 2026
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
extractInputTextfilter silently dropped everylocalImage,localFile, andimageentry fromPromptInput[]before building the SDK user message.buildPromptText, which forwards text fragments as-is and converts each attachment to a path / URL-bearing text marker rather than reading and inlining bytes. The bridge stays synchronous, no new dependencies, andSdkSession.pushInputstill takes a plainstring.packages/agent-runtime/src/codex/adapter.ts:650-655) so attachment plumbing is provider-agnostic: the daemon stages files on disk and the adapter hands the model a path it canRead.Marker shape
PromptInputvarianttext\n(unchanged from today)image(URL)[Attached image: <url>]localImage(path only — noname/mime/sizein the contract)[Attached image. It is on disk at <staged abs path> — use the Read tool to view it.]localFile(full metadata)[Attached file \"<name>\" (<mime>, <sizeBytes> bytes). It is on disk at <staged abs path> — use the Read tool to view it.]localFile(any ofname/mime/sizeBytesmissing)Supersedes
This PR replaces the now-closed multimodal-inlining PR (#29). The user has decided the simpler reference-passing approach is preferred — no base64 cache busts, uniform with Codex, and the agent uses its existing
Readtool to inspect attachments.Test plan
pnpm exec turbo run typecheckacross all 27 packagespnpm exec turbo run test --filter=@bb/agent-runtime(504 tests pass, +7 new)localImagemarker,localFilewith full metadata,localFilewith missing optional fields,imageURL marker, attachment-only turnReadthe staged path if it chooses)🤖 Generated with Claude Code