Repository navigation
fix(chat): refuse a send over text typed in Letta's, maki's, Kimi Code's, Gemini's or Kilo's box - #3775
Conversation
…e's, Gemini's or Kilo's box Recorded in the agent lab. A character that draws nothing is no typed text, and a live read holding a row more above the viewport still matches it.
…lder Also moves a comment in submitNote back above the branch it describes.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Merge passMerged head
Merged with these checks red, none of them required: Native macOS session identity; Two reviewers at this head: Claude (Opus) CLEAR, Codex Terra CLEAR. Queued input and the chat send path, so a real review. The typed-text guard of #3732 and #3752 now also covers Letta, maki, Kimi Code, Gemini and Kilo: a chat send is refused as The merge pass ran Left, none HIGH (the lane is closed; follow-up issue below):
Reports: Merged with one check not green: |
|
Correction from the merge pass: the |
Fixes #3627. Thanks to @najy97 for the report and the careful evidence (the 76 + 544 character join in GJC's history). > Waits for the release freeze: this touches `shared/` and `server/` tests, so it merges only after the 0.5.4 Release run. ## Cause This is the same fault as #609 / #629 and #3775. A chat send pastes into the agent's own input box and presses Enter, and nothing reads the box first, so text left there is joined to the message. - **GJC itself** is already guarded on `main`: #3732 added the draft check (`freeAgentInput`, `typedDraft`) and #3752 added GJC's recorded box to it. Neither PR closed this issue. - **Same fault, still open: omp.** omp has a recognizer (`ompInputRow`), but it was recorded on omp 18.8.7 and reports no typed cells, so `readsTypedDraft("omp")` was false. omp 18.14 also draws its editor differently: the status line has lost its `╭── … ╮` frame and the editor has no closing `─╯`. That recognizer does not find the box at all. A send to omp went straight to `agent.prompt` over whatever was typed there. - Other agents in the same class are left as they are and named here. Devin, agy and Grok have recognizers that report no typed cells. Recording a typed box for them needs the owner's sign-ins (as #3775 noted). OpenCode, Droid, Cursor, Amp and the others have no recorded box. ## Change - `shared/input-row.ts`: a draft-only recognizer for omp 18.14. It finds the `π > … ▶` status line, then the editor right under it: `╰─ ` and the rows a draft runs onto, indented three columns. It reports the editor's cells. The empty editor's `⇧⇥ to change thinking effort` hint is drawn in colours typed text never takes, so it is no draft. omp joins `REPORTS_TYPED`, with its typed colour `5;254` (default theme) in `TYPED_COLOURS`. A screen in 18.8.7's framed layout still goes to `ompInputRow`, which reports no cells, so such a send goes out as before. - The terminal peek is unchanged: it still reads omp with `ompInputRow`. The new recordings show it reading 18.14 screens as `gone`; that peek gap is a separate follow-up. - `src/lib/fixtures-input-rows/omp/draft-{empty,typed,lines,slash}-119.ansi`: recorded omp 18.14.0 screens, with a README section. - Tests whose herdr mocks did not expect the box read before an omp send now get an empty screen (`omp-submit`, `outcome-delivery`), as #3732 did for Codex and pi. Like every other agent's check, this refuses only on positive evidence. Typed text in a theme colour that was not recorded is still sent over, as on `main` (stated in the changelog). The race between the read and herdr's paste stays, as for Claude Code. ## Validation - Reproduced on `origin/main` (79420d0): `server/core/agent-input-send.test.ts` with omp's recorded typed, two-line and `/mo` drafts, before the fix: all three sends went through `agent.prompt`. - Live, against a real omp 18.14.0 in an isolated herdr session (`herdr --session ocb-rec`, scratch HOME, no sign-in), through `createSubmitText` on the real herdr socket. On `main`, a send over `leftover draft` was sent, and the box was empty afterwards (joined and submitted). On this branch it was refused with `input_draft`, the box still read `╰─ leftover draft`, and with the box cleared the next send went through. - `bun test server/core/agent-input-send.test.ts src/lib/inputRow.test.ts server/core/omo-pane-send.test.ts server/core/codex-own-screen-send.test.ts server/core/omp-submit.test.ts server/core/outcome-delivery.test.ts`: all pass. - `bun run check run bun test --timeout 15000 ./server/submit.contract.test.ts ./server/pending-input.contract.test.ts ./server/omp.contract.test.ts`: 249 pass, 0 fail. - `bun run check fast`: workflow syntax, types, themes, typecheck and build ok. Unit: 17249 pass, 1 fail. The failure is `server/machine-core-choice.test.ts`, which fails on its own run after run (17, 2 and 17 failures in three runs) and also fails on a checkout without this change (2 fail). It does not import anything changed here. - Skipped: browser regressions (no component changed), and a live omp run with a signed-in model and a custom theme. ## Follow-up (merge pass review of 360bce0) - A draft whose first editor row is empty and whose next row is indented past omp's three columns, or with an empty row between two of its rows, was missed and the send joined it. The editor's rows are now read while they are indented three columns or blank, up to the last indented one. - A draft that is exactly the hint's words (`⇧⇥ to change thinking effort`) read as empty. The hint is no longer stripped by its text: its cells are reported, and `typedDraft`'s colour test tells it from typed words, as for every other agent. - `src/lib/inputRow.test.ts`: all three cases, built from the recorded screens; the first fails at 360bce0. The recorded empty box still reads as no draft, and `/mo` still as one. - `bun run check fast`: all ok (unit 17251 pass / 0 fail / 54 skip).
Follow-up to #3732, #3752 and #3773: the same draft check for five more agents the agent lab runs. A chat send is refused with
input_draftonly when typed-looking text is seen inside the agent's recorded box; anything the bridge cannot make out sends as before.Cause
The agent lab's live re-run saw a chat send joined to a draft in Letta Code's, Gemini CLI's and Kilo's own box, and the audit found the same in code for maki and Kimi Code: none of them had a recorded box, so nothing was read before the paste.
Change
shared/input-row.ts, draft-check boxes (the terminal peek does not read them):›between full-width rules), maki (❯between full-width rules), Kimi Code (herdr'skimi,│ >in a rounded box), Gemini CLI (>between a▄row and a▀row), Kilo (the┃rows over its╹▀row, home screen and session alike, the last of them its agent and model line).TYPED_COLOURS: maki, Gemini and Kilo draw typed text in a colour of their own, listed as recorded with the default theme; Letta and Kimi Code use the terminal's.server/core/composer.tsfreeAgentInput: the viewport's colours count when its rows are the live screen's last ones. Gemini's live read holds a row more at its top than its viewport, so the two never matched and the box was never judged. At most two extra rows above are accepted, never different rows at the bottom.server/claude-input.ts: Claude Code's[...Truncated text #N +M lines...]placeholder (a paste it cut short) also withholds Send anyway, as[Pasted text …]does (from fix(chat): close the draft guard's review leftovers #3773's review).src/lib/compose.ts: a comment moved back above the branch it describes (from fix(chat): close the draft guard's review leftovers #3773's review).Validation
run --qa), Gemini CLI 0.68.0 on the team proxy (it speaks only the Gemini API); empty,leftover drafttyped,/motyped; Kilo also under its first answer (src/lib/fixtures-input-rows/<agent>/draft-*-119.ansi, README updated). Kilo's saved model was restored after its QA run, as the lab's README asks.createSubmitTextagainst the real herdr socket: for all five, a send overleftover draftwas refused withinput_draft, the draft stayed in the box and nothing was appended; with the box cleared, the next send went through. Before the zero-width and row-offset fixes, Letta's empty box was refused and Gemini's draft was sent over: both seen live, both fixed and re-run.src/lib/inputRow.test.ts: per agent, typed is a draft, empty is not, the/moscreen as stated; Kilo's session box reads as its home screen's; zero-width padding after Letta's cursor is no typed text. All fail onmain.server/core/agent-input-send.test.ts: an immediate send over each new agent's recorded draft is refused with nothing typed, and over its empty box goes through (the refusals fail onmain); a live read holding a row more above the viewport is still judged and refused (fails onmain); an agent with no recorded box gets no viewport read.server/submit.contract.test.ts: a box holding[...Truncated text #1 +40 lines...]offers no Send anyway, and a send anyway is refused (fails onmain).bun run check fast(through this PC's heavy-run queue): workflow syntax, generated types and themes, typecheck, build ok; unit tests 16609 pass, 0 fail.server/submit.contract.test.tsandserver/pending-input.contract.test.tsin full: 242 pass, 0 fail.