Skip to content

Approve in one click when the card has only one choice - #389

Closed
tianxingjian2406 wants to merge 1 commit into
useagenthq:mainfrom
tianxingjian2406:fix/issue-327
Closed

tianxingjian2406 wants to merge 1 commit into
useagenthq:mainfrom
tianxingjian2406:fix/issue-327

Conversation

@tianxingjian2406

@tianxingjian2406 tianxingjian2406 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #327

What changed

  • ApprovalCard starts with no option selected. The tool approval card always passes exactly one option, so every approval took two clicks. When the card has exactly one option, that option now starts selected and Approve works at once.
  • Cards with two options, no options, or a typed custom answer keep the old behavior.

Testing

  • New approval-card.test.tsx mounts the real card on happy-dom. With one option, Approve is enabled at once and a click approves that option. With two options, Approve stays disabled until a choice. The single-option case fails without the fix and passes with it.
  • bun run typecheck, bun test components app lib, and bun run lint run clean (the known ghostty-web WASM baseline failure aside).

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Copilot AI balanced review requested due to automatic review settings October 26, 2026 16:09

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@tianxingjian2406

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@abhishekgahlot2

Copy link
Copy Markdown
Contributor

Thanks for this. Before we can merge, please add a before/after screenshot or a short screen recording of the change working in the running app (the issue asks for one), plus a line on how you tested it.

@tianxingjian2406

tianxingjian2406 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Screenshots from the running app (a card with exactly one option, same shape as gateway-approval-card.tsx):

Before — the option starts unselected, so Approve stays disabled:

before: single-option approval card, Approve disabled

After — the single option starts selected, so Approve works on the first click:

after: single-option approval card, option selected and Approve enabled

How I tested it: I mounted the real ApprovalCard with one option in the app, loaded the page, and read the Approve button state (disabled before, enabled after). frontend/components/ai/approval-card.test.tsx covers the one-option and two-option cases. The full suite passes (only the known ghostty-web baseline failure).

@abhishekgahlot2

Copy link
Copy Markdown
Contributor

Thanks for the screenshots. Closing this one: #381 just replaced the old radio approval card, so a single-choice card now approves in one click on main, and this change no longer applies.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Approve in one click when the card has only one choice

3 participants