fix(desktop): connect pills reload tools into the session that clicked them
Both connect providers captured `sessionId` when the suggestion was built and ignored the one the pill hands `invoke`. An offer that outlived a session switch therefore aimed its `reload.mcp` at the session the draft was sampled in, so the chat the user actually clicked from resumed without the tools the pill just said were ready. Prefer the invoking pill's session; the captured one stays as the fallback.
This commit is contained in:
committed by
brooklyn!
parent
685a5c95ad
commit
423f92e607
@@ -186,7 +186,9 @@ function toSuggestion(match: McpMatch, sessionId: string | null): ComposerSugges
|
||||
doneLabel: copy('added', name),
|
||||
doneTip: copy('addedTip'),
|
||||
id: match.server,
|
||||
invoke: context => connect(match.server, sessionId, context.cancelled),
|
||||
// The pill's session wins over the one captured at sample time: the reload
|
||||
// has to reach the session the user is actually looking at.
|
||||
invoke: context => connect(match.server, context.sessionId ?? sessionId, context.cancelled),
|
||||
label: copy('label', name),
|
||||
provider: 'mcp',
|
||||
tip: copy('tip', match.keyword),
|
||||
|
||||
@@ -73,7 +73,7 @@ function toSuggestion(server: string, sessionId: string | null): ComposerSuggest
|
||||
doneTip: copy('doneTip'),
|
||||
icon: 'plug',
|
||||
id: server,
|
||||
invoke: context => reconnect(server, sessionId, context.cancelled),
|
||||
invoke: context => reconnect(server, context.sessionId ?? sessionId, context.cancelled),
|
||||
label: copy('label', name),
|
||||
provider: 'repair',
|
||||
tip: copy('tip', name),
|
||||
|
||||
Reference in New Issue
Block a user