Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

on-stop.sh slurps the entire transcript with jq -s every turn — ~1 GB RSS on long sessions, triggered a host OOM

Aperta Adatta ai principianti
#90 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
shell
Ambito
tooling

Direzione di ricerca

Leggi scripts/on-stop.sh e scripts/legacy/on-stop.sh, concentrandoti sulle due letture del transcript con jq -rs e su come estraggono l’ultimo prompt e l’ultima risposta. Riproduci il comportamento con un transcript JSONL di grandi dimensioni oppure esamina prima i filtri esistenti. Il lavoro è completato quando entrambi gli hook evitano di caricare l’intero transcript continuando a restituire il prompt e la risposta finali corretti.

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

Descrizione

Summary

scripts/on-stop.sh reads the entire session transcript into memory twice at the end of every turn (jq -rs … "$TRANSCRIPT_PATH"). On a long session this makes jq use roughly 3× the transcript size in RAM. With a 318 MB transcript, jq reached ~955 MB RSS, and on a host with little free memory it triggered a global OOM. The kernel killed the user's systemd manager, and with it the tmux session running Claude Code.

Environment

  • Plugin warp@claude-code-warp 2.1.0
  • Linux (Debian 13, kernel 6.12), 12 GB RAM, no swap
  • Claude Code in tmux over SSH; one long session (transcript 318 MB / ~106k lines)

What happened

At the end of a turn:

kernel: jq invoked oom-killer: ...
kernel: Out of memory: Killed process ... (systemd) ...
kernel: Out of memory: Killed process ... (jq) total-vm:966544kB, anon-rss:955692kB ...
systemd[1]: [email protected]: A process of this unit has been killed by the OOM killer.

The jq ran in the tmux scope, which points at the Stop hook. Killing the user manager took the tmux server and the Claude Code session down with it.

Cause

on-stop.sh runs jq -rs on the whole transcript twice, to extract the last user prompt and the last assistant response. -s slurps every line into one in-memory array, so memory grows with the whole session, although only the last prompt and response are needed. The work repeats on every turn.

Suggested fix

Both values are always near the end of the file, so read only the tail:

QUERY=$(tail -n 2000 "$TRANSCRIPT_PATH" | jq -rs '…same filter…' 2>/dev/null)
RESPONSE=$(tail -n 2000 "$TRANSCRIPT_PATH" | jq -rs '…same filter…' 2>/dev/null)

Transcript lines are self-contained JSON objects (JSONL), so tail -n never splits a record. On the same 318 MB transcript the tail is 3.7 MB, and the query still returns the correct last prompt. A streaming alternative (jq -c without -s, keeping the last match) would also work.

The same pattern is in scripts/legacy/on-stop.sh.

Lingua principale
Shell
Stelle
232
Fork
56
Merge medio
4g 15h
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 warpdotdev/claude-code-warp

Tutte le issue di warpdotdev/claude-code-warp

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.