Catch provider setup errors instead of crashing the server at boot
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 83/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- backend
Direzione di ricerca
Inizia da packages/server/src/handler.ts, nella creazione del provider intorno alla riga 18 e nell'await in handleChat intorno alla riga 33, poi leggi i test esistenti dell'handler in packages/server/tests/handler.test.ts, che simulano createProvider. Verifica come vengono restituiti gli errori nella generazione delle risposte e come sono coperti la validazione e il rate limiting. Il lavoro è concluso quando il rifiuto durante la configurazione viene gestito e registrato una sola volta, le richieste restituiscono { error: 'provider_error' } e i test includono un changeset di tipo patch per @chatcops/server.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
createChatHandler starts creating the provider right away and only awaits it inside the first request (packages/server/src/handler.ts, line 18 and line 33). If that promise rejects, for example with an unknown provider.type or a provider SDK that throws on a missing key, nothing handles the rejection. Node treats an unhandled rejection as fatal by default, so the whole server process exits at startup. After that, if the process survives, every request rethrows at line 33, outside the try that starts further down, and the visitor gets a bare internal_error.
What to do
- Handle the rejection where the promise is created, and log it once with the
[chatcops]prefix, for example[chatcops] Provider setup failed: <message>. Don't log the API key or the config object. - In
handleChat, await the provider inside atryand yield{ error: 'provider_error' }when setup failed, the same error the visitor already sees for a failed reply. - Keep request validation and rate limiting working as they do today.
Acceptance criteria
- A handler created with a provider whose setup rejects doesn't cause an unhandled rejection (a test can listen for
unhandledRejection, or check that the rejection is handled) - Requests to that handler yield
{ error: 'provider_error' }and the setup error is logged once, not once per request - Tests in
packages/server/tests/handler.test.ts(it already mockscreateProvider) - Changeset for
@chatcops/server(patch) -
pnpm -r build,pnpm testandpnpm -r typecheckpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- Lingua principale
- TypeScript
- Stelle
- 13
- Fork
- 7
- Merge medio
- 3h 41m
- PR unite (30g)
- 155
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi 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 codercops/chatcops
-
Document the pre-chat formForse già presa @masyarakatai l’ha presa 5 giorni fa. Apertadocumentation good first issue hacktoberfest widget
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
codercops/chatcops#70 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
docs: update the providers page for openai-compatible, registerProvider and provider importsForse già presa @prakashNalla l’ha presa oggi. Apertadocumentation good first issue hacktoberfest website
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
codercops/chatcops#291 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
docs: add a protocol reference page for custom clientsForse già presa @kachamsiddarth l’ha presa oggi. Apertadocumentation good first issue hacktoberfest website
codercops/chatcops#286 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)Forse già presa @bhushan4work l’ha presa oggi. Apertaenhancement hacktoberfest help wanted server
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
codercops/chatcops#249 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Create @chatcops/store-sqlite, a store for single-server setupsForse già presa @srikar-naidu l’ha presa oggi. Apertaenhancement hacktoberfest help wanted server
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
codercops/chatcops#247 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/chatcops
Issue simili
-
bug P3 UI/UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
StellarState/SS-backend#712 ·
I maintainer di solito rispondono entro 1 giorno
-
area: backend bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
snapotter-hq/SnapOtter#3473 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
gitroomhq/postiz-app#2304 ·
I maintainer di solito rispondono entro 1 giorno
-
harlan-agent-ready-to-implement routine:ci-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
harlan-zw/unlighthouse#454 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno