Recall sent prompts with ArrowUp/ArrowDown in the `clai2` web UI prompt box

Merged
MP
1mo ago
+157-40

Why we make these changes

In the clai2 web UI, ArrowUp in the prompt box didn't recall earlier prompts, though the terminal prompt does (#11284). The composer's onKeyDown only handled the arrows while slash-command suggestions were open, and it kept no history. This change makes the arrows work the way the terminal's PromptBuffer.vertical/recall does.

New public surface

none (the composer gets an optional internal history prop)

User-visible behavior

Before: after sending hello, ArrowUp in the empty composer did nothing.
After: ArrowUp fills the composer with hello, and ArrowDown brings back the empty draft.

  • Up on the composer's first line steps back through the shown session's sent prompts, newest first. Down on the last line steps forward, and the unsent draft comes back past the newest entry. Queued prompts stay editable in the queue panel above the box.
  • Elsewhere in a multi-line draft, Up/Down still move the caret. With / suggestions open, they still pick a suggestion.
  • Shift/Ctrl/Alt/Cmd+arrows, a selection, or nothing to recall keep the browser's default behavior.
  • Typing, sending, or switching sessions ends the walk. A recall drops slash completions still pending for the draft it replaced.
  • Prompts come from the session's transcript, so recall survives the composer moving after the first message, a reload, and a session switch.
  • Documented in clai2_web_README.md, docs/reference.md and FILE_MAP.md. The bundled app.js is rebuilt with Node 24.22.1 (.nvmrc).

Verification

  • test_composer_recalls_sent_prompts fails on main at the first recall assertion, and passes with the fix.
  • tsc --noEmit, npm run build (reproducible bundle), ruff, pyright and pre-commit all pass locally. The browser job runs in CI. The local WSL Chromium produces no animation frames, so I checked the browser test there with forced clicks and a polyfilled requestAnimationFrame.

What changes for existing users

The web composer's Up/Down now recall prompts, as the terminal's do.

PR decisions

2026-10-26 · pre-push review 1 of 3 at 3bc994d055e96198a82411e262f9d5913148e33c · iter -

2026-10-26 · pre-push review 1 of 3 at 3bc994d055e96198a82411e262f9d5913148e33c · iter -

2026-10-26 · pre-push review 2 of 3 at c848620f9a2a3a8db22b95c6c6c7e485abc456d0 · iter -

2026-10-26 · pre-push review 2 of 3 at c848620f9a2a3a8db22b95c6c6c7e485abc456d0 · iter -

2026-10-26 · exempt delta: merge origin/main at 617bc322a · iter -

  • Decision: no re-review; chains from reviewed c848620f9 (review 2 of 3)
  • Why: only conflict was the generated app.js, rebuilt reproducibly with npm run build (repo tooling); source diff vs base identical except a FILE_MAP blob-index line from main's own edit
  • Source: https://github.com/pydantic/pydantic-ai/pull/11352

2026-10-26 · pre-push review 3 of 3 at e28fa8626976af3858fcd1cea110e002d93ab5fe · iter -

2026-10-26 · pre-push review 3 of 3 at e28fa8626976af3858fcd1cea110e002d93ab5fe · iter -

2026-10-26 · Macroscope thread: stale completions after recall · iter -

2026-10-26 · exempt delta: test-harness repair at 515b4e6c1d82a44d0f5d7874df235ff4b8d8daf1 · iter -

2026-10-26 · merge origin/main at e508a56c238ad4fe9f91ff2692af64defe913bd4 · iter -

  • Decision: no further review (budget 3 of 3 used); local checks rerun
  • Why: PR left the merge queue as UNMERGEABLE after #11314/#11315/#11327/#11341 landed; conflicts were the generated app.js (rebuilt reproducibly) and side-by-side additions in the browser test (both imports and both tests kept); source delta otherwise identical to reviewed 515b4e6c1
  • Source: https://github.com/pydantic/pydantic-ai/pull/11352

2026-10-26 · merge origin/main at 40b5a1ba5262e087bf25643b886b2f9815df4f67 · iter -

2026-10-26 · merge origin/main at 116cfcbab0090fb542491369c8931e2c07ee6da3 · iter -

2026-10-26 · merge origin/main at aee5fc9a9f20114de4e9e930cef5bc7fb3fc1b17 · iter -

2026-10-26 · merge origin/main at f3c92b3c728bb6265a99a9ab005516286d072c38 · iter -

2026-10-26 · CI Review advisories at 40b5a1ba5 · iter -

  • Decision: dropped queued prompts from web recall instead of testing them; renamed step to recallPrompt; reworded settle comment
  • Why: Enter on a recalled queued prompt queued a duplicate (no in-place rewrite as in the terminal), the issue asks only for sent prompts, and testing it needed a new blocking fixture session
  • Source: https://github.com/pydantic/pydantic-ai/pull/11352#pullrequestreview

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.