Repository navigation
fix(native-chat): paste images in structured Codex chat - #17498
Conversation
Greptile SummaryThe PR connects structured native-chat sessions to the existing paste bridge so app-menu paste can reach the composer and adds regression coverage for that routing.
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issue identified. The structured chat surface delegates paste handling to the existing bridge, whose focus ownership and unavailable-composer behavior prevent hidden sessions or prompt states from incorrectly claiming app-menu paste.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx | Wires the structured composer into the existing focus-aware paste bridge without an accepted correctness or security issue. |
| src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx | Extends the composer mock with its imperative paste API and verifies app-menu paste routing. |
Reviews (1): Last reviewed commit: "fix(native-chat): route app menu image p..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughNative chat now connects the chat root and composer handle to Merge Risk: ⚪ Minimal · up to This change enables image paste in the structured chat composer through the existing clipboard and attachment flow, with no actionable merge-blocking risk remaining after normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the main changes, includes verification details, and provides visual proof. However, it does not follow the required template and omits the required Linked Issue, ELI5, Why, AI Disclosure, Review, Notes, and Checklist sections. Resolution Update the description to use the repository template. Add an issue reference after
✨ 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.
ℹ️ No critical issues — one minor parity suggestion inline.
Reviewed changes
- Paste bridge wiring —
NativeChatStructuredSessionnow callsuseNativeChatPasteBridgewith a root and composer ref, routing app-menu paste into the structured composer'spasteFromClipboard(image attachment path) and pane-level DOM paste intohandlePasteEvent. - Regression coverage — the test mocks
NativeChatComposeras aforwardRefexposing the imperative handle and asserts the app-menu paste event reachespasteFromClipboardexactly once.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| ) | ||
| const rootRef = useRef<HTMLDivElement>(null) | ||
| const composerRef = useRef<NativeChatComposerHandle>(null) | ||
| useNativeChatPasteBridge({ rootRef, composerRef }) |
There was a problem hiding this comment.
useNativeChatPasteBridge is called without questionAnswerInputRef, so while the question card owns the input region (composer unmounted), app-menu paste only reaches the free-text answer when that input happens to be focused. NativeChatResolvedView wires the same ref through NativeChatQuestionCard.answerInputRef for exactly this case; doing the same here keeps paste working while the card is shown.
Technical details
# Wire the question card answer input into the paste bridge
## Affected sites
- src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx:51 — `useNativeChatPasteBridge({ rootRef, composerRef })` omits the optional `questionAnswerInputRef`.
- src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx:162-193 — `NativeChatQuestionCard` is rendered without `answerInputRef`.
## Required outcome
- Add a `useRef<HTMLInputElement>(null)` and pass it as both the bridge's `questionAnswerInputRef` and `NativeChatQuestionCard`'s `answerInputRef`, matching `NativeChatResolvedView` (use-native-chat-paste-bridge.ts:10-12 documents this as the paste target while the card owns the input region).
## Suggested approach (optional)
- Text-only is expected here; the bridge already routes the answer input through `pasteTextIntoTextControl` with no image attachment.|
Electron validation evidence (real app-server flow):
Visual proof: |
|
Review status: PASS — no proven P0/P1/P2 issues found, and no in-scope code changes were needed. Checks completed:
The bridge wiring follows the existing pane-scoped paste ownership pattern and preserves text/image async handling without introducing new polling, persistence, subprocess, or mobile-facing behavior. Electron validation was attempted through an orchestrated Grok worker. The exact PR worktree launched with an isolated profile; identity and Dock label matched |
|
Follow-up: I retried the orchestrated Grok Electron validation with a fresh dispatch. That retry terminal exited back to a shell before producing a second worker report, so it did not add new evidence. The PR now contains independent successful real-Electron evidence and before/after screenshots: Cmd+V created a visible |
…17498) Co-authored-by: Merge Sim <sim@local>

Summary
Verification
pnpm test src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx src/renderer/src/components/native-chat/use-native-chat-composer-paste.test.tsx(18 passing)pnpm tcpnpm run check:code-quality:changedPasted imagechip, sent the turn, and received Codex confirmation that it received the image.Visual proof
Before paste:

After paste:
