kuju63 / kuju63/code-review-agents

[Bug]: a2a-server が未処理errorイベントでプロセス全体がクラッシュする

Open
#296 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
HTML
Stars
0
Forks
0
Avg merge
1d 7h
Merged PRs (30d)
96

Description

## 現象

TypeScript版 `packages/a2a-server` で `/orchestrator/tasks/send` にタスクを投入し、レビューア呼び出し(LLM API呼び出し)が失敗した直後、アイドル状態になったHTTP2セッションが `socket idle timeout` エラーを送出し、Node.jsの `Unhandled 'error' event` としてプロセス全体が終了する。

```
Task failed: OpenAI API key is required. ...
node:events:505
throw er; // Unhandled 'error' event
^
InformationalError: socket idle timeout
at Timeout.onHttp2SessionIdleTimeout [as _onTimeout] (node:internal/deps/undici/undici:8713:19)
...
Emitted 'error' event on ClientHttp2Stream instance at:
...
code: 'UND_ERR_INFO'
}
Node.js v26.7.0
```

## 影響

1件のタスク失敗(LLM呼び出しエラー等)が、実行中の他のタスクも巻き添えにしてサーバープロセス自体を終了させる。評価パイプラインやプロダクション運用において、単発の一時的なエラーがサーバー全体のダウンにつながるため、可用性上のリスクが大きい。

## 再現手順

1. `packages/a2a-server` をビルドして起動する(`node dist/index.js`)
2. `/orchestrator/tasks/send` にタスクを投入し、下流のLLM呼び出しが失敗する状態を作る(例: `OPENAI_API_KEY` 未設定のままOpenAIプロバイダで呼び出す)
3. タスクが `failed` になった後、しばらくすると `Unhandled 'error' event` でプロセスが落ちる

## 推定原因

OpenAI SDK(`@strands-agents/sdk` 経由)が内部で使用するHTTP2クライアント(undici)のセッションがアイドルタイムアウトした際に発行する `error` イベントに対して、リスナーが登録されていない。Node.jsの仕様上、`error` イベントにリスナーがないEventEmitterでは例外がスローされプロセスがクラッシュする。

## 対応方針(案)

- HTTP2クライアントセッション(またはプロセス起点)に `process.on('uncaughtException', ...)` ではなく、根本原因のセッション/クライアントに対する `error` イベントハンドラを適切に登録する
- あるいは強制終了を避けるため、タスク単位の失敗が正しく分離され、無関係なタスクやサーバー本体に影響しないことを保証する設計に見直す

## 発見経緯

Issue #253 (`api/ と a2a/ をTypeScriptへ移行する`) の実装検証のためのSeeded評価を実施中、スモークテストで発見。

Contributor guide

Open the contributing guide

Research direction

Start in packages/a2a-server and reproduce the failure by building, running node dist/index.js, and sending a task to /orchestrator/tasks/send with OPENAI_API_KEY unset. Trace the task failure and the later HTTP/2 idle-timeout error to identify the owning client or session. Done means one failed task does not terminate the server or unrelated tasks, with coverage for this behavior if the existing tests provide a suitable place.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.