Skip to content

fix(chat): refuse a chat send over an agent's own start-up menu, and show it as a card - #3744

Merged
devswha merged 3 commits into
mainfrom
fix/send-over-agent-menu
Nov 12, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/send-over-agent-menu

Conversation

@devswha

@devswha devswha commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Change

Some agents draw a picker of their own at start, and herdr reports the agent at rest under it: Devin's "Do you trust the authors of this directory?", Copilot's "Confirm folder trust" (every start, --continue too) and Antigravity's "Do you trust the contents of this project?". There was no card, and a chat message went through agent.prompt: its paste and Enter picked the row under the cursor ("Yes, trust"), and the message was lost. The chat audit hit this live on Devin (C17, C21) and Copilot (C9, C21).

  • server/dialogs/fallback.ts agentPickerOwnsScreen: a picker owns the input when one of the screen's last two lines is a key hint that both moves (↑↓, ↑/↓, up/down) and chooses with Enter (↵, ⏎, enter), and a row under a cursor marker (❯ › > ❭) is in the 8 lines above it. Composers and footers do not match. Devin's, Copilot's and Grok's own composers are covered by tests.

  • server/dialogs/registry.ts agentPickerWaits: checked only for agents with no reader (SCREEN_READ_AGENTS, the list readKnownPrompt already used, now named). Claude, Codex, omp and the others keep their own readers' rules.

  • Send refused (agent_blocked, nothing typed, the text stays in the composer):

    • immediate sends: freeAgentPicker in core/composer.ts, the last read before agent.prompt, as freeCodexInput does for Codex's own screens;
    • queued sends: pendingContext and the last check before the paste in core/pending.ts. As with Codex's own screens, nothing tells when the picker is answered, so a queued message refused for it is held for its Send now (CodexOwnScreenRefusal, now taking the message) and never sent by itself later.
  • Card shown: fallbackCard also offers the generic card while herdr reports such an agent at rest, but only when its picker owns the screen. The screen is read for that only for agents with no reader. Answering the card goes through POST /api/pane/prompt/answer as before.

  • Copilot's boxed menus get their rows as options. Copilot draws its numbered menus inside a box (│ ❯ 1. Yes │): folder trust, and command and edit approvals. The fallback reader's numbered-menu rule did not see through the borders, so these got only ↑ ↓ Enter Esc. unboxed takes the side borders off for that rule, keeping the indentation inside, so each row is an option answered by its number. This is how the fallback card already answers a bare numbered menu.

This follows #3730 (merged), which made generic cards for these agents answerable at all. Rebased over #3732 (chat-draft-guard, merged): its freeAgentInput refuses a send over text typed in an agent's own input box (input_draft), and this PR's freeAgentPicker follows it for agents with no reader. The two never apply to the same screen: a picker owns the input, so no box is drawn. Both suites pass together.

Screenshots (390 wide, real Devin 3000.12.43 in an isolated herdr session)

Before (main) After
before no card while the trust question is up after the trust question as a card; "hello devin" refused and kept in the composer
before after sending "hello devin": Devin trusted the folder, and the message is gone after Enter pressed on the card: Devin trusted the folder and starts

Copilot 1.0.109's command approval on this branch: card. It shows "Yes" and "No, and tell Copilot what to do differently" as options, and pressing Yes ran echo audit-check > out.txt (out.txt holds audit-check).

Validation

  • Live, Devin 3000.12.43 (signed in on this PC), isolated herdr --session ovis-cards, scratch folders:
    • main: a chat send over the trust question pressed "Yes, trust", and the message was lost;
    • this branch: the send was refused, the screen was unchanged, and the card's Enter answered it (outcome=ok).
  • Tests (failing-first):
    • server/fallback-answer.test.ts: the picker check against recorded Devin, Copilot and Antigravity trust screens and Devin, Copilot and Grok composers. Devin's trust card is shown and answered while herdr says idle; it fails without this branch's prompt.ts change. No card for Devin's composer, nor for a reader agent (Claude) on a picker-shaped screen.
    • server/fallback-answer.test.ts also covers Copilot's boxed menus (its command approval and folder trust): each row is offered and answered by its number. Both fail without unboxed.
    • server/core/input-line-send.test.ts: an immediate send over Devin's trust writes nothing and refuses with agent_blocked. It fails without the composer check.
    • server/core/pending-birth-guard.test.ts: a queued message is held over Devin's trust at the turn's end, and when the trust comes up during the last checks. 2 fail without the pending check. A queued message into Devin's composer still goes.
  • bun run check fast (through the heavy queue) after rebasing over fix(chat): refuse a chat send over text typed in the agent's own input box #3732: all ok, unit 16410 pass, 0 fail, 54 skip in 913 files, 8 at a time, 218.8s. server/core/agent-input-send.test.ts (fix(chat): refuse a chat send over text typed in the agent's own input box #3732's) passes alongside this PR's tests: 96 pass.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Folder-trust prompts from Devin and Copilot can appear as answerable chat cards, including when the agent is idle.
    • Numbered Copilot menus are presented as selectable options.
  • Bug Fixes
    • Chat messages are held while an agent is waiting for a folder-trust decision, preventing them from being sent into the prompt unexpectedly.

The change detects agent-owned picker screens, presents fallback cards for recognized prompts, and blocks direct and queued message sends while a picker is active.

Changes: Agent picker handling

Layer / File(s) Summary
Detect picker screens and offer fallback cards
server/dialogs/fallback.ts, server/dialogs/registry.ts, server/prompt.ts, server/fixtures/*, server/fallback-answer.test.ts
The fallback parser recognizes agent-owned picker screens and removes Copilot-style box borders before detecting numbered menus. The fallback-card path evaluates picker screens for agents outside SCREEN_READ_AGENTS. Tests cover Devin trust prompts while idle, Copilot numbered choices, and screens that do not produce fallback cards.
Block sends while picker prompts are active
server/core/composer.ts, server/core/pending.ts, server/core/input-line-send.test.ts, server/core/pending-birth-guard.test.ts, changelog.d/agent-picker-send-guard.md
The composer refuses a send when an agent-owned picker is detected. Pending-message checks also refuse picker screens. Tests cover immediate sends and queued messages, including picker screens detected at drain time and during pre-paste checks. The changelog describes the send guard and fallback cards.

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

Change: Bug fix

Suggested reviewers: homebodify

Merge Risk: Minimal · previous review 43860

The change refuses chat sends over Devin and Copilot start-up pickers and shows the question as an answerable card. Typical layouts are covered. In a very narrow terminal the picker footer could wrap and slip past detection, but that is a rare edge case and does not block merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the primary change: refusing a chat send over an agent's own start-up menu and showing it as a card. The changeset adds agent-picker detection, refuses immediate and queued sends with …
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.
Description check Passed The description follows the template with both required sections, "Change" and "Validation". The Change section states the problem (agent start-up pickers swallowing chat sends), lists the code change…
Full details: Title check

Explanation

The title names the primary change: refusing a chat send over an agent's own start-up menu and showing it as a card. The changeset adds agent-picker detection, refuses immediate and queued sends with agent_blocked, and offers a fallback card. The title also mentions Copilot-style scope only implicitly, which is acceptable because it need not cover every detail.

Full details: Description check

Explanation

The description follows the template with both required sections, "Change" and "Validation". The Change section states the problem (agent start-up pickers swallowing chat sends), lists the code changes by file, and describes the resulting refusal and card behavior. It links the prior PRs #3730 and #3732 but does not link a maintainer-agreed issue, which the template asks for on feature work. The Validation section lists the live Devin check, the targeted test files with pass/fail-first results, and the full bun run check fast run with counts. It does not mention the contract-test coverage the template asks for on HTTP changes; the change adds a new POST /api/pane/prompt/answer usage path but no HTTP route change, so this gap is minor. The description also includes a before/after table of screenshots, which adds context beyond the template.

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 d505c75 and 43860c4.

Files selected for processing: 14

  • changelog.d/agent-picker-send-guard.md
  • server/core/composer.ts
  • server/core/input-line-send.test.ts
  • server/core/pending-birth-guard.test.ts
  • server/core/pending.ts
  • server/dialogs/fallback.ts
  • server/dialogs/registry.ts
  • server/fallback-answer.test.ts
  • server/fixtures/copilot-1.0.109-composer.txt
  • server/fixtures/copilot-1.0.109-run-command.txt
  • server/fixtures/devin-3000.12.43-composer.txt
  • server/fixtures/devin-3000.12.43-trust.txt
  • server/fixtures/grok-1.0.77-composer.txt
  • server/prompt.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.

…d show it as a card

Devin's, Copilot's and Antigravity's folder trust is a picker herdr reports as
the agent at rest, so a chat message's paste and Enter picked "Yes, trust" and
the message was lost. For agents with no reader, a picker that owns the screen
(a move-and-Enter key hint under a cursor row) now refuses immediate and queued
sends with agent_blocked, a queued one held for its Send now, and the fallback
card answers it while herdr reports the agent idle.
Copilot draws its folder trust and command and edit approvals in a box, so the
fallback card's numbered-menu rule did not see its rows and offered only arrow
keys. The side borders are taken off for that rule, so each row is an option
answered by its number.
@devswha
devswha force-pushed the fix/send-over-agent-menu branch from 43860c4 to b7caebf Compare November 12, 2026 10:03
@devswha

devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Merge pass review at b7caebf: Claude (Opus) CLEAR, Codex BLOCK. It needs one push before it can merge.

HIGH, both reproduced by the reviewer in unit tests (the merge pass reproduces them itself at the next head if they remain):

  1. A picker's hint line wrapped across two rows bypasses the guard: with the recorded Devin trust fixture and that line split, agentPickerOwnsScreen returns false and the mocked immediate send calls agentPrompt once. Join wrapped rows before matching the hint.
  2. A picker can open after the guard and before the raw fallback send: the first read is the recorded Devin composer, agentPrompt changes the screen to the trust fixture and rejects, and the fallback then pastes. Check the picker again on the last read before the fallback paste.

LOW (Claude): the picker rule is structural and also matches a composer's own prompt row (none of the 215 recorded screens match wrongly); the last check before a queued paste ignores the agent's status, so a real approval holds the whole queue; idle agents with no reader now get a screen read every 500 ms while a prompt is watched; the boxed-menu fix applies to every agent, not only Copilot.

…efore the fallback paste

A narrow pane wraps a picker's key hint onto two rows, neither of which both moves
and chooses: agentPickerOwnsScreen now also reads two rows joined. And a picker can
come up after the read before agent.prompt: when herdr refuses the prompt, the screen
is read for one again right before the raw paste that follows.
@devswha

devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Answers to the merge pass review at b7caebf, fixed in dff11f1.

HIGH 1, a wrapped key hint (fixed). Reproduced first: with the recorded Devin trust and its hint split across two rows (after ↑↓ sel, ↑↓ select ·, ↑↓ select · ), and a worded hint wrapped inside a word (up/down to move · en / ter to select), agentPickerOwnsScreen returned false (4 new cases in server/fallback-answer.test.ts, all failing at b7caebf). It now also reads two rows joined, with a space and without one, ending on the last row or the one before it; the cursor row is looked for above where the joined hint starts.

HIGH 2, a picker that opens after the guard (fixed). Reproduced first in server/core/input-line-send.test.ts: the first read is the recorded Devin composer, agentPrompt turns the screen into the trust fixture and rejects with agent_not_ready, and at b7caebf the raw fallback then pasted. The screen is now read for a picker once more right before that paste (freeAgentPicker on the last read, after mirrorInput), for the same agents no reader knows; the send is refused with agent_blocked and nothing is typed.

LOW (Claude), answered without code changes:

  • The rule is structural and could match a composer's own prompt row. Agreed, it is a guess from the screen. None of the 215 recorded screens match wrongly, and a wrong match fails safe: the send is refused, the text stays in the composer, and the card is offered. A new agent's composer that matches gets a negative fixture then.
  • The last check before a queued paste ignores the agent's status. Only for a screen that turns into a picker or approval in the short window between pendingContext and the paste: there the message is held for its Send now instead of retried by itself. Nothing is typed into the approval and nothing is lost; pendingContext itself still refuses a blocked agent as before.
  • Idle agents with no reader get a screen read per watch pass. Accepted: one pane.read per idle pane of such an agent (Devin, Copilot, Antigravity, Grok and the like), which is what showing their picker as a card needs, since herdr reports them at rest under it.
  • The boxed-menu fix applies to every agent. It applies only where the fallback card is drawn at all, and it offers a boxed numbered menu's rows answered by their number, as the fallback card already does for the same menu drawn bare. The Copilot command approval and folder trust are tested.
  • (receipt) freeAgentPicker's read failing fails the send: it fails safe, nothing typed.

Validation at dff11f1: the new tests fail at b7caebf and pass now. The related files (input-line-send, fallback-answer, pending-birth-guard, agent-input-send, prompt.test, server/dialogs) pass: 997 pass, 0 fail across 23 files. bun run check fast (through the heavy queue): all ok, unit 16415 pass, 0 fail, 54 skip in 913 files, 145.0s. Not run: the integration and browser suites.

@devswha
devswha merged commit 5f7f668 into main Nov 12, 2026
21 checks passed
@devswha

devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head dff11f1546d7 as 5f7f6689aba1 on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
codex CLEAR (reported BLOCK) Second round. The one HIGH needs Devin's folder-trust menu to appear inside the fixed wait between the fallback paste and its Enter, after the composer was read twice; origin/main does the same paste, wait and Enter with no picker check at all (server/core/composer.ts:747-748, read by the merge pass), so this is no regression but a limit of a guard that only narrows the window. Documented in the merge note with the MEDIUM

Two reviewers at this head: Claude (Opus) CLEAR; Codex Terra BLOCK, cleared by the merge pass as a documented limit (below). Two heads were reviewed. It changes the chat send path and queued input, so a real review.

A chat send to an agent with no reader of its own (Devin, Copilot, Antigravity and others) is refused while the agent's own start-up menu (folder trust, a picker) owns the screen, and the menu is shown as a card; until now the message was pasted into the menu and its Enter chose the highlighted row. A queued message behind such a menu is held, with those behind it.

Closed in review, each reproduced by the Codex reviewer with a failing unit test on the first head: a picker whose key hint wraps over two rows passed the guard; a picker that opened after the guard and before the fallback paste took the paste. The Opus reviewer removed each of the two new checks in turn at this head and saw its test fail, and ran the detector over every recorded screen: no recorded idle input screen of an agent it applies to matches.

Documented limit (Codex's HIGH at this head): if the menu appears inside the fixed wait between the fallback paste and its Enter, the Enter still goes out. main does that paste, wait and Enter with no check at all, so the PR narrows the window and does not open one; checking once more before the Enter, and reporting a partial send, is the follow-up.

Left, none a regression:

  • MEDIUM (Codex, reproduced on two constructed variants of the recorded Antigravity trust screen): a detected picker can get a card with no way to move its selection.
  • LOW (Claude): the last check before a queued paste ignores herdr's status, so a real approval that comes up in that moment holds the message until Send now (it was pasted into the approval on main); agents with no reader get one more screen read on each chat poll and prompt-watch tick, working panes too; a false match of the detector cannot be overridden with a "send anyway".

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

@devswha
devswha deleted the fix/send-over-agent-menu branch November 12, 2026 13:15
devswha added a commit that referenced this pull request Nov 13, 2026
From the merge pass's review of this PR:
- A question left on the screen with other output under its key hint (a shell's
  prompt, after Antigravity exited while herdr still names the pane agy) was
  still read as the same card, so its answer's keys would go to whatever has the
  pane. The question and the write-in field now count only when their key hint
  ends the screen, with at most Antigravity's own status row under it.
- main's test of this question as a generic fallback card (from #3730) is moved
  to the reader: the card now lists the question's options.
- The merge of main keeps Antigravity out of SCREEN_READ_AGENTS, so its folder
  trust at start keeps the send guard and card of #3744, and names it where the
  prompt read picks its readers.
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