getMessages on a large session kills the stdio transport (write EINVAL) and the CLI hangs

Aperta
#5,592 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
json, python, rust

Direzione di ricerca

Start by tracing the Rust JSON-RPC stdio transport path used by session.get_events() and how it writes large responses; the issue names no source files or tests. Reproduce with a large events.jsonl and compare the response size with the reported write EINVAL failure. Done means the request returns or reports an error while the transport remains usable, or the CLI closes stdout so the client detects disconnection.

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

Descrizione

area:non-interactive area:sessions
Describe the bug

I'm driving the CLI from the Python SDK over stdio. One of my sessions got really big (events.jsonl is ~808 MB, lots of screenshots in it). If I resume it and call session.get_events(), about 6 seconds later the CLI log shows:

[ERROR] Rust JSON-RPC transport error: Error: write EINVAL

After that the CLI never writes anything to stdout again. The getMessages call never comes back, ping / status.get time out, but the process is still alive, so the SDK has no idea the connection is gone. client.stop() hangs too, and the process ignored SIGTERM, so I had to kill -9 it.

Smaller sessions are fine. I truncated the same events.jsonl to check:

  • 100 MB: getMessages returns in ~2s
  • 300 MB: ~4s
  • 808 MB: write EINVAL, connection dead

Resuming the 808 MB session without calling getMessages works fine.

Affected version

1.0.116 (saw it on 1.0.115 too), macOS arm64. The log says "Starting CLI in stdio mode (Rust JSON-RPC engine)".

Steps to reproduce the behavior
  1. Have a session with a very large events.jsonl (800 MB+).
  2. From the Python SDK over stdio: session = await client.resume_session(session_id, ...)
  3. await session.get_events()
  4. await client.get_status() never returns.
Expected behavior

getMessages either returns or fails with an error, and the connection keeps working. Or, if the transport does break, the CLI exits or closes stdout so the client can tell.

Additional context

My guess is the whole response goes out in one write and hits the macOS limit where write(2) returns EINVAL above INT_MAX bytes. Chunking the write, or letting getMessages page, would probably fix it.

For now I work around it by not calling getMessages on big sessions (I read events.jsonl directly instead), plus timeouts and restarting the CLI when it stops answering.

Lingua principale
Python
Stelle
11.5k
Fork
2k
Merge medio
6h 34m
PR unite (30g)
3

Preparare l'ambiente

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 github/copilot-cli

Tutte le issue di github/copilot-cli

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.