Skip to content

fix(tui): expand collapsed paste tokens before submission - #75565

Merged
austinpickett merged 2 commits into
mainfrom
austin/fix/tui-paste-token-expansion
Jul 31, 2026
Merged

fix(tui): expand collapsed paste tokens before submission#75565
austinpickett merged 2 commits into
mainfrom
austin/fix/tui-paste-token-expansion

Conversation

@austinpickett

Copy link
Copy Markdown
Collaborator

What this is

Multiline pastes collapse into a [[ … ]] composer token, but ordinary idle TUI submission sent that literal token to the agent instead of the pasted content. This carries #75387 forward onto current main and resolves the review feedback on it.

Root cause

dispatchSubmission() calls clearIn(), which synchronously empties tokensRef.current (paste state moved from React state to refs in #75210). The later send(full) then rebuilt its expander from an empty token list, so the collapsed [[ … ]] label reached prompt.submit unchanged.

Fix

  • Snapshot the composer tokens before clearIn(), expand the model payload from that snapshot, and keep the collapsed token as transcript display text.
  • Keep interpolation detection on the visible composer text so {!…} copied inside pasted content stays inert.
  • In the interpolation branch, use the resolved interpolation output as the transcript display (not the pre-interpolation string), so a paste combined with a visible {!…} shows resolved output rather than the literal syntax — preserving current main behavior.
  • Regressions for payload expansion, hidden interpolation syntax, and the combined interpolation + collapsed-paste route.

Complements the queued-paste fix in #74797 (already on main); the queue path is unchanged here.

Verification

  • npm run typecheck — clean
  • npm run lint (touched files) — clean
  • npx vitest run src/__tests__/useSubmission.test.ts src/__tests__/queueSubmission.test.ts src/__tests__/attachments.test.ts src/__tests__/submissionCore.test.ts — 29 passed

Credit

Supersedes #75387 by @UltraInstinct0x (original fix + tests, authorship preserved in the first commit). Display fix and combined-route regression from @teknium1's review.

UltraInstinct0x and others added 2 commits July 31, 2026 13:58
The interpolation branch of dispatchSubmission passed the pre-interpolation
composer text as the transcript display, so a paste token combined with a
visible {!...} rendered the literal interpolation syntax instead of the
resolved output main shows today. Pass interpolate()'s resolved text as the
display override: it still carries the compact paste label while the model
payload expands the paste. Add a dispatch-level regression for the combined
interpolation + collapsed-paste route.

Co-authored-by: teknium1 <teknium1@users.noreply.github.com>
@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 8c13dff

ℹ️ Info

Desktop E2E visual evidence · View test artifacts · View job

3 visual diffs.

inline evidence is publishing...

@austinpickett
austinpickett merged commit 56f4b1a into main Jul 31, 2026
38 checks passed
@austinpickett
austinpickett deleted the austin/fix/tui-paste-token-expansion branch July 31, 2026 18:44
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…ch#75565)

* fix(tui): expand collapsed paste tokens before submission

* fix(tui): show resolved interpolation, not raw {!...}, with paste tokens

The interpolation branch of dispatchSubmission passed the pre-interpolation
composer text as the transcript display, so a paste token combined with a
visible {!...} rendered the literal interpolation syntax instead of the
resolved output main shows today. Pass interpolate()'s resolved text as the
display override: it still carries the compact paste label while the model
payload expands the paste. Add a dispatch-level regression for the combined
interpolation + collapsed-paste route.

Co-authored-by: teknium1 <teknium1@users.noreply.github.com>

---------

Co-authored-by: UltraInstinct0x <gokhansarapevi@gmail.com>
Co-authored-by: teknium1 <teknium1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants