Skip to content

fix(chat): refuse a send over text typed in Letta's, maki's, Kimi Code's, Gemini's or Kilo's box - #3775

Merged
devswha merged 2 commits into
mainfrom
fix/lab-agent-draft-guard
Nov 12, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/lab-agent-draft-guard

Conversation

@devswha

@devswha devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner

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_draft only 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):
    • Letta Code (› between full-width rules), maki (❯ between full-width rules), Kimi Code (herdr's kimi, │ > 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.
    • A character that draws nothing is no typed text: Letta pads its empty box with zero-width characters after its cursor, which read as typed before.
  • server/core/composer.ts freeAgentInput: 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).
  • Not covered, and in the changelog: a slash command Kimi Code or Gemini CLI draws in its command colour, and typed text in a theme colour that was not recorded. omp, Devin and Grok are not here: they need the owner's own sign-ins.

Validation

  • Recorded in the agent lab (its own HOME, pinned installs, update checks off) inside an isolated herdr session at 119×40: Letta Code 0.34.23, maki 0.7.1, Kimi Code 2.5.3 and Kilo 7.8.27 on the lab's QA backend (run --qa), Gemini CLI 0.68.0 on the team proxy (it speaks only the Gemini API); empty, leftover draft typed, /mo typed; 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.
  • Live, same session, through createSubmitText against the real herdr socket: for all five, a send over leftover draft was refused with input_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 /mo screen 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 on main.
  • 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 on main); a live read holding a row more above the viewport is still judged and refused (fails on main); 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 on main).
  • 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.ts and server/pending-input.contract.test.ts in full: 242 pass, 0 fail.
  • Not run: the browser regressions (no component changed; the peek's recognizers are untouched).

…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.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Sends are now blocked when unsent text is detected in Letta Code, maki, Kimi Code, Gemini CLI, and Kilo input boxes; the text remains in the composer.
    • Detection now handles extra content above the visible input and ignores invisible characters that could be mistaken for typed text.
    • “Send anyway” is withheld for Claude Code pastes truncated into the recognized placeholder.

The PR adds draft detection for Letta, maki, Kimi, Gemini, and Kilo input boxes, adjusts viewport matching, and extends Claude folded-placeholder matching to include truncated pastes.

Changes: Agent draft guard

Layer / File(s) Summary
Recognize drafts in five agents
shared/input-row.ts, src/lib/inputRow.test.ts
Adds input-box recognizers and typed-text colors for five agents. Tests cover typed, empty, and selected slash-command screens, including zero-width padding.
Match live screens and refuse sends
server/core/composer.ts, server/core/agent-input-send.test.ts, src/lib/compose.ts
Viewport reads can match trailing live-screen rows when up to two rows are added above them. Send-guard tests cover the five agents and a Gemini viewport case. The src/lib/compose.ts change only reorders comments.

Claude truncated-paste guard

Layer / File(s) Summary
Recognize truncated-paste placeholders
server/claude-input.ts, server/submit.contract.test.ts, changelog.d/lab-agent-draft-guard.md
Placeholder matching now recognizes truncated-text forms with optional line-count suffixes. The contract test matrix and changelog include a truncated-paste case.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

  • Issue 3563 reports that a [Pasted text #N] placeholder is counted as typed draft. This PR changes the related folded-placeholder matching, but the summary says it does not change that specific Pasted-text behavior.
  • Issue 3769 reports missed multi-row drafts for newer agents. This PR adds draft checks for the same agents and adjusts viewport matching, but the supplied summaries do not establish that all multi-row cases are fixed.

Possibly related PRs

  • devswha/ovis#3752: Both PRs change the shared typed-draft detection path and recognizer registry.
  • devswha/ovis#3732: This PR extends the shared input-row draft guard and its send-refusal flow.
  • devswha/ovis#3773: Both PRs change Claude folded-placeholder matching used to withhold “Send anyway.”

Suggested reviewers: jpcarranza94

Merge Risk: Minimal · up to b9063

This change adds draft checks for five agents and withholds Send over Claude's truncated-paste placeholder. The documented gaps, such as command-coloured slash commands, send as before. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: refusing a send over typed text in five named agents' input boxes (Letta, maki, Kimi Code, Gemini, Kilo). It matches the objectives and the changeset, and it is specif…
Description check Passed The description follows the template's main parts. It has a Change section that explains the cause and the changes, and a Validation section that lists the checks run, their results, and what was skip…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: refusing a send over typed text in five named agents' input boxes (Letta, maki, Kimi Code, Gemini, Kilo). It matches the objectives and the changeset, and it is specific enough for a teammate scanning history. It is long (96 characters) but still one clear sentence.

Full details: Description check

Explanation

The description follows the template's main parts. It has a Change section that explains the cause and the changes, and a Validation section that lists the checks run, their results, and what was skipped. It also includes contract-test coverage for the HTTP/WS-related submit path, and it links the follow-up issues. The template's reference to the changelog is not addressed, since the description does not mention the changelog.d entry. That gap is minor.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7c7546e and b906328.

Files ignored due to path filters: 19

  • src/lib/fixtures-input-rows/README.md is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/gemini/draft-empty-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/gemini/draft-slash-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/gemini/draft-typed-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kilo/draft-empty-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kilo/draft-session-empty-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kilo/draft-session-slash-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kilo/draft-session-typed-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kilo/draft-slash-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kilo/draft-typed-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kimi/draft-empty-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kimi/draft-slash-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/kimi/draft-typed-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/letta/draft-empty-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/letta/draft-slash-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/letta/draft-typed-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/maki/draft-empty-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/maki/draft-slash-119.ansi is excluded by !src/lib/fixtures-input-rows/**
  • src/lib/fixtures-input-rows/maki/draft-typed-119.ansi is excluded by !src/lib/fixtures-input-rows/**
Files selected for processing: 8

  • changelog.d/lab-agent-draft-guard.md
  • server/claude-input.ts
  • server/core/agent-input-send.test.ts
  • server/core/composer.ts
  • server/submit.contract.test.ts
  • shared/input-row.ts
  • src/lib/compose.ts
  • src/lib/inputRow.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@devswha
devswha merged commit 4c76778 into main Nov 12, 2026
20 of 21 checks passed
@devswha

devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head b90632837f40 as 4c76778ac36f on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
codex CLEAR

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 input_draft when the agent's own input box holds typed text. Recorded screens of each agent are the tests; 257 unit tests pass at this head.

The merge pass ran typedDraft on pi's recorded typed screen at this head and on main with the drafts earlier rounds turned on (> quote, → note, and the two-row draft of #3769): all four are refused on both, so this PR keeps what #3752 and #3773 closed.

Left, none HIGH (the lane is closed; follow-up issue below):

  • MEDIUM (Claude, reproduced at the parser on a constructed screen): Kilo's editor walk skips blank rows, so with the reply rows of the recorded session screen blanked it climbs into the user's own message above the box, which is drawn in Kilo's typed colour, and an empty box reads as a draft. A send is then refused where main sends; nothing is lost. Whether a live Kilo leaves those rows blank was not checked.
  • LOW (Codex, reproduced): a draft made only of private-use glyphs (U+E0B0) no longer counts as typed in the agents guarded before; a character under Letta's cursor, drawn inverse, reads as no draft. LOW (Claude, read): the viewport/live agreement is loosened by two rows for every agent, measured only on Gemini (server/core/composer.ts:313).

Reports: ~/.cache/ovis-tmp/reports/pr-3775-b9063283-*.report.md.

Merged with one check not green: Native macOS session identity, not a required check, was cancelled after 15 minutes because its runner is offline; this PR touches none of the six test files it runs.

@devswha

devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Correction from the merge pass: the Native macOS session identity job this PR merged without was not cancelled because a runner of ours is offline. It runs on GitHub's hosted macos-15, and GitHub cancelled it after it found no macOS arm64 runner ("not acquired by Runner of type hosted ... capacity constraints"). The rest stands: it is not a required check and this PR touches none of the six test files it runs.

devswha added a commit that referenced this pull request Nov 15, 2026
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).
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.

1 participant