Skip to content

fix(desktop): send the message when the skill recommender finds nothing - #793

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

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

Conversation

@huichen

@huichen huichen commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

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 submitValue from its evaluate callback while its own in-flight guard was still set:

recommendPendingRef.current = true;              // guard on
onEvaluate(trimmed)
  .then(card => { if (!card) submitValue(); })   // ...recursive, guard still on
  .finally(() => { recommendPendingRef.current = false; });  // clears *after*

submitValue's first check returns early when recommendPendingRef.current is true, so the recursive call was silently refused and the draft never reached onSend. The intercept is not conditional on the feature being on: the new-conversation composer always passes a skillRecommendation prop, and while the toggle is off evaluate() resolves immediately to null — 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 calling submitValue recursively. An evaluatedDraftRef records 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.tsx and a new Composer.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 nothing with 0 calls and does not ask the recommender twice with 2 calls — and passes with the fix. Desktop suite: 1230 tests green; npm run lint (eslint + tsc) clean.

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.
@huichen
huichen enabled auto-merge (squash) September 23, 2026 05:26
@huichen
huichen merged commit 71fa5c9 into main Sep 23, 2026
12 checks passed
@huichen
huichen deleted the fix/skill-reco-send branch September 23, 2026 05:29
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