Repository navigation
fix(desktop): send the message when the skill recommender finds nothing - #793
Merged
Merged
Conversation
The skill-recommendation intercept re-entered `submitValue` from its evaluate callback while the in-flight guard (`recommendPendingRef`) was still set: the guard's `.finally` clears it only after `.then` has run. The recursive call was therefore refused by its own guard and the draft was never sent, so **Send did nothing at all** for a new conversation's first message — the intercept runs whenever a `skillRecommendation` prop is present, which the new-conversation composer always passes, and `evaluate()` resolves immediately (to null) while the feature is off. The same path could also ask the recommender twice for one draft. The real send path is now a separate `sendNow()`, which the intercept falls through to rather than calling `submitValue` recursively. `evaluatedDraftRef` records that a draft has been asked about, so one draft costs at most one call. Shipped in #787 but dormant there (the toggle defaulted off and had no UI); it became reachable as soon as the toggle had a surface, which is why this is a fix on top of the released code rather than part of the feature work. Tests: `Composer.skillRecommend.test.tsx` pins both halves — a no-match or erroring recommender still sends, a recommendation holds the draft, one call per draft, install appends " /skill" and sends, dismiss sends the original. Verified against the unfixed file: "sends when the recommender finds nothing" fails with 0 calls and "does not ask twice" fails with 2, i.e. exactly the reported symptom. Desktop suite: 1230 tests green.
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.
Symptom
In the desktop app, typing anything in a new conversation and pressing Send does nothing — no error, no request, the draft just sits there.
Cause
The skill-recommendation intercept re-entered
submitValuefrom its evaluate callback while its own in-flight guard was still set:submitValue's first check returns early whenrecommendPendingRef.currentis true, so the recursive call was silently refused and the draft never reachedonSend. The intercept is not conditional on the feature being on: the new-conversation composer always passes askillRecommendationprop, and while the toggle is offevaluate()resolves immediately tonull— which is exactly the branch that recursed. Every first message in a new conversation was swallowed.The same path could also ask the recommender twice for one draft when the guard happened not to be set.
Fix
The real send path is now a separate
sendNow(), which the intercept falls through to instead of callingsubmitValuerecursively. AnevaluatedDraftRefrecords that a draft has been asked about, so one draft costs at most one call.Why it shipped
The bug came in with #787 but was dormant there: the toggle defaulted off and had no UI, so nothing reached the intercept in practice. It became reachable the moment the toggle got a surface. That is why this is a standalone fix on top of the released code, not a footnote in the feature work.
Scope
2 files:
desktop/src/features/agent/Composer.tsxand a newComposer.skillRecommend.test.tsx. No behavior change beyond "the message is actually sent".Verification
The new test file pins both halves: a no-match or erroring recommender still sends, a recommendation holds the draft, one call per draft, install appends
" /skill"and sends, dismiss sends the original.Run against the unfixed file it fails exactly as reported —
sends when the recommender finds nothingwith 0 calls anddoes not ask the recommender twicewith 2 calls — and passes with the fix. Desktop suite: 1230 tests green;npm run lint(eslint + tsc) clean.