Skip to content

Enhancement: open approval requests by default - #4915

Merged
ymichael merged 2 commits into
get-bb:mainfrom
stefanroex:expand-approvals-by-default
Oct 8, 2026
Merged

ymichael merged 2 commits into
get-bb:mainfrom
stefanroex:expand-approvals-by-default

Conversation

@stefanroex

@stefanroex stefanroex commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

Small change, I think it's definitely a mistake that you need to expand first before you can take an action.

image

What was wrong

A pending approval (command, file edit, or tool use) arrived above the composer as a collapsed row that only said "Approval needed". That row has no decision buttons, so every approval cost a click before you could read what was being asked or answer it. Questions, plugin forms, and plan reviews (since #4929) already arrived open, so approvals were the only request card that started collapsed.

#3094 introduced the collapsed strip with every decision button on it, so it was fully actionable. #3147 moved the decisions into the expanded card to keep the compact row on a single line on mobile, which turned the collapsed default into an extra step with nothing to do on it.

What changed

  • Approvals now arrive open with the command preview and the decision buttons, like every other pending interaction card.
  • With every caller opening on arrival, PendingInteractionShell drops its initiallyExpanded prop and always starts open. A request card is only collapsed when you collapse it, and new request types cannot come back collapsed by default.
  • The chevron, the title, and Esc still collapse the card. The next request arrives open again.

No wire, CLI, or SDK changes.

How you verified

  • ThreadPendingInteractionBanner.test.tsx: the approval tests now start from the open card. They cover the open default, deciding without expanding first, collapsing to the label-only row and reopening, Esc, and a new request arriving open after the previous one was collapsed. Against main's banner, 7 of these 16 tests fail.
  • pnpm exec turbo run typecheck lint test --filter=@bb/app: clean (5639 tests).
  • Ladle, Approval / Compact Permissions story at 1280 px and 390 px: main shows two label-only "Approval needed" rows; this branch shows both cards open with Deny / Allow for session / Allow once.
  • pnpm start:worktree with a real Claude Code approval (curl outside the sandbox): the card arrives open with the command and decisions on desktop and mobile.

AGENT GENERATED

🤖 Generated with Claude Code

stefanroex and others added 2 commits October 7, 2026 21:02
An approval arrived as a single collapsed row that only said
"Approval needed". The row has no decision buttons, so every
request cost an extra click before you could even read what was
being asked, let alone allow or deny it.

Approvals now arrive open, showing the command together with the
decision buttons, the same way questions already do. The card can
still be collapsed by hand to read the conversation behind it, and
the next request opens again.

Plan reviews are left as they were and still arrive collapsed.
Every pending interaction card now opens on arrival, so the shell no
longer needs a per-caller default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the expand-approvals-by-default branch from e245542 to 1de09c7 Compare October 8, 2026 04:02
@ymichael
ymichael merged commit 5db7206 into get-bb:main Oct 8, 2026
26 checks passed
ymichael added a commit that referenced this pull request Oct 9, 2026
## Human comments

## What was wrong

Outside plan mode Codex asks questions with `request_user_input_async`.
Codex emits an `agentMessage` with `delivery: "async"` and structured
questions, then tells the model the question was accepted. The Codex
adapter kept only the message text, so the thread showed plain bullets
and nothing could answer the question. Even with a card in place, the
server allowed only one open interaction per thread. While an async
question card was open, every provider approval or question on that
thread was rejected with "already awaiting user interaction". Codex's
escalated commands failed for up to an hour.

## What changed

- **Codex async questions** (`plugins/provider-codex`): the adapter
records each async question as Codex extension state. The plugin server
watches thread events and opens a `bb.ui.requestInput` form rendered
with the shared `QuestionForm`, the same mechanism Ask User Question
uses. Submitting sends the answer to the thread as a message, which
steers an active turn or starts a new one. The card stays open after the
turn ends, can be dismissed (which sends nothing), expires after an
hour, and can be answered with `bb thread interactions respond`. A
cancelled question row no longer reads as answered. The plugin overview
and the `codex-provider` skill document the behavior and the CLI path.
- **Several open interaction cards per thread** (`apps/server`,
`packages/db`): the one-active-interaction guards are gone. "Holds the
turn" now checks for any open card that has a turn (new
`hasTurnBoundActivePendingInteractionForThread`), not just the newest
one. Change notifications read `hasPendingInteraction` from the database
instead of reporting `false` whenever one card settles. Ask User
Question no longer tells the model that only one prompt can be open.
- **App**: `ThreadPendingInteractionBanners` renders every open card
oldest first. The oldest starts expanded and the rest start collapsed.
When the cards above a collapsed card settle, it becomes the oldest and
expands (`PendingInteractionShell` takes `expandedByDefault`).
- **Rebase onto #4915 (approvals open by default)**: #4915 removed the
shell's expand prop so every card always opens. This branch needs the
prop back to collapse every card except the oldest. I resolved this by
applying one rule to every kind: the oldest card opens, approvals
included, and later cards start collapsed. With one pending card, the
behavior is identical to #4915.

No `HOST_DAEMON_PROTOCOL_VERSION` change: async questions travel as
Codex extension state over the existing extension event, and
`hasPendingInteraction` is a field that already exists on the
server-to-app notification.

## How you verified

- `pnpm exec turbo run typecheck lint test --filter=@bb/app
--filter=@bb/server --filter=@bb/db --filter=bb-plugin-provider-codex
--filter=bb-plugin-ask-user-question` after rebasing onto current main:
20 of 21 tasks passed. The one failure was `PluginIcon.test.tsx` reading
a stale, ignored `plugins/navigation/` build-output directory in this
worktree. After deleting that directory the file passes (8/8).
- New tests: `async-questions.test.ts` (asks once and sends the answer
as a message; opens every question without waiting for earlier answers;
dismissal sends nothing; ignores other providers),
`delta-translation.test.ts` (async question recorded as Codex extension
state; none for a synchronous `agentMessage`),
`pending-interactions.test.ts` (a provider approval keeps blocking
alongside open plugin cards), and
`ThreadPendingInteractionBanner.test.tsx` (the next card expands once
the cards above it are answered).

Fixes #4990

> AGENT GENERATED

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

---------

Co-authored-by: qa <qa@x>
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants