anthropics / anthropics/claude-code

[BUG] 2.1.270: session transcript JSONL omits most assistant text written before a tool call (interactive CLI)

Offen
#94,251 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:core area:hooks bug has repro platform:macos regression
Vorherrschende Sprache
Python
Sterne
145k
Forks
23.1k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

## 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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.