Skip to content

Preserve partial question answers - #4781

Merged
ymichael merged 2 commits into
mainfrom
bb/complete-pending-user-response-thr_u497kinnh5
Oct 5, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/complete-pending-user-response-thr_u497kinnh5

Conversation

@ymichael

@ymichael ymichael commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Partial question answers lived only in the mounted React form. Switching to another thread or reloading the page reset selections, free text, and the current question before the user submitted them.

What changed

Persist drafts for native provider questions and the real Ask User Question plugin by thread and interaction identity. Restore partial selections, exact free text, and question position; validate saved values and ignore changed question definitions. Retain drafts on failed submit/cancel and clear them after success, without erasing answers edited while an older submission was pending. Browser storage failures fall back to memory for navigation.

Drafts are browser/device-local with no cross-device synchronization or time expiry. Server pending state controls whether a form can appear: resolving an interaction elsewhere can leave inert local data until site data is cleared. Only these two question forms opt in; secret-request forms do not persist drafts. Older clients ignore the new namespace. No database migration, public SDK/CLI surface, or daemon protocol change. Documented in docs/debugging-and-qa.md.

How you verified

  • Regression fails on the original shared form: navigation loses the second-question position and draft answers.
  • Turbo: 34 focused app tests and 35 Ask User Question plugin tests pass; app/shared-ui/plugin typechecks and lint pass.
  • Final-head real Claude native questions and real Codex Ask User Question plugin forms: matched base/head multi-question navigation and reload; selected options, exact Notes free text, and question 2 of 3 survive. New interactions start empty even with inert older local drafts. Successful submit and cancel clear storage; resolved/canceled forms stay closed after reload. Both providers acknowledge submitted answers.
  • Supplemental injected HTTP 503 submit/cancel failures retain both forms and drafts through reload. Storage-full/corruption/identity isolation are covered by focused tests.
  • Regenerated the published component registry and verified its tests/typecheck plus all fork checks in CI.
  • Final-head CI: 31 passed, three skipped, no failed or pending checks. Persistent clean-head pnpm start:worktree review fixture: https://ymichael--23106.getbb.app/projects/proj_rbdqqa8ssj/threads/thr_bebmcxdkui. Handoff: /Users/michael/.bb/thread-storage/thr_u497kinnh5/HANDOFF.md.
  • Overlap checked: Support native Codex choice questions #4044 is merged and rejects secret Codex inputs; Close cancelled Claude question forms #4697 is closed/unmerged and addresses provider cancellation, without overlapping form/storage code. Neither branch changed.

AGENT GENERATED

@ymichael
ymichael marked this pull request as ready for review October 2, 2026 23:44
@ymichael
ymichael merged commit 11adf48 into main Oct 5, 2026
34 checks passed
@ymichael
ymichael deleted the bb/complete-pending-user-response-thr_u497kinnh5 branch October 5, 2026 16:34
ymichael added a commit that referenced this pull request Oct 5, 2026
## Human comments

## What was wrong

The custom-answer field in question forms had no microphone input. Users
could dictate into the composer but had to type their own answers to
agent questions.

## What changed

Add bb's voice input to the free-text answer in shared question forms,
with the mic inside the answer field at the bottom right. Recording,
transcription, and cancellation use the existing voice capture hook and
transcription service. Transcripts append to the editable text;
submission stays explicit. Navigation and submission wait while voice
input is active, and a closed answer field ignores late transcripts. The
field reserves space below its text for the controls, including narrow
touch layouts. Transcripts go through the same state update as typed
text, so they persist in the question form drafts from #4781.

The answer-field microphone reuses the promptbox voice button, including
right-click and Shift+F10 access to microphone preferences and
capture-warning recovery. A local tooltip provider keeps the exported
textarea self-contained.

Expose it to plugins as a top-level host component,
`experimental_VoiceInputTextarea` (`@get-bb/plugin-sdk/app`), next to
`experimental_NewThreadComposer` and the pickers:

- Controlled textarea: `value`, `onValueChange(value)`, optional
`onVoiceInputActiveChange(active)`. Every other textarea attribute,
including `ref` and `className`, reaches the inner `<textarea>`. The
host owns the mic, waveform, cancel/stop controls, padding, and
transcript appending, and renders a plain textarea when voice input is
unsupported.
- App implementation:
`apps/app/src/components/promptbox/VoiceInputTextarea.tsx`, registered
in the SDK app implementation.
- Shared-ui `voice-input-textarea` module, which the shared question
form renders. The plugin build shims it to the host's copy (new
`voiceInputTextarea` runtime slot), like `question-form-host`, so the
built-in Ask User Question and pi plugins get the host component.
`ThreadQuestionFormHost` provides it.
- Registry: new `voice-input-textarea` item whose plugin flavor
re-exports the SDK component; `question-form` uses it.
- Test harness: `renderSlot` renders a plain controlled textarea.
- Docs: new `docs/api_to_audit.md` entry, Plugin Guide surfaces, and
plugin-authoring references. Plugin SDK bumped to 0.6.23 above main's
0.6.22.

Merge current main to resolve SDK-version and Plugin Guide conflicts and
adopt its thread/new-thread route bundle measurements. Preserve the
voice-input API symbols and keep guide bullets within the new copy
constraints. The final branch uses main's byte limits without an
increase.

No CLI, daemon wire, or database changes.

## How you verified

SDK version follow-up (`37125cb275`): bump both version declarations to
0.6.23 after main reached 0.6.22. SDK version tests, the public-surface
version check, and app/desktop lockstep check pass locally.

Voice-menu follow-up (`8df04c2f42`): app typecheck/lint, targeted
`VoiceInputButton` and `QuestionForm` tests, and bundle budgets pass. In
the rebuilt worktree app, right-click and Shift+F10 open voice
preferences; opening the menu does not start dictation or hide/inert the
app root. Physical microphone capture was not tested in the headless
browser.

CI repair on `5784b3dc13` after merging main: `pnpm exec turbo run build
typecheck lint --filter=@bb/app --filter=@get-bb/plugin-sdk
--filter=bb-plugin-plugin-api-docs` passed. `node
apps/app/scripts/check-bundle-budget.mjs` passes within main's unchanged
limits: boot 1360.7 KiB raw / 340.2 KiB brotli; thread page 1788.0 KiB
raw / 516.0 KiB brotli; new-thread page 1066.9 KiB raw / 315.7 KiB
brotli.

`pnpm exec turbo run test --filter=@bb/app --filter=@get-bb/plugin-sdk
--filter=bb-plugin-plugin-api-docs` also passed after merging main. The
SDK-version check passes.

Before the CI repair (rebased on 95750b8):

- `pnpm exec turbo run typecheck lint test` for `@bb/app`,
`@get-bb/plugin-sdk`, `@bb/plugin-build`, `@bb/plugin-registry`,
`@bb/shared-ui`, `bb-plugin-plugin-api-docs`,
`bb-plugin-ask-user-question`, and `bb-plugin-provider-pi`: typecheck
passed, lint had 0 errors, and all tests passed (app 576 files, SDK 30,
plugin-build 13, registry 1, Plugin Guide 13, Ask User Question 4, pi
28).
- Server `plugin-authoring-docs` and `plugin-authoring-doc-examples`
tests passed.
- `.github/workflows/check-plugin-sdk-version.mjs` passes.
- `QuestionForm.test.tsx` covers appending a transcript to the latest
edited answer without submitting, ignoring late transcripts after the
field closes, and blocking navigation and submission while transcription
is pending.

The earlier browser checks (recording, transcription, cancellation,
injected errors, late-result isolation, screenshots on desktop and
narrow touch, real recognition with a synthesized WAV) ran on the first
version of this PR, before voice input moved into the host textarea
component. They have not been repeated on the current head. Physical
microphone and native-device/Safari coverage are not claimed.

#4780 and #4774 change the shared voice hook; their scopes remain
separate.

> AGENT GENERATED

---------

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.

1 participant