Repository navigation
fix(skill-reco): sending while a card is up sends without the skill - #813
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With a recommendation card on screen the send button stays live (only the recommender wait disables it), but pressing it did nothing:
submitValuereturned silently whilecard && !cardHandled,sendFromComposershowed a toast ("请先选择是否使用推荐的技能。"),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 callsdismissRecommendedSkill().mobile/src/features/chat/ChatScreen.tsx—dismissSuggestedSkillis hoisted abovesendFromComposerand the card branch calls it; the now-unusedchat.skillSuggestionPendingstring is dropped from both locales.tui/src/app.rs— Enter with a card up runssend_held_draft, matching the card'sEsc; onlyPendingstill ignores Enter (no answer to race yet).Tests
Composer.skillRecommend.test.tsxnow mounts a harness whose parent owns the card the way the real screens do (the card appears only afteronEvaluatereturns 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.ChatScreen.test.tssends with a suggestion up → dismissed + sent once.enter_on_a_shown_card_sends_the_draft_without_the_skill.Local: desktop
tsc/eslint/vitest run(1250), mobiletsc/eslint/jest(1894), TUIcargo fmt --check/clippy -D warnings/cargo test -p future-tui(2091).