Repository navigation
Conversation
Format desktop and mobile image uploads for the target agent, separating each OMP file mention from adjacent attachments and following text. Allow OMP clipboard chips, preserve native attachment paths for verified agents, and encode otherwise unquotable absolute paths as file URLs. Closes #20389 Co-authored-by: mmarabel <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (28)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared agent-aware image path formatting and paste sequencing. Desktop Native Chat now passes the selected agent through image attachment sends and accepts clipboard images without an agent capability gate. Mobile session, terminal, picker, and native chat attachment flows now propagate the resolved agent. OMP uses portable Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Image attachments are formatted and separated for OMP while native attachment agents retain their existing behavior. The reviewed paths do not show a current merge-blocking risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation Issue Full details: Docstring CoverageExplanation Docstring coverage is 16.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 27 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Important
One behavioral regression to address before merging, detailed inline: mobile's terminal clipboard paste derives its agent from nativeChatController.nativeChatAgent — which is null unless the active tab is in chat view — and never consults launchAgent. A terminal running Claude that has launched but not yet reported agentStatus (and a plain shell) therefore emits an @ file mention instead of the raw bracketed path the attachment agents require.
Reviewed changes
- New
src/shared/agent-image-paste.ts—getAgentImageHandling,formatAgentImagePath,agentImagePasteWrites, and the relocatedformatNativeChatFileReference(now also quotes paths containing@and prefers single quotes). OMP paths with both quote characters and an absolute location become@"file:///…"; every other non-attachment agent gets a framed@reference. - Desktop native chat —
sendNativeChatMessageWithImageAttachmentstakesagentfirst anduse-native-chat-pty-composer-sendthreads it; the composer'sacceptsImagesgate andimageUnsupportednotice are removed, so unverified/custom agents now fall back to mentions instead of a refusal. - Mobile — clipboard, native-chat and terminal attachment paths thread an
agent; the terminal paste path now also separates a pasted image from following text. src/shared/file-uri-path.ts— POSIX absolute paths keep literal backslashes instead of folding them to/(Windows/UNC branches unchanged).- Tests — per-agent byte assertions for desktop/mobile, a route-parity hash bump for the new
'agentStatus'literal, and a hidden Electron clipboard spec.
I ran the changed desktop/shared (95) and mobile (62) suites, tc:web, and the markdown link consumers of filesystemPathToFileUri; all pass (mobile tsc shows only pre-existing generated-module errors).
ℹ️ Nitpicks
use-native-chat-composer-paste.tsstill declaresagent: AgentTypeinUseNativeChatComposerPasteArgs, andNativeChatComposer.tsxstill passes it, but the hook no longer reads it after the gate removal — drop both.native-chat-send.ts:43still says "A plain typed path (or @file mention) is treated as text/file-read". That is now exactly the intended OMP behavior, so the comment is stale.- Labelling OMP as
'unsupported'ingetAgentImageHandlingwhile deliberately routing it to a file reference invites the old "refuse this agent" reading; a'raw-path' | 'file-reference'shape would carry the new meaning.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const agent = | ||
| activeSessionTab && 'agentStatus' in activeSessionTab | ||
| ? (activeSessionTab.agentStatus?.agentType ?? nativeChatController.nativeChatAgent) | ||
| : nativeChatController.nativeChatAgent |
There was a problem hiding this comment.
This resolves the agent from nativeChatController.nativeChatAgent, which is null unless the active tab is in chat view (use-mobile-native-chat-active-resolution.ts:41), and never consults launchAgent. A terminal whose Claude has launched but not yet reported agentStatus therefore resolves to agent === null, and use-mobile-terminal-paste.ts:138 then emits an @ mention instead of the raw bracketed path Claude needs for an attachment. resolveMobileTerminalTabOwnedAgentId already does agentStatus.agentType ?? launchAgent and could drive this.
Technical details
# Mobile terminal image paste resolves to the wrong form before agentStatus arrives
## Affected sites
- `mobile/src/session/use-mobile-session-attachments.ts:42` — `agent` derived from `nativeChatController.nativeChatAgent`, ignoring `activeSessionTab.launchAgent`
- `mobile/src/session/use-mobile-terminal-paste.ts:138` — passes that `agent` into `formatAgentImagePath`
- `src/shared/agent-image-paste.ts:54` — null/unknown agent falls back to `formatNativeChatFileReference` (`@…`)
## Required outcome
- A terminal tab running a verified attachment agent (`claude`, `codex`, …) emits the raw bracketed path even before its live `agentStatus` lands, and a plain shell keeps a shell-usable path rather than an `@` mention.
## Suggested approach
- Resolve the active tab's owned agent with the existing `resolveMobileTerminalTabOwnedAgentId(activeSessionTab)` (`mobile/src/session/mobile-terminal-tab-agent.ts:25`) — `agentStatus?.agentType?.trim() ?? launchAgent` — instead of `nativeChatController.nativeChatAgent`, which is chat-view gated (`use-mobile-native-chat-active-resolution.ts:41`).
## Open questions for the human
- Should a plain shell (no agent at all) paste a raw path, a shell-escaped path, or an `@` mention? Issue #20389 says plain terminals keep a shell-usable path; the current fallback gives `@…`.|
Superseded by the clean rebase in #21651: #21651 The replacement preserves the image-attachment implementation and rendered E2E proof, rebases onto current |
|
Superseded by #21651. |

OMP treats pasted image paths as ordinary text unless they are file mentions. Desktop and mobile attachments now send separated
@mentions to OMP, so multiple images and the following prompt reach its image loader. Verified native attachment agents keep their existing paste behavior. Clipboard images can now be attached to OMP chats.Absolute paths containing both quote characters use file URLs, which OMP decodes. The existing URI formatter also preserves literal POSIX backslashes.
Closes #20389
Validation
a7e70c1ac9ae855cacded778f925a4114b751225: 151 desktop/shared and 59 mobile tests passed, including paste ownership, structured sends, separators, and file URI consumers.@,#,%, backslashes and nested directories; every decoded image matched the original bytes. Repeated against current OMP source and installed source package 18.1.2. These are file-loader runtime checks with no model turns; terminal paste-frame removal was simulated.@, and each quote character.Credit @mmarabel for the related #20390/#20391 attachment direction; co-author attribution is included in the commit.