Skip to content

fix(paste): content-match submit detection for inlined pastes (#279, #90) - #280

Merged
Juliusolsson05 merged 2 commits into
mainfrom
fix/paste-submit-confirmation
Jun 15, 2026
Merged

Juliusolsson05 merged 2 commits into
mainfrom
fix/paste-submit-confirmation

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

The bug (#279 / #90)

Claude buffers pasted text and flushes on a ~100ms debounce; inside that window every keystroke — including our submit \r — is swallowed as more paste content. Our event-driven detector only waited for the [Pasted text #N] placeholder, but Claude renders that only above its inline→collapse threshold. For the whole band in between (≈100 chars up to that threshold, and short multi-line), Claude inlines the paste with no placeholder, so the detector timed out and blind-fired \r straight into the debounce → swallowed → no turn → you press Enter again.

The fix — content match, not a clock

Compare what the user submitted against what's actually in the headless composer, via the live screen snapshot (latestScreenRef), and send \r the instant the composer reflects the paste:

Both are load-independent — we wait for the condition, not a duration. The wall-clock wait survives only as a rare safety floor (Claude UI-rename insurance); it's no longer the primary path. This is the deferred "Option A" from the 2026-04-21 clean-fix doc, finally completing the event-driven approach from #71/#80.

Detection runs renderer-side off the existing latestScreenRef — no submodule change, one app PR.

Diagnostics (the #101 dev module)

ClaudePasteDetection updated to read the new paste:absorbed events, show a via column (placeholder vs inline), and an always-in-sync "screen copy (live)" pane so you can watch the composer fill as you paste.

Safety / scope

  • Zero new typecheck errors (4 pre-existing baseline remain).
  • No timer as the primary path; the floor only fires if both screen signals fail within 500ms.
  • Touches only the Claude paste path; Codex/plain-text paths unchanged.

Test

AGENT_CODE_DEV_DEBUG=1, enable the dev panel's "Claude Paste / Submit Detection", paste a medium (~150–500 char) multi-line prompt into a Claude pane, hit Enter once → it submits; the timeline row shows via: inline and outcome: submitted.

Closes #279. Refs #90, #101.

🤖 Generated with Claude Code

Juliusolsson05 and others added 2 commits June 15, 2026 07:26
…e, no timer (#279,#90)

Replace the placeholder-only event-driven detector (which timed out and
blind-fired \r for medium/inlined pastes that Claude never collapses into a
[Pasted text #N] placeholder) with a content match against the live headless
screen: send \r only once the composer visibly reflects the paste — a NEW
placeholder appeared (collapse) OR the paste's tail newly appears (inline).
Screen-truth, load-independent; the wall-clock wait survives only as a rare
safety floor. Detection runs renderer-side off latestScreenRef (no submodule).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n for content-match

Adds an always-in-sync 'screen copy (live)' pane (reads runtime.screen each
render) so you can watch the composer fill as you paste, plus a 'via' column
(placeholder vs inline) and back-compat for the new paste:absorbed events.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Juliusolsson05
Juliusolsson05 merged commit 628759f into main Jun 15, 2026
@Juliusolsson05
Juliusolsson05 deleted the fix/paste-submit-confirmation branch July 7, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude paste submit: inlined (non-placeholder) pastes race the accumulator — blind \r gets swallowed, no turn starts

1 participant