Repository navigation
Conversation
Greptile SummaryThis PR extends Key changes:
Issue found:
Confidence Score: 5/5Safe to merge; the only finding is a minor edge-case validation gap that won't be triggered in normal usage. The implementation is correct for all realistic inputs. The single P2 finding requires a malformed tool result (empty-string No files require special attention beyond the minor validation gap in
|
| Filename | Overview |
|---|---|
| src/acp/event-mapper.ts | Added image block extraction to extractToolCallContent(). Logic is correct for the happy path but allows empty-string data/mimeType values through, unlike the text-block branch which guards against empty strings. |
| src/acp/event-mapper.test.ts | New unit tests cover text, image, mixed, malformed (missing data/mimeType), empty content, and string-fallback cases. Missing a test for empty-string data/mimeType values. |
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/acp/event-mapper.ts
Line: 375-388
Comment:
**Empty `data`/`mimeType` strings pass validation**
The text block branch guards against empty strings with `.trim()` (line 367), but the image branch only checks `typeof entry.data === "string"` and `typeof entry.mimeType === "string"`. This means an image block with `data: ""` or `mimeType: ""` would be forwarded to ACP clients as a valid image, likely causing rendering failures on the client side.
For consistency with the text-block handling, you should add emptiness guards:
```suggestion
} else if (
entry?.type === "image" &&
typeof entry.data === "string" &&
entry.data.length > 0 &&
typeof entry.mimeType === "string" &&
entry.mimeType.length > 0
) {
contents.push({
type: "content",
content: {
type: "image",
data: entry.data,
mimeType: entry.mimeType,
} as ImageContent & { type: "image" },
});
}
```
The corresponding test case `"skips image blocks with missing data or mimeType"` only covers `undefined` values (absent fields), not empty strings — a test for `{ type: "image", data: "", mimeType: "image/png" }` should also be added.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat(acp): forward image blocks in tool ..." | Re-trigger Greptile
| } else if ( | ||
| entry?.type === "image" && | ||
| typeof entry.data === "string" && | ||
| typeof entry.mimeType === "string" | ||
| ) { | ||
| contents.push({ | ||
| type: "content", | ||
| content: { | ||
| type: "image", | ||
| data: entry.data, | ||
| mimeType: entry.mimeType, | ||
| } as ImageContent & { type: "image" }, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Empty
data/mimeType strings pass validation
The text block branch guards against empty strings with .trim() (line 367), but the image branch only checks typeof entry.data === "string" and typeof entry.mimeType === "string". This means an image block with data: "" or mimeType: "" would be forwarded to ACP clients as a valid image, likely causing rendering failures on the client side.
For consistency with the text-block handling, you should add emptiness guards:
| } else if ( | |
| entry?.type === "image" && | |
| typeof entry.data === "string" && | |
| typeof entry.mimeType === "string" | |
| ) { | |
| contents.push({ | |
| type: "content", | |
| content: { | |
| type: "image", | |
| data: entry.data, | |
| mimeType: entry.mimeType, | |
| } as ImageContent & { type: "image" }, | |
| }); | |
| } | |
| } else if ( | |
| entry?.type === "image" && | |
| typeof entry.data === "string" && | |
| entry.data.length > 0 && | |
| typeof entry.mimeType === "string" && | |
| entry.mimeType.length > 0 | |
| ) { | |
| contents.push({ | |
| type: "content", | |
| content: { | |
| type: "image", | |
| data: entry.data, | |
| mimeType: entry.mimeType, | |
| } as ImageContent & { type: "image" }, | |
| }); | |
| } |
The corresponding test case "skips image blocks with missing data or mimeType" only covers undefined values (absent fields), not empty strings — a test for { type: "image", data: "", mimeType: "image/png" } should also be added.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/acp/event-mapper.ts
Line: 375-388
Comment:
**Empty `data`/`mimeType` strings pass validation**
The text block branch guards against empty strings with `.trim()` (line 367), but the image branch only checks `typeof entry.data === "string"` and `typeof entry.mimeType === "string"`. This means an image block with `data: ""` or `mimeType: ""` would be forwarded to ACP clients as a valid image, likely causing rendering failures on the client side.
For consistency with the text-block handling, you should add emptiness guards:
```suggestion
} else if (
entry?.type === "image" &&
typeof entry.data === "string" &&
entry.data.length > 0 &&
typeof entry.mimeType === "string" &&
entry.mimeType.length > 0
) {
contents.push({
type: "content",
content: {
type: "image",
data: entry.data,
mimeType: entry.mimeType,
} as ImageContent & { type: "image" },
});
}
```
The corresponding test case `"skips image blocks with missing data or mimeType"` only covers `undefined` values (absent fields), not empty strings — a test for `{ type: "image", data: "", mimeType: "image/png" }` should also be added.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bd9eac79b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| entry?.type === "image" && | ||
| typeof entry.data === "string" && | ||
| typeof entry.mimeType === "string" |
There was a problem hiding this comment.
Reject empty image payloads in tool call content
The new image branch accepts any string values for data and mimeType, including empty strings, so a tool result like { type: "image", data: "", mimeType: "image/png" } is now forwarded as valid content. In that case ACP clients can receive an undecodable image payload, and because contents.length > 0, fallback text (text/message/error) is skipped entirely. This should validate non-empty (and ideally trimmed) strings before emitting an image content block.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7016f5a566
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| typeof entry.data === "string" && | ||
| entry.data.length > 0 && | ||
| typeof entry.mimeType === "string" && | ||
| entry.mimeType.length > 0 |
There was a problem hiding this comment.
Reject whitespace-only image payload fields
The new image acceptance check only uses length > 0, so blocks like { type: "image", data: " ", mimeType: "image/png" } or { mimeType: " " } are treated as valid content even though they are not decodable/usable image payloads. In that case contents.length > 0 short-circuits fallback text (text/message/error), so clients can receive a broken image update with no human-readable fallback. Please trim and validate both fields before emitting an image content block.
Useful? React with 👍 / 👎.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open: the PR is a focused ACP mapper improvement that current main still lacks, but it is not merge-ready because the external branch has only unit-test proof and recent proof-check activity means it does not satisfy stale unproven close criteria. Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main's ACP mapper only emits text content, and the translator uses that mapper for tool partial and final results. I did not establish a live ACP client reproduction in this read-only review. Is this the best way to solve the issue? Yes for the code layer: the event mapper is the shared ACP tool-result conversion boundary, and ACP SDK 1.1.0 already supports image content in tool-call content. It is not merge-ready until docs and real behavior proof cover the expanded surface. Security review: Security review cleared: No concrete security or supply-chain concern was found; the diff only changes ACP mapper logic and tests. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 70f2bef6b4cf. |
extractToolCallContent() previously only extracted text blocks from tool results, silently dropping image content. This meant ACP clients (e.g. Feishu, Discord) could not display images produced by tools like Read when reading PNG/JPG files. Add image block extraction alongside text blocks, with validation that both data and mimeType are present. The ACP SDK already defines ImageContent in ToolCallContent, so no protocol changes are needed. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Address review feedback: add length > 0 guards for data and mimeType to prevent forwarding undecodable image payloads to ACP clients. Co-Authored-By: Claude Opus 4.6 <[email protected]>
7016f5a to
f0d66e2
Compare
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
@David553 thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
Closing per ClawSweeper review verdict |
Summary
extractToolCallContent()in the ACP event mapper previously only extractedtype: "text"blocks from tool results, silently dropping image content blocksdataandmimeTypemust both be present), using the existingImageContenttype from@agentclientprotocol/sdkImageContentinToolCallContentTest plan
extractToolCallContent()covering:🤖 Generated with Claude Code