Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#90 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
shell
領域
tooling

調査の方向性

scripts/on-stop.sh と scripts/legacy/on-stop.sh を読み、2 つの jq -rs による transcript の読み取りと、そこから最後の prompt と response をどのように抽出しているかに注目してください。大きな JSONL transcript を使って動作を再現するか、まず既存のフィルターを確認してください。両方の hook が transcript 全体を読み込まず、それでも正しい最後の prompt と response を返せれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Shell
スター
232
フォーク
56
平均マージ
4日 15時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

warpdotdev/claude-code-warp のほかの issue

warpdotdev/claude-code-warp の issue をすべて見る

似ている issue

Shell/Bash の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。