[Bug]: Pi thread dies ("Pi process exited unexpectedly") on resume after idle release or mid-thread model switch

已关闭 适合新手
#31,519 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
77/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

从 provider-pi/src/server/adapter.ts 中2145和2161行附近的意外退出路径开始。然后检查 rpc.ts 中352–353行附近的代码,了解子进程的stderr是如何记录的。重现恢复或切换模型失败的情况,并检查子进程的退出详情。完成标准是:意外退出时会记录退出码和有用的stderr文本(例如末尾部分),以便诊断原因。

由索引模型根据 Issue 内容生成。

描述

needs more info
What happened

A pi thread (provider opencode-go, model deepseek-v4.1-flash) fails the next turn instantly (~30–200 ms, before any API call) with Pi process exited unexpectedly. (transport_error) in two cases:

  1. Resume after idle release. After the thread has idled past the 30-minute idle release (ProviderSessionManager.ts:57, DEFAULT_IDLE_TIMEOUT_MS), the next turn sent via MCP t3_thread_send respawns pi and resumes the session with switch_session (provider-pi/src/server/adapter.ts:2217-2218). Pi dies within 0.08 s. This happened twice on different threads (session file ~1.48 MB).
  2. Model switch on an existing thread. Switching an active thread from deepseek-v4-pro to opencode-go/deepseek-v4.1-flash in the UI produced a model_change event, and the next turn errored about 0.2 s later.

Counter-example: the same thread, with a smaller session (~566 KB), resumed fine from the UI after about 1 h 49 min idle. This points to resume or switch_session fragility (session size or a model change) rather than idle time alone.

Workaround: a new thread on the same worktree, started on the final model from the beginning, works for hours.

Why the cause is hard to confirm

adapter.ts:2145 and :2161 raise the error, but rpc.ts:352-353 logs only the length of the pi child's stderr, not its content, and the exit code is not logged. Could the adapter log the pi exit code and the stderr text (or its tail) on unexpected exit?

Environment
  • T3 Code: provider-pi, macOS
  • pi 1.5.0, opencode 1.18.25
  • Provider opencode-go, model deepseek-v4.1-flash
  • Threads started through T3 MCP (t3_thread_launch / t3_thread_send) in a per-card worktree
Related

#26312 (pi fails before RPC after rollback), #12931 (resume of long pi thread), #21208

主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
20 小时 2 分钟
30 天内合并 PR
164

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。