Repository navigation
Give an attached image time to attach before sending - #527
Conversation
A message with an uploaded image went to the agent as one request: the image path, then Enter at once. Claude Code reads a pasted image path into an attachment and drops an Enter that arrives meanwhile, so the message stayed in its prompt, unsent. When the text holds an uploaded path, the composer now types it, waits briefly, and sends Enter on its own. The initial JS goes from 805.0 to 805.2 KiB, so its budget moves from 805 to 806 KiB.
|
Reviewed the split text/Enter sequence, upload-path detection (Unix and Windows separators), connection-bound call behavior, and composer submission locking. Combined verification on current main plus all six contributions: The 400 ms delay remains a compatibility heuristic; there is no attachment-ready acknowledgement. I did not repeat the author's Claude Code browser check. Local browser automation was blocked by the current browser URL access policy. |
* Send an image path alone so Claude Code attaches it An image sent with words reached Claude Code as a plain path in the message, not as an image: Claude Code only turns a paste into an attachment ([Image #N]) when the paste is the image path alone, and the composer typed the whole message as one paste. When the text holds an uploaded image path and anything else, each path now goes in as its own paste, followed by the pause #527 added for the attachment, and the words around it go in as theirs. Enter follows the last piece. A message of plain text, or a path typed in without sending, still goes in one request; other panes receive the same characters in the same order. Punctuation right after an unquoted path stays with the sentence. * Preserve escaped upload paths when splitting image pastes --------- Co-authored-by: Wangshuyi <whiteffire@163.com>
A message with an uploaded image went to the agent as one request: the image path, then Enter at once. Claude Code reads a pasted image path into an attachment and drops an Enter that arrives meanwhile, so the message stayed in its prompt, unsent, and had to be sent again by hand.
When the composer text contains a path from Roamgate's upload directory (
roamgate-uploads-*) and is being submitted,sendTerminalComposerTextnow types the text, waits 400 ms (IMAGE_SETTLE_MS), and then sends Enter as a separate request. Text without an uploaded path, or text only typed in without submitting, still goes in a single request.Changes
web/src/terminalComposer.ts: split the send for submitted text that contains an uploaded path. The wait is injectable for tests.web/src/terminalComposer.test.ts: the request sequence for an uploaded path (type, wait, Enter), for plain text, and for an uploaded path that is not submitted.scripts/check-web-assets.mjs: the initial JS budget moves from 805 to 806 KiB.mainwas at 805.0/805 KiB; this change puts it at 805.2 KiB.Verification
bun test web/src/terminalComposer.test.ts web/src/components/TerminalComposer*.test.ts: 27 pass, 0 failbun run format:checkon the changed files: clean.bun run lint: clean apart from the existingTerminalView.tsxexhaustive-deps warning.bun run typecheck: passes, including the web build and asset budget check (initial JS 805.2/806 KiB).bun run test:quickwith an isolatedHOME, onmainplus this change and the other small fixes I am sending alongside: 3965 pass, 4 skip, 2 fail. Both failures (useMobileControlsDrag.keyboard.test.tsand the SSH paths test) fail the same way onmainon macOS.Manual check, done before this rebase against a test Herdr in headless Chrome with Claude Code: an image alone left
[Image #1]unsent in Claude's prompt before the change; with it, both an image alone and an image with text are sent. Not repeated on this branch.Notes
400 ms is a margin, not a measured threshold: separate requests with no added wait already sufficed in testing. The wait applies to any pane, not only Claude Code.
Compatibility
No API changes.