anthropics / anthropics/claude-code
[BUG] 2.1.270: session transcript JSONL omits most assistant text written before a tool call (interactive CLI)
- 主要言語
- Python
- スター
- 145k
- フォーク
- 23.1k
- PR マージ指標
- PR 指標を取得中
説明
## What happens
Since upgrading from 2.1.267 to 2.1.270, the session transcript (`projects//.jsonl`) is missing most assistant `text` blocks that come before a `tool_use` in the same response. The text is shown in the terminal as normal. `thinking` and `tool_use` rows are still written, the latter with full input. End-of-turn text is affected much less.
The text is not elsewhere in the file: a phrase from a reply shown in the UI appears only inside later tool inputs that quote it.
## Measurements
All assistant rows over six days on one machine, one model (`claude-opus-5`), all `entrypoint: cli`, split by the two `CLAUDE_CONFIG_DIR` profiles used here:
| version | profile | assistant rows | rows with a `text` block | share |
|---|---|---:|---:|---:|
| 2.1.267 | A | 6,712 | 1,771 | 26.4% |
| 2.1.267 | B | 12,427 | 3,427 | 27.6% |
| 2.1.270 | A | 1,970 | 253 | 12.8% |
| 2.1.270 | B | 2,536 | 74 | 2.9% |
- Text rows with `stop_reason: tool_use`, as a share of tool calls: 51.7% → 13.6% in profile A and 53.7% → 1.9% in profile B, 2.1.267 → 2.1.270.
- One session resumed across the upgrade went from 372 text blocks in 1,262 assistant rows (2.1.263) to 3 in 40 (2.1.270).
- Haiku sessions that never call tools record text on every response, on both versions.
- Both profiles share `settings.json`. Profile B signs in with `forceLoginMethod: "claudeai"` to an organisation account; I have not established whether that is why it is worse.
## Why it matters
Hooks that read `transcript_path` to check what the model said before a tool call can no longer see it, and the PreToolUse payload carries no assistant text. A PreToolUse hook here that requires a written marker before certain commands became impossible to satisfy on 2.1.270.
## Related
#65051 (daemon sessions, 2.1.161) and #76668 (desktop app) describe the same shape on other entrypoints; this is the interactive CLI.
**Environment:** Claude Code 2.1.270, macOS 26.5 (Darwin 25.5.0), zsh, iTerm2.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Reproduce the issue through the interactive CLI using the reported version range, then inspect how transcript_path records assistant responses before tool_use and how the PreToolUse payload is formed. Compare a working 2.1.267 session with 2.1.270; done means assistant text before tool calls is retained in the session JSONL and is available to the hook.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 38/100