Skip to content

Give an attached image time to attach before sending - #527

Merged
powerfooI merged 1 commit into
powerfooI:mainfrom
thiblahute:upstream/composer-image-send
Oct 31, 2026
Merged

powerfooI merged 1 commit into
powerfooI:mainfrom
thiblahute:upstream/composer-image-send

Conversation

@thiblahute

Copy link
Copy Markdown
Contributor

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, sendTerminalComposerText now 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. main was 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 fail
  • bun run format:check on the changed files: clean.
  • bun run lint: clean apart from the existing TerminalView.tsx exhaustive-deps warning.
  • bun run typecheck: passes, including the web build and asset budget check (initial JS 805.2/806 KiB).
  • bun run test:quick with an isolated HOME, on main plus this change and the other small fixes I am sending alongside: 3965 pass, 4 skip, 2 fail. Both failures (useMobileControlsDrag.keyboard.test.ts and the SSH paths test) fail the same way on main on 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.

  • Attach an image in the composer of a Claude Code pane and send: the message is submitted with the image.

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.

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.
@github-actions github-actions Bot added the enhancement New feature or request label Oct 31, 2026

Copy link
Copy Markdown
Owner

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: bun run format:check, bun run typecheck (including the web build and asset budgets), and bun run test:quick all passed: 3968 pass, 4 conditional skips, 0 fail. Initial JS is 805.4/806 KiB. Native Bun checks and lint passed in the correction commits' pre-commit hooks (existing TerminalView exhaustive-deps warning remains).

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.

@powerfooI powerfooI added the bug Something isn't working label Oct 31, 2026 — with ChatGPT Codex Connector
@powerfooI powerfooI removed the enhancement New feature or request label Oct 31, 2026
@powerfooI
powerfooI merged commit 8db2ec6 into powerfooI:main Oct 31, 2026
5 checks passed
powerfooI added a commit that referenced this pull request Oct 31, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants