anthropics / anthropics/claude-code

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

Abierto
#94,251 1 comentario 0 reacciones 0 asignados Ver en GitHub
area:core area:hooks bug has repro platform:macos regression
Lenguaje dominante
Python
Estrellas
145k
Forks
23.1k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
cli
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Necesita aclaración
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.