@@ -7,7 +7,6 @@ import { EXPERIMENT_IDS } from "@/common/constants/experiments";
77import { getPendingDraftSkillDiscoveryKey } from "@/common/constants/storage" ;
88import {
99 getAgentSkillsStore ,
10- getDiscoveryKey ,
1110 useAgentSkills ,
1211 type AgentSkillsDiscovery ,
1312} from "@/browser/stores/AgentSkillsStore" ;
@@ -210,7 +209,6 @@ export function useComposerSuggestions(options: UseComposerSuggestionsOptions) {
210209 const mcpLoadedAt = useRef ( 0 ) ;
211210 const mcpWorkspace = useRef < string | null > ( null ) ;
212211 const mcpAbort = useRef < AbortController | null > ( null ) ;
213- const freshSkillTokenKey = useRef ( "" ) ;
214212 const listId = useId ( ) ;
215213 const skillDiscovery : AgentSkillsDiscovery | null =
216214 variant === "workspace" && workspaceId
@@ -447,19 +445,15 @@ export function useComposerSuggestions(options: UseComposerSuggestionsOptions) {
447445
448446 const updateCaret = ( nextInput : string , nextCursor : number ) => {
449447 setCaretState ( { input : nextInput , cursor : nextCursor } ) ;
450- // Starting a `$` or `/` token asks again for a skill list that missed a
451- // source, e.g. an SSH host that was still connecting. Once per token,
452- // tracked here rather than from the rendered token, so a token that a
453- // draft restore put in place still asks when the user types in it.
448+ // While the caret is in a `$` or `/` token, ask again for a skill list that
449+ // missed a source, e.g. an SSH host that was still connecting. This keeps
450+ // no per-token memory, so draft restores, sends and clears cannot leave it
451+ // stale. The store makes this a no-op for a complete list and keeps at most
452+ // one request per list in flight.
454453 const nextToken = detectActiveComposerToken ( nextInput , nextCursor ) ;
455- const nextSkillTokenKey =
456- skillDiscovery && ( nextToken ?. kind === "slash" || nextToken ?. kind === "inline" )
457- ? `${ getDiscoveryKey ( skillDiscovery ) } |${ nextToken . kind } :${ nextToken . startIndex } `
458- : "" ;
459- if ( skillDiscovery && nextSkillTokenKey && nextSkillTokenKey !== freshSkillTokenKey . current ) {
454+ if ( skillDiscovery && ( nextToken ?. kind === "slash" || nextToken ?. kind === "inline" ) ) {
460455 getAgentSkillsStore ( ) . ensureFresh ( skillDiscovery ) ;
461456 }
462- freshSkillTokenKey . current = nextSkillTokenKey ;
463457 } ;
464458
465459 const handleCursorActivity = ( ) => {
0 commit comments