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

Chiusa Adatta ai principianti
#31,519 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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
77/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript

Direzione di ricerca

Inizia da provider-pi/src/server/adapter.ts, nei percorsi di uscita imprevista vicino alle righe 2145 e 2161. Poi esamina rpc.ts vicino alle righe 352–353 per vedere come viene registrato stderr del processo figlio. Riproduci una ripresa o un cambio di modello non riusciti e controlla i dettagli di uscita del processo figlio. Il lavoro è completato quando le uscite impreviste registrano il codice di uscita e testo utile di stderr, ad esempio la parte finale, così da poter diagnosticare la causa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
24.8k
Fork
6.4k
Merge medio
20h 2m
PR unite (30g)
164

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pingdotgg/t3code

Tutte le issue di pingdotgg/t3code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.