fix(acp): accept https:// URIs in image content blocks#24816
fix(acp): accept https:// URIs in image content blocks#24816truenorth-lj wants to merge 1 commit into
Conversation
The previous prefix check `startsWith("http:")` only matches `http://...`
URLs and silently drops `https://...` URLs. Every other URL check in this
codebase (instruction.ts, import.ts, webfetch.ts, config.ts) checks both
prefixes — this appears to be a typo.
The bug surfaces when an ACP client sends an image content block with a
two-stage upload URL (e.g. a GCS signed URL), which is always https. The
case falls through and the image is silently dropped from the prompt.
Repro:
Send ACP session/prompt with content:
{ type: "image", uri: "https://example.com/x.png", mimeType: "image/png" }
Expected: image part forwarded to LLM provider
Actual: image silently dropped (no error, no parts.push)
Fix: align with the other 5 URL checks in this codebase by accepting both
http:// and https:// prefixes explicitly.
|
Polite nudge — this has been open for 4 days with CI green and no conflicts on The fix is a one-line typo ( @kitlangton — would you have a moment to look? Happy to add a unit test or split if anything's off. I also just opened a related ACP fix (#25422 / issue #25421) — different bug, same area. Same offer there: regression test on request. |
|
@rekram1-node — would you have a moment to look at this one? It's been open 10 days with CI green and no conflicts. The fix is one line ( Saw you've been merging ACP-area PRs from external contributors recently (#25698, #25591) — hoping to reach the right reviewer. Happy to add a regression test against Also — if there's a path to getting onto the |
|
Hey — just doing housekeeping on stale PRs. Happy to close this one if the approach isn't right, or if it's blocked on anything I haven't addressed. The fix is a one-line |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #24815
Type of change
What does this PR do?
packages/opencode/src/acp/agent.ts:1394previously read:That prefix only matches
http://—https://fails the check (the 5th char iss, not:), so the entirecase "image":branch falls through andparts.pushnever runs. The image is silently dropped from the prompt with no error.This breaks ACP clients doing two-stage uploads (sign a GCS / S3 URL, pass the
https://URL via the ACPimageblock instead of inlining base64).This PR aligns the check with the rest of the codebase, where every other URL test uses both prefixes:
packages/opencode/src/session/instruction.ts:146,168startsWith("https://") || startsWith("http://")packages/opencode/src/cli/cmd/import.ts:98startsWith("http://") || startsWith("https://")packages/opencode/src/tool/webfetch.ts:23!startsWith("http://") && !startsWith("https://")packages/opencode/src/config/config.ts:1270startsWith("http://") || startsWith("https://")The fix is one line:
This matches what the surrounding code clearly intends —
parseUri(part.uri)two lines above already accepts both schemes — and brings this branch in line with the conventions used everywhere else in the repo.How did you verify your code works?
Reproduced the bug locally before the fix:
session/promptwith{ "type": "image", "uri": "https://example.com/x.png", "mimeType": "image/png" }.partsarray passed downstream — image part is missing.urlset to thehttps://URL.The change is the most narrowly scoped possible (one boolean expression), and there are no tests for the surrounding
case "image":switch in this file, so I haven't added one in this PR — happy to add one if you point me at the test file pattern you'd want.Screenshots / recordings
N/A (no UI change).
Checklist