MCP prompts/list failure wipes the cached prompt list and announces it as empty
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- devtools
Direzione di ricerca
Il bug si trova in packages/core/src/mcp/index.ts intorno alle righe 305-312, dove refreshPrompts gestisce una chiamata prompts/list fallita. Confronta con refreshTools sopra. Il test che fallisce è in packages/core/test/mcp.test.ts utilizzando il fixture resourceServer. Esegui il test per vedere l'errore, quindi modifica la logica Effect.orElseSucceed per preservare i prompt esistenti in caso di errore, simile a refreshTools.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
refreshPrompts turns a failed prompts/list into an empty list and then commits it: Effect.orElseSucceed(() => []) at packages/core/src/mcp/index.ts:307, and the Effect.map below it assigns entry.prompts from that empty result before publishing PromptsChanged (:305-312). refreshTools directly above (:298-303) has no such swallow, so a failed tools refresh leaves the registered tools alone. The two listings behave differently on the same failure.
So one transient error on a server that is still connected wipes its prompts, and the event that follows tells every reader the list is now legitimately empty — packages/core/src/plugin/command.ts:18-24 reacts to PromptsChanged by re-reading mcp.prompts() and calling ctx.command.reload(). The server's slash commands disappear and nothing indicates why: servers() still reports status: "connected".
Plugins
None.
OpenCode version
v2 at 681ea07a9.
Steps to reproduce
Using the resourceServer fixture in packages/core/test/mcp.test.ts, with prompts capability advertising listChanged and a responder that answers prompts/list with a JSON-RPC error once armed:
- Connect; the initial listing succeeds and
service.prompts()containsgreet. - The server sends
prompts/list_changed; the client re-lists and the server answers with the error. service.prompts()is now[], whileservice.servers()still reports{ status: "connected" }.
Expected: the failed refresh keeps the prompts it already had, as refreshTools does. The regression test in the PR fails on 681ea07a9 with prompts were [] and passes with the one-line change.
- Lingua principale
- TypeScript
- Stelle
- 209k
- Fork
- 27.5k
- Merge medio
- 9h 42m
- PR unite (30g)
- 389
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di anomalyco/opencode
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Tutte le issue di anomalyco/opencode
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
security
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
IBM/node-sdk-core#373 ·
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100