Catch provider setup errors instead of crashing the server at boot
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 83/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- backend
調査の方向性
packages/server/src/handler.tsで、18行目付近のプロバイダー作成と、33行目付近のhandleChat内のawaitを確認し、続いてcreateProviderをモックするpackages/server/tests/handler.test.tsの既存のハンドラーテストを読みます。返信生成の失敗がどのように返されるか、検証とレート制限がどのようにテストされているかを確認します。セットアップ時の拒否が処理されて一度だけログに記録され、リクエストが{ error: 'provider_error' }を返し、テストに@chatcops/serverのpatch changesetが含まれていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 13
- フォーク
- 7
- 平均マージ
- 3時間 41分
- マージ済み PR(30日)
- 155
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codercops/chatcops のほかの issue
-
Document the pre-chat form対応中かも @masyarakatai が 5 日前に担当しました。 オープンdocumentation good first issue hacktoberfest widget
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
codercops/chatcops#70 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
docs: update the providers page for openai-compatible, registerProvider and provider imports対応中かも @prakashNalla が今日担当しました。 オープンdocumentation good first issue hacktoberfest website
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
codercops/chatcops#291 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
docs: add a protocol reference page for custom clients対応中かも @kachamsiddarth が今日担当しました。 オープンdocumentation good first issue hacktoberfest website
codercops/chatcops#286 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)対応中かも @bhushan4work が今日担当しました。 オープンenhancement hacktoberfest help wanted server
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
codercops/chatcops#249 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Create @chatcops/store-sqlite, a store for single-server setups対応中かも @srikar-naidu が今日担当しました。 オープンenhancement hacktoberfest help wanted server
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
codercops/chatcops#247 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
codercops/chatcops の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
paperclipai/paperclip#17151 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
AgoraIO-Extensions/agent-infra#3159 ·
メンテナーはふだん 1 日以内に返信
-
blocklist addition
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
MetaMask/eth-phishing-detect#304596 ·
メンテナーはふだん 1 日以内に返信
-
friction
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
kentcdodds/kody#4142 ·
-
[Bug] Statistics | Task statistics are always empty on MikroORM with MySQL or SQLite対応中かも @NdekoCode が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ever-co/ever-gauzy#11214 ·
メンテナーはふだん 1 日以内に返信