Skip to content

bridge: stop prompts from leaving a turn stuck (card refusals, claude questions and mcp forms) - #168

Merged
morajabi merged 3 commits into
mainfrom
bridge-prompt-gaps
Nov 23, 2026
Merged

morajabi merged 3 commits into
mainfrom
bridge-prompt-gaps

Conversation

@morajabi

Copy link
Copy Markdown
Contributor

Part of closing every way a bridge prompt can leave someone stuck with nothing to press. An audit of both harnesses on main split the work three ways: Codex prompt shapes (incl. the MCP tool approval with no buttons) are in the Codex approval-cards branch, a message typed while an approval waits is in #167, and this PR covers the rest.

Both harnesses

  • A card Inline refuses twice used to leave its request pending and say "Continue in the terminal", which bridge users don't have. Now the request is cancelled as the owner and the chat says it was declined, so the agent goes on. Form cards skip the plain-text retry, which couldn't be answered.
  • Tapping a card from before a bridge restart now says "This request is no longer pending." instead of nothing.

Claude Code

  • AskUserQuestion questions with a newline or very long text were dropped, which could leave an empty card. Fields are now keyed by position; answers still go back keyed by question text. Two shared harness fixtures changed from text IDs to q0.
  • A declined MCP elicitation or unsupported dialog now shows in the chat (server and what it asked). It used to be a warning that only reached the logs.
  • A deny-rule permission suggestion is no longer offered: it could only be sent as an allow answer, which would run the refused tool.

Tests: 1,131 CLI, 395 agent-bridge and 80 Claude driver tests pass, and clippy is clean. New mapper tests cover the long question, the deny suggestion and the declined form. The refused-card cancel isn't covered by a test: the bridge tests can't make Inline refuse a post without a fake API.

🤖 Generated with Claude Code

…s, and stop offering deny rules that allow

- askuserquestion fields are keyed by position instead of question text. a
  question with a newline or over the id limit used to be dropped, which could
  leave a card with nothing to answer. answers still reach claude keyed by the
  full question text.
- a declined mcp elicitation or unsupported dialog is an error notice, so it
  shows in the chat with the server and what it asked. as a warning it only
  reached the logs and the tool silently didn't run.
- a permission suggestion with a deny rule is no longer offered: its only way
  back is an allow answer, which would run the tool the person refused.
…t a terminal

a card inline refused twice left its request pending and told the person to
"continue in the terminal", which a bridge user doesn't have, so the turn
waited forever. the request is now cancelled as the owner, the way a released
session cancels its open requests, and the chat says it was declined so the
agent goes on. a form card skips the plain-text retry, which kept no way to
answer it. tapping a card from before a restart now says the request is no
longer pending instead of doing nothing.
…single-choice questions answerable as text, and post no ghost card

from the pre-merge review:
- the cancel posted the refused card again as a new "answered by" message,
  since closing it rendered a card update for a card never shown. the
  renderer now forgets the interaction before the cancel.
- a request from before a restart (or one that ended while its card was
  retried) is left alone: its id could name another request of the new
  session, and there is nothing to answer.
- a request that ended meanwhile gets no "/stop" notice.
- only a form drawn as fields skips the plain-text retry; single-choice
  questions keep their buttons as text, as before.
- a declined mcp form quotes at most 160 characters of the server's message.
@morajabi
morajabi merged commit 47c2313 into main Nov 23, 2026
52 checks passed
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