Skip to content

fix(skill-reco): sending while a card is up sends without the skill - #813

Merged
huichen merged 1 commit into
mainfrom
fix/skill-reco-send-dismiss
Sep 24, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/skill-reco-send-dismiss

Conversation

@huichen

@huichen huichen commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

With a recommendation card on screen the send button stays live (only the recommender wait disables it), but pressing it did nothing:

  • desktop: submitValue returned silently while card && !cardHandled,
  • mobile: sendFromComposer showed a toast ("请先选择是否使用推荐的技能。"),
  • TUI: Enter on the card was a no-op.

All three read as a dead send key, and the three clients disagreed about it.

Change

A plain send with the card up is now the same decision as the card's secondary button (「不用,直接发送」/ "Send without it"): dismiss the suggestion and send the draft as typed. No second recommender call is spent on the same draft (evaluatedDraftRef / the mobile budget hash), and the held draft is untouched.

  • desktop/src/features/agent/Composer.tsx — the card branch calls dismissRecommendedSkill().
  • mobile/src/features/chat/ChatScreen.tsx — dismissSuggestedSkill is hoisted above sendFromComposer and the card branch calls it; the now-unused chat.skillSuggestionPending string is dropped from both locales.
  • tui/src/app.rs — Enter with a card up runs send_held_draft, matching the card's Esc; only Pending still ignores Enter (no answer to race yet).

Tests

  • desktop: Composer.skillRecommend.test.tsx now mounts a harness whose parent owns the card the way the real screens do (the card appears only after onEvaluate returns one) and asserts hold → second send → sent unchanged + dismissed + one evaluate call. The install/dismiss tests move to that harness; each new assertion was verified to fail without the fix.
  • mobile: ChatScreen.test.ts sends with a suggestion up → dismissed + sent once.
  • TUI: enter_on_a_shown_card_sends_the_draft_without_the_skill.

Local: desktop tsc / eslint / vitest run (1250), mobile tsc / eslint / jest (1894), TUI cargo fmt --check / clippy -D warnings / cargo test -p future-tui (2091).

The recommendation card holds the draft, but the send button stayed live:
pressing it did nothing (desktop) or only showed a toast (mobile), which
reads as a broken button. A plain send with the card up is now the same
decision as the card's "send without it" — dismiss the suggestion and send
the draft as typed, without spending a second recommender call. The TUI had
the same hole on Enter and now matches its own Esc; the mobile-only
"choose the skill first" toast goes with it.
@huichen
huichen enabled auto-merge (squash) September 24, 2026 02:42
@huichen
huichen merged commit 48269e0 into main Sep 24, 2026
12 checks passed
@huichen
huichen deleted the fix/skill-reco-send-dismiss branch September 24, 2026 02:47
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