Skip to content

fill aborts "while positioning the caret" on ProseMirror editors for long values or non-empty targets (extension 0.3.3) #514

Open

Description

@nick-miles

Environment

  • bsk CLI/daemon: 0.3.2 and 0.3.3 (both reproduce; daemon version is not a factor)
  • Browser extension: 0.3.3 (protocol 1.3), Chrome 155.0.0.0
  • OS: Windows 11 x64, visible Agent Window started with --no-focus, BSK_AUTO_START=0
  • Repro site: https://claude.ai/new chat input ([data-testid="chat-input"], a ProseMirror contenteditable)

Summary

With extension 0.3.3, bsk fill into the ProseMirror editor aborts with exit 3
fill target changed or lost focus while positioning the caret
when either:

  1. the value is long — 453 chars succeeds, 980 and 1037 chars fail (5/5 attempts, across daemon 0.3.2 and 0.3.3), or
  2. the editor already contains text — appending even 6 chars to a verified 453-char draft fails; every fill into non-empty PM content fails.

The same operations succeed on plain controls in the same session/tab:

Target State Value Result
claude.ai PM editor empty 453 chars fill ok, exact match
claude.ai PM editor empty 980 / 1037 chars exit 3 caret abort, field left empty (no partial text)
claude.ai PM editor 453 chars verified +359 chars append exit 3 caret abort, draft unchanged
plain <input> (local page) empty 600 chars fill ok
plain contenteditable (local page) empty 600 chars fill ok
plain contenteditable (local page) 600 chars +6 chars append fill ok

Additional observations

  • The failed operations complete in ≤36 ms per the debug operation timeline
    (debug operations / debug operation <id>), error message is
    fill target changed or lost focus while positioning the caret; the page records
    zero console errors and identical before/after states.
  • Retries after the page has fully settled, and a real click into the editor
    beforehand, do not prevent the failure.
  • Default fill (with its clear pass) always aborts at the same caret step on this
    editor — and its clear pass does wipe the field first, which makes it destructive
    on failure.
  • Behavior changed between extension versions: on 0.3.2, a 1070-char --no-clear
    fill did insert the exact text (verified character-for-character via
    textContent) but returned exit 3 fill_value_mismatch — a read-back race against
    the page's async view update. On 0.3.3 short-value verification is clean, but
    long-value insertion and any append now hit the caret abort instead.

Workaround we use in production

User-parity clipboard insertion, which works for full-length values on the same editor:

bsk click @<editor-ref> --session ID
tr -d '\r\n' < message.txt | clip.exe        # or any OS clipboard setter
bsk press Ctrl+V --session ID
# verify via read-only textContent == intended text, then click the Send button

Resetting a draft also works via native keys: click → press Ctrl+A →
press Backspace → verify empty.

Expected behavior

  • fill should succeed for long values on ProseMirror contenteditables, and should
    not treat ProseMirror's silent selection synchronization as "focus lost".
  • Appending to a non-empty PM editor should not trip the caret/focus check.
  • If the caret-positioning verification is intentionally strict, consider a graceful
    fallback (e.g. clipboard-paste insertion) or an explicit --paste flag instead of
    an abort that leaves the caller with no insertion path for long values.

Related closed PRs that touched fill behavior: #301, #488.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions