Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

runtime: process exits on any failed agent fetch (UND_ERR_SOCKET / UND_ERR_BODY_TIMEOUT)

未關閉
#33 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 10 天內回覆

@hdimer 已經在處理了。

開始於 2026年8月27日。

  • #67 來自 @hdimer —— 未關閉

評估

難度
4/5
預估耗時
3-5 天
新手友好度
58/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
node.js, python, typescript
領域
api, backend

研究方向

從 server.ts 開始,使用 pnpm runtime 或 tsx server.ts 執行 runtime,並追蹤 agent fetch 直到消費 stream。藉由停止本機的 uvicorn agent,或將一個回合延遲到超過 timeout,來重現問題。完成標準是:這些失敗會被捕捉、記錄並呈現出來,同時不會終止 runtime 或遺失 channel session。

由索引模型根據 Issue 內容生成。

描述

Summary

Any failure of the runtime's HTTP request to the Python agent — a dropped socket, a slow turn, an agent restart — raises an unhandled rejection inside undici and kills the whole runtime process (server.ts). The Slack/Teams channel session dies with it, and every message until an operator restarts the process is silently lost.

Observed three times in one evening of local testing, two distinct signatures:

1. Agent restarted mid-request (also reproduced by killing the agent during a turn):

Agent execution failed: TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11124:53)
  [cause]: SocketError: other side closed
    code: 'UND_ERR_SOCKET'

2. Agent turn exceeded undici's default 300s body timeout (a long tool-heavy turn with no stream activity):

node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
TypeError: terminated
    code: 'UND_ERR_BODY_TIMEOUT'

Both escape as uncaught exceptions / unhandled rejections, so Node terminates the process.

Why it matters

The runtime is the long-lived member of the pair — it holds the Intelligence channel session. A transient agent-side hiccup (deploy, OOM, slow model call) shouldn't take down message delivery for the whole workspace. There's also a secondary effect: when the crash lands mid-turn, the agent's LangGraph state can be left with a dangling tool call, and the next turn on that thread fails with the Responses API's No tool output found for function call ….

Suggested fix

  • Wrap the agent fetch (and its stream consumption) so failures are caught, logged, and surfaced as a failed run — not an uncaught exception. A process.on('unhandledRejection') backstop that logs instead of exiting would also stop the bleeding.
  • Consider raising or configuring undici's bodyTimeout for the agent request (long agentic turns with sparse stream output can legitimately exceed 300s), or send periodic keep-alive events from the agent.

Happy to help test a fix — local repro is reliable: start a turn, then either kill the agent process or give it a tool that sleeps past 300s.

Environment: OpenTag main, Node v22.14.0, runtime via pnpm runtime / tsx server.ts, agent via uvicorn locally.

主要語言
Python
星號
1.3k
分支
138
平均合併
5 天 10 小時
30 天內合併 PR
7

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

CopilotKit/OpenTag 的其他 Issue

查看 CopilotKit/OpenTag 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。