Skip to content

Show agent questions bb could not show: optional questions, ACP Other folding, 10-question cap, long titles - #6518

Merged
ymichael merged 5 commits into
mainfrom
bb/question-forms-optional-questions-acp-folding-ca-thr_zgigarb2pw
Oct 29, 2026
Merged

ymichael merged 5 commits into
mainfrom
bb/question-forms-optional-questions-acp-folding-ca-thr_zgigarb2pw

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb's user question could not say that a question is optional, and it allowed at most 4 questions. Several paths also turned "bb could not show this" into a statement about the user:

This replaces #6476 with a smaller scope: no shared Codex/ACP form translator, no new plugin-SDK subpath, and Codex's form parser is unchanged.

What changed

  1. Optional questions (6dbd15064b).
    • PendingInteractionUserQuestionQuestion gains required; questions persisted before this change parse as required.
    • The shared question form labels optional questions "Optional" and lets you submit without them.
    • The server accepts a missing or empty answer only for optional questions.
    • The CLI's bb thread interactions show prints Optional: may be left unanswered, and answer accepts answers that skip optional questions. The guide template is updated.
    • Existing providers set required: true explicitly.
    • Wire change: HOST_DAEMON_PROTOCOL_VERSION 257 → 258, because an older daemon parses interaction payloads with the old schema and would drop required: false.
    • Plugin SDK 0.6.97 → 0.6.98, because the SDK's bundled types include the user question type.
  2. ACP fixes, in ACP's own parser (04514cb8af).
    • Fields not listed in requestedSchema.required become optional questions; unanswered ones are left out of content.
    • A choice field X absorbs an optional plain-text X__other or X_other field into one question with free text. If the choice has an other value, that option is hidden and typed text selects it (Droid). Otherwise typed text goes only to the companion field (omp). A required choice without an other value keeps its companion as a separate question. Option labels are never matched.
    • The question cap is counted after folding.
    • A form bb cannot show is answered with a JSON-RPC error (-32602, bb cannot show this form: <reason>) instead of a decline.
  3. Cap raised to 10 questions (030c89be6c): USER_QUESTION_MAX_QUESTIONS, plus the ask-user-question tool's schema, description and overview.
  4. Long titles shortened, not rejected (8d247d87c1).
    • Pi: accepts long extension dialog titles, shortens the card heading to 160 characters, and carries the full title in the payload (fullTitle), which the card shows.
    • Codex async questions: shortens the heading; the card already shows the full question.
  5. Question tabs on narrow cards (771e53b6f1). With more questions, the tab row ran off phone-width cards.
    • Whenever the current question changes, only the tab row scrolls, so the current tab sits clear of the edge.
    • Each edge with more tabs past it fades into the card's surface-recessed-solid background; nothing fades when every tab fits.
    • OverflowFade gains a surface-recessed tone.

Still reported as a cancel or decline

  • omp 18.0.5: bb now sends the error, and omp's log shows it received RequestError: bb cannot show this form: bb shows at most 10 questions and this form has 11 (code -32602). But this omp version treats an error, a decline and a cancel the same way and tells its model "Ask tool was cancelled by the user". Fixing what the model sees needs a change in omp.
  • Pi: Pi's RPC protocol has no error response. A malformed request, a failed hand-off to bb, or an error coming back from bb still reaches the extension as { cancelled: true }. Shortening titles removes the common cause.
  • ACP, failed hand-off: a question that fails to reach bb after planning, including a daemon interrupt, still answers the agent with cancel.
  • ACP, unreadable answer: a typed answer that does not fit its field (for example "abc" for a number) still declines the whole form, as before.
  • ask-user-question: a question header over 160 characters makes the tool call fail with an error that reaches the agent as a tool error, not a decline.

How you verified

Regression tests (each fails on main, passes here):

  • ACP planner: omp and Droid folding, required handling, the cap counted after folding, and Other labels not treated as the other value.
  • ACP bridge, through a fake ACP agent: both folding conventions end to end, and an unshowable form answered with an error.
  • Server public interactions route: optional answers.
  • CLI answer with an optional question skipped.
  • Shared question form: optional submit and the tab scrolling and fades.
  • ask-user-question: tool schema and a seven-question call.
  • Pi coordinator: titles of 160, 161, 200, 201 and 4096 characters.
  • Codex async questions: a long title.
  • Daemon contract: rejects 257, accepts 258.

Suites:

  • pnpm exec turbo run lint typecheck --filter='...[origin/main]' passes (153 tasks).
  • Full suites pass for @bb/server (3726), @bb/app (6414), @bb/provider-bridge-acp, @bb/domain, @bb/host-daemon-contract, @bb/cli, @bb/shared-ui, @bb/thread-view, @bb/plugin-registry, and the plugins provider-codex, provider-pi, provider-claude-code, ask-user-question and push-notifications.

Live, against pnpm start:worktree for this branch and for origin/main, with real agents:

Issue Agent Main This branch
#6031 omp 18.0.5 ask, 1 question 2 questions; bb thread interactions answer with only the choice fails: Missing answer for question 'q0__other' 1 optional question. Typed "gamma-hotfix" via Other in the UI; omp replied You picked: gamma-hotfix
#6508 / #6266 cap omp, 5 questions (10 fields) No card; "The agent asked a question bb could not show" One card, 5 tabs. Answers (including custom text and a skipped question) reached omp
#6266 error omp, 11 questions Declined bb sends the error (see omp caveat above)
#3264 Pi + AskUserQuestion, 7 questions The model sent only D1–D4 because of the 4-question limit One card, D1–D7; all 7 answers reached Pi
#4264 Pi Pi 1.4.0 extension ui.select with a 239-character approval title No card; the extension got CANCELLED Shortened heading with the full title in the card; the extension got Allow for session
#4264 Codex codex-cli 0.164.0 request_user_input_async (model gpt-6.1-terra), 212-character question {"accepted":true} but no card; server log: ui.requestInput title must be 1-160 characters Card opened; the answer went back and Codex continued

The tab strip was checked at 390px with 5 and 10 omp questions (first, middle and last question) and at 1280px. Screenshots were taken in light mode at desktop and phone widths.

Not run live: Droid (#6131), because it is not installed on the test machine. Its question_N / question_N_other shape is covered by the planner and bridge tests only.

Fixes #6031
Fixes #6131
Fixes #6266
Fixes #6508
Fixes #3264
Fixes #4264

🤖 Generated with Claude Code

AGENT GENERATED

ymichael and others added 5 commits October 28, 2026 21:22
A user question now carries `required`. Optional questions can be left
blank: the shared question form labels them "Optional" and submits
without them, the CLI lists them and accepts answers that skip them, and
the server accepts a resolution with no answer or an empty answer for
them. Questions persisted before this change parse as required.

Providers that build questions set the flag explicitly; every existing
question stays required.

Raises HOST_DAEMON_PROTOCOL_VERSION to 258: an older daemon parses
interaction payloads with the old schema and would drop
`required: false`. Bumps the plugin SDK to 0.6.98 because its bundled
types include the user question type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s errors

ACP form elicitations now follow requestedSchema.required: a field it
does not list becomes an optional question, and an unanswered optional
question is left out of the content sent back.

A choice field X absorbs an optional plain-text field X__other (omp) or
X_other (Droid) into one question with free text. When the choice has
an `other` value, that option is hidden and typed text selects it
alongside the companion (Droid); otherwise typed text goes only to the
companion (omp). A required choice without an `other` value keeps its
companion as a separate question, since typed text alone could not fill
it. Option labels are never matched.

The question cap is counted after folding, so a four-question omp or
Droid form (eight fields) is shown.

A form bb cannot show is answered with a JSON-RPC error carrying the
reason, so the agent no longer reads it as the user declining.

Fixes #6031
Fixes #6131

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Raises USER_QUESTION_MAX_QUESTIONS and the ask-user-question tool's
question cap from 4 to 10, and tells the model so in the tool schema.
The card already shows one tab per question and the tab strip scrolls,
so a planning round of seven decisions arrives as one card instead of
two, and a five-question omp form (ten ACP fields) is shown.

Fixes #3264
Fixes #6266
Fixes #6508

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Core rejects an interaction title longer than 160 characters, so a long
title meant the question never appeared:

- Pi accepted extension dialog titles up to 200 characters and answered
  anything longer, or anything core then rejected, with
  `{ cancelled: true }`, which the extension reads as the user
  declining. Pi now accepts long titles, shortens the card heading to
  160 characters, and carries the full title in the payload so the card
  still shows all of it.
- Codex async questions used the raw question text as the title, so a
  question over 160 characters failed to open. The heading is now
  shortened; the card already shows the full question.

Fixes #4264

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With five or more questions on a phone-width card, the tab row ran off
the edge: Next or a number shortcut could move to a question whose tab
was scrolled out of sight, and nothing showed that the row continued.

The row still scrolls on its own, but whenever the current question
changes it now scrolls just that row (never the card or timeline) so the
current tab sits clear of the edge. Each edge that has tabs past it
fades into the card's surface-recessed-solid background; no fade shows
when every tab fits. OverflowFade gains that surface-recessed tone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 272fcc9 into main Oct 29, 2026
51 checks passed
@ymichael
ymichael deleted the bb/question-forms-optional-questions-acp-folding-ca-thr_zgigarb2pw branch October 29, 2026 04:43
mistakeknot added a commit to mistakeknot/aleph that referenced this pull request Nov 3, 2026
Aleph upstream step: sync through get-bb#6518 (272fcc9790), PR 102
ymichael added a commit that referenced this pull request Nov 18, 2026
## Human comments

## What was wrong

When a question or permission request ended for any reason other than
the user, each bridge chose its own answer, usually the protocol's "the
user cancelled" or a bare error, and nobody told the user. The runtime
gives a bridge only an error string when bb stops waiting. ACP answered
`cancel`/`decline`/`cancelled`, and Pi answered `{cancelled:true}`.
Codex answered `cancel` for MCP elicitations and a bare JSON-RPC error
for approvals and requestUserInput, which Codex itself reports to the
model as the user declining (#4645). Claude Code denied with an internal
message. ACP also silently cancelled the open question of an
agent-initiated turn when the user sent a new prompt, so the card stayed
open in bb and any later answer went nowhere. Two other places had the
same shape. `ask-user-question` turned every non-timeout cancellation
into "the user dismissed the question" (#7347). The plugin enable and
settings-save routes returned `ok` when the plugin failed to load,
because the service dropped `loadOne`'s problem. #5534 patched enable in
the CLI only.

Reproduced live on main (1fa400d) before the fix. In a source build,
a Pi extension command opened a `select` whose title was 9,010
characters. The bridge failed validation and answered
`{cancelled:true}`, and the extension recorded `answer: null`. The
thread showed nothing: no pending interaction and no warning. This is
the #4264 / #7647 shape.

## What changed

- **Guard, derived from each bridge's question kinds.**
`packages/provider-bridge-protocol/src/contract-tests/unanswered-interactions.test.ts`
loads each first-party bridge in-process and drives every question kind
it routes through six cases: unshowable request, runtime error (bb
stopped waiting), unreadable resolution, unmappable answer, withdrawn
question, and stopped turn. Each bridge's rows come from a list its own
dispatch code uses: ACP from `ACP_QUESTION_REQUEST_METHODS` (the handler
map `handleAgentRequest` dispatches through), Pi from
`PI_EXTENSION_DIALOG_METHODS` (the enum its request schema validates)
and Codex from `CODEX_QUESTION_REQUEST_METHODS` (the gate
`decodeCodexInteractiveRequest` switches over). A kind added to any of
them fails the guard until it has a surface. Claude Code's three
surfaces (AskUserQuestion, ExitPlanMode, any other tool's permission)
are listed by hand; see "Left out" below. **The rule:** every answer the
user did not give sends a `provider.warning`, whatever the provider
receives. A JSON-RPC error alone does not count. A stopped turn adds no
warning. A case a surface cannot reach must say why. The result is 88
rows. Turbo test inputs for `@bb/provider-bridge-protocol` include Pi
and ACP, so a change in any bridge re-runs the guard.
- **One owner.** In the bridge kit, `unansweredInteractionWarning({
cause, answer })` builds the warning and
`unansweredInteractionErrorMessage(cause)` gives the agent-facing error
or deny text. The SDK exports them as `experimental_*`, with an audit
entry, Plugin Guide symbols and a `provider-plugin-api.md` section. The
causes are unshowable request, runtime error, unreadable resolution,
unmappable answer and withdrawn. Every bridge site that answers without
the user goes through them:
- **ACP**: runtime errors, unreadable resolutions, answers that do not
fit a field, Accept/Decline confirmations or the offered permission
options, questions asked during compaction, and questions withdrawn when
a new prompt starts. Each gets a JSON-RPC error that says why, plus the
warning. #6518's bespoke unshowable-form text moved onto the owner.
- **Pi**: invalid dialogs (the validation issue is named), send
failures, runtime errors, unreadable resolutions and unmappable answers.
Each still sends `{cancelled:true}`, since Pi has no failure answer, but
now with the warning.
- **Codex**: every question kind. Unreadable or unmatched question
requests, plus runtime errors, unreadable resolutions and unmappable
answers, now go through one helper. `buildCodexInteractiveResult`
returns a typed `answered | unanswered` result for every payload kind.
MCP elicitations keep `cancel`; approvals and requestUserInput keep the
error, now carrying the owner's text. Unknown non-question server
requests still get METHOD_NOT_FOUND and no warning.
- **Claude Code**: invalid AskUserQuestion/ExitPlanMode input, runtime
errors, unreadable resolutions and unmappable answers deny with the
owner's text, plus the warning. Policy auto-denies and stop or teardown
denies are unchanged.
- **ask-user-question** (#7347): an exhaustive `switch` over
`PluginInteractionCancelReason`. Only `user` reads as a dismissal; other
reasons name themselves.
- **Plugin lifecycle routes**: `setEnabled` and `updateSettings` return
`{ ok, error?, … }` with the load problem. `POST /plugins/:id/enable`
and `PUT /plugins/:id/settings` answer 422 (`plugin "x" did not start:
…`), like reload. A route table covers reload, enable and settings save.
The #5534 CLI special case is deleted, and the CLI guide notes that
enable exits 1 with the load error.
- Plugin SDK 0.6.159. There are no server/daemon wire changes.

## Issues this root cause produced

| Issue | State | Mechanism | Would the guard/fix have prevented it? |
|---|---|---|---|
| #4264 | closed | Pi validation failure answered as a user decline |
Yes. Pi "unshowable request" rows. |
| #7647 | open | Pi confirm over 8,192 characters silently returns false
| Partly. It is no longer silent; Pi still gets `cancelled` because its
protocol has no failure answer. #7660 shortens the text. |
| #6266 | closed | ACP form over 4 fields; the decline reached the agent
as a user cancel | Yes. The ACP form "unshowable request" row. |
| #6508 | closed | ACP omp forms with 3+ questions declined | Yes, the
same row. |
| #4645 | closed | Codex Browser Use auto-declined; Codex told the model
the user declined | Yes, now. The rule no longer accepts an error
without a warning, and the Codex "unshowable request" rows cover a
question bb could not handle. |
| #7347 | open | ask-user-question calls an interruption "user
dismissed" | Fixed here. This overlaps open PR #7375. |
| #4940 | closed | `bb plugin enable` exits 0 / `ok:true` on a failed
load | Fixed at the route (enable row). |
| #2029 | closed | plugin reload reports success on failure | Reload row
(fixed by #2155). |

On main, the first version of the guard failed 12 of 25 rows. With this
PR's behavior reverted (Claude without warnings, Codex error answers
without warnings, ACP's silent cancel on a new prompt), the expanded
guard fails 29 of 88 rows. The settings-save row fails with the old
settings route.

**Patches deleted:** the #5534 enable workaround in the CLI; #6518's
ACP-local "could not show" wording; Codex's MCP-only cancel special case
(`buildCodexInteractiveResult` now handles every kind); and the Pi and
Codex tests that asserted a silent cancel as correct behavior.

## Left out, deliberately

- **Who stopped the turn.** Codex's `stopsRequested` (and ACP's and Pi's
stop handling) treats every interrupt as a stop, including workflow
`stopChild` and archive. The bridge cannot do better: `thread/stop`
carries only `intent`, and workflow `stopChild` calls the same
`threads.stop` API as the user, so even the server records it as a
manual stop. A stopped turn is never silent, though. The server marks
the open question `interrupted` with its reason in the timeline, and for
the agent `cancelled` is the protocol's meaning of a cancelled turn.
Carrying a stop origin to bridges would be a server, daemon and bridge
wire change (`HOST_DAEMON_PROTOCOL_VERSION`) that adds nothing the
timeline doesn't already show. The guard calls this case "turn-stopped"
rather than "user-stop".
- **Claude's rows are listed by hand.** Claude Code's `canUseTool`
special-cases two tool names and treats every other tool as a
permission. There is no list in its dispatch to derive from, and adding
one only for the test would be a test-only production seam.
- **Unreachable cases** are named in the guard with their reason: ACP
permission requests are never unshowable once well-formed; Codex command
and file-change approvals have no decision that fails to map; only ACP
ever withdraws a question; and Claude shows any tool's raw input.

## Decisions for review

- **New timeline warning.** "bb answered the agent without you" (details
name the answer sent and the cause) appears on ACP, Pi, Codex and Claude
Code threads whenever a question or permission request ends without the
user. It never appears for a stopped turn. ACP's existing
unshowable-form warning changes its summary to this one.
- **Error texts the agent sees change** to "The user did not answer: …"
for ACP errors, Codex approval/requestUserInput errors and Claude Code
failure denies. ACP agents get an error instead of
`cancel`/`decline`/`cancelled` for these failures, including permission
requests and questions withdrawn by a new prompt.
- **Saving settings that leave a plugin failing to start**, and enabling
such a plugin, now return an error (422, so the existing toast paths
show it), where before they reported success. The settings are still
saved. The SDK's `plugins.enable` and `plugins.updateSettings` throw.
- **ask-user-question** tells the model "The question closed before the
user answered (<reason>); the user has not responded…" for non-user
cancellations.

## How you verified

- Guard on the first revision's main: 12 of 25 failed, all real members.
Expanded guard: 88 of 88 pass. With the old behaviors restored it fails
29 rows: all of Claude's non-stop rows, every Codex kind, and both ACP
withdrawn rows. An earlier mutation check showed the Codex stop counter
keeps the turn-stopped row quiet.
- Lifecycle-route table: the enable row returned 200 on main, and the
settings-save row fails with the old route; both return 422 now.
- Targeted tests pass: the provider-bridge-protocol guard,
`@bb/provider-bridge-acp` `bridge.test.ts` and `elicitation.test.ts`, Pi
`extension-ui*`, Codex `interactive-requests`, `bridge.elicitation`,
`bridge.native-question` and `bridge.calibration`, Claude Code
`bridge.test.ts`, ask-user-question `server-harness`, the server plugin
service/route/settings/update/safe-mode/logo/icon/app-bundle suites,
heroes, echo-provider, provider-management, and the CLI `plugin-enable`.
- `turbo run typecheck lint` for the protocol, ACP, plugin SDK, Pi,
Codex, Claude Code, Plugin Guide and server packages.
- Live after the first revision, with the same Pi fixture: the thread
records `provider/warning` "bb answered the agent without you" ("…with
"cancelled" because it could not show the question: title: Too big:
expected string to have <=8192 characters"), and it is visible in the
thread timeline.

Fixes #7347

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment