Skip to content

fix(acp): fold Other text fields into their choice questions - #6032

Closed
VinSpee wants to merge 1 commit into
get-bb:mainfrom
VinSpee:fix/acp-form-other-option
Closed

VinSpee wants to merge 1 commit into
get-bb:mainfrom
VinSpee:fix/acp-form-other-option

Conversation

@VinSpee

@VinSpee VinSpee commented Oct 21, 2026 •

Copy link
Copy Markdown

Human comments

What was wrong

ACP form fields from omp arrive as a choice field <name> plus a free-text companion <name>__other. planAcpElicitation planned one bb question per form field, so the free-text companion became a separate question that had to be answered. Root cause: packages/provider-bridge-acp/src/elicitation.ts never folded <name>__other into its choice question. Fixes #6031.

What changed

  • packages/provider-bridge-acp/src/elicitation.ts
    • A <name>__other text field folds into <name> when <name> is a choice, multiChoice, or typedChoice field. The pair becomes one question with allowFreeText set.
    • choice and multiChoice: valid selections and typed text are returned under their original field names. Empty answers and invalid nonempty selections decline. Custom text alone is accepted.
    • typedChoice: a typed value that matches an option is returned as <name>. Any other typed text is returned as <name>__other. Empty declines.
    • The question-count limit counts planned questions, so a folded pair counts once. Requests above twice the visible question limit are rejected before companion scans; each question can absorb at most one companion.
    • Unpaired fields and text-only __other fields are unchanged.
  • packages/provider-bridge-acp/src/elicitation.test.ts: five added tests cover folded pairs, the four-question boundary, text-only fields, and empty or invalid folded answers.
  • No wire-protocol, CLI, guide, or HOST_DAEMON_PROTOCOL_VERSION change. No changelog entry: this repository writes entries during release.

How you verified

  • Repro at b143a22 (see ACP question forms split an 'Other' free-text field into a separate required question #6031): one choice plus its __other produced two questions. With this change it produces one.
  • The original five regression tests: four fail against b143a22's converter; the text-only boundary passes on both. Added empty/invalid-answer assertions failed in two test cases before the review correction.
  • pnpm exec turbo run test typecheck lint --filter=@bb/provider-bridge-acp: pass. Tests: 25 files, 540 passed, 4 skipped. elicitation.test.ts: 10 tests.
  • pnpm exec oxfmt --check packages/provider-bridge-acp/src/elicitation.ts packages/provider-bridge-acp/src/elicitation.test.ts: pass.
  • Live acp-omp UI check against the isolated pnpm desktop:worktree instance: one question with Red, Blue, and inline Other. Red submitted without a text answer; OMP received First answer: Red. Other opened a text field inside the same question; Green submitted and OMP received Second answer: Green. The test thread finished idle. Screenshots were captured through a browser connected to the same packaged server; native window launch was confirmed separately with Cua Driver.
  • After rebuilding and restarting the isolated desktop app with commit fa118b4, a live multi-select UI check submitted Red plus custom input Green in the same question. OMP received User selected: Red and User provided custom input: Green. The thread returned to idle.
  • Direct runtime check of the reviewed converter: listed and custom multi-select answers accepted; empty and invalid selections declined; four folded questions accepted; a 20,000-field form refused in about 4 ms locally.
  • Not run: the full repository test suite.

Fixes #6031

AGENT GENERATED

ACP form fields named <field>__other were planned as a separate required question, so the free-text 'Other' answer appeared as its own question. Fold the __other text field into its choice, multi-choice, or typed-choice question as one question with free text enabled. A typed-choice answer matching a value or label becomes the value; any other text is sent as the Other field.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T13:56:43.696473Z c18c75b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks @VinSpee for the PR. This repo approves new contributors before it reviews their PRs, so this PR now closes on its own. That is expected. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ), post a link to this PR, and explain what it changes and why. A maintainer then adds you to the allow list and can reopen the PR.

@github-actions github-actions Bot closed this Oct 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c18c75b241

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
continue;
}
if (!decoded && !typed) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject an empty folded multi-select

When a folded multi-select resolution contains selected: [] and no free text, decodeAnswer is still truthy because every succeeds on the empty array, so this condition is skipped and toResponse accepts { tags: [] } even though neither the choice nor its __other companion was answered. Require a nonempty selection or typed text before accepting this branch.

AGENTS.md reference: AGENTS.md:L13-L13

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented on the fork branch in fa118b4. The folded-answer branch now requires a nonempty valid selection or nonblank custom text. Empty selections without custom text decline. Invalid nonempty selections also decline, even when custom text is supplied; custom text alone remains valid.

Existing regression coverage: packages/provider-bridge-acp/src/elicitation.test.ts, folds an Other text field into a multi-select question, covers empty selections, whitespace-only custom input, invalid selections with custom input, and valid custom-only answers. The added assertions failed before the correction and passed afterward. Previously verified at this exact commit with pnpm exec turbo run test typecheck lint --filter=@bb/provider-bridge-acp: 25 test files passed, 540 tests passed, 4 skipped; typecheck and lint passed.

This closed PR still records head c18c75b, so the correction is not yet in its recorded diff. Leaving this thread unresolved until maintainer approval/reopening and verification that the PR head includes fa118b4.

continue;
}
const choiceName = entry.name.slice(0, -OTHER_FIELD_SUFFIX.length);
const choice = fields.find((candidate) => candidate.name === choiceName);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound fields before linear companion lookup

When a malformed or custom ACP agent sends many __other properties, every companion performs a linear scan of all fields before the question-count check, making form planning quadratic and synchronously blocking the bridge for a request that must be declined. Each visible question can absorb at most one companion, so reject source counts above twice USER_QUESTION_MAX_QUESTIONS before this pass, or index fields once.

AGENTS.md reference: AGENTS.md:L13-L13

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented on the fork branch in fa118b4. Requests with more than 2 * USER_QUESTION_MAX_QUESTIONS source fields are now refused before field planning and planQuestionFields companion scans. Each visible question can absorb at most one companion, so this preserves every form that can fit while bounding the scan.

Existing regression coverage: packages/provider-bridge-acp/src/elicitation.test.ts, counts each choice with its Other text field as one question toward the limit, checks four folded question pairs (eight source fields). Previously verified at this exact commit with the package test/typecheck/lint command: 540 passed, 4 skipped. A direct runtime smoke check also refused a 20,000-field form as unsupported in about 4 ms locally, while accepting four folded questions.

This closed PR still records head c18c75b, so the correction is not yet in its recorded diff. Leaving this thread unresolved until maintainer approval/reopening and verification that the PR head includes fa118b4.

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.

ACP question forms split an 'Other' free-text field into a separate required question

1 participant