[BUG] Transcript file not updating
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
At a certain point (unsure when or why), the transcript file being given to statusline script becomes stale and stops updating - no new messages are added to the transcript from that point on.
What Should Happen?
In previous versions of Claude Code, the transcript updated in real time and every time statusline received the transcript path, the file it pointed to contained all messages in the transcript up until the exact moment it was handed off.
Now, after a certain number of messages or amount of time, for an unknown reason, the transcript stops receiving new messages despite being triggered and handed off to statusline execution.
Error Messages/Logs
Could not find any error messages.
Steps to Reproduce
- Create a minimal statusline script
statusline-bug-repro.py:
```python
#!/usr/bin/env python3
"""Minimal statusline to reproduce transcript staleness"""
import json, sys, os
from datetime import datetime
from pathlib import Path
data = json.loads(sys.stdin.read())
transcript_path = data.get('transcript_path')
debug_log = Path.home() / ".cache/claude-code/transcript-debug.log"
debug_log.parent.mkdir(parents=True, exist_ok=True)
context_length = None
if transcript_path and os.path.exists(transcript_path):
with open(transcript_path, 'r') as f:
lines = f.readlines()
# Find most recent usage data
for line in lines:
try:
entry = json.loads(line.strip())
if not entry.get('isSidechain') and entry.get('message', {}).get('usage'):
usage = entry['message']['usage']
context_length = (usage.get('input_tokens', 0) +
usage.get('cache_read_input_tokens', 0) +
usage.get('cache_creation_input_tokens', 0))
except: pass
# Log token count with timestamp
with open(debug_log, 'a') as log:
log.write(f"[{datetime.now().isoformat()}] tokens={context_length} lines={len(lines)}\n")
print(f"Tokens: {context_length or 'N/A'}")
- Configure Claude Code to use this statusline in settings
- Start a conversation and send multiple messages until the statusline token count goes stale (stops updating)
- Check ~/.cache/claude-code/transcript-debug.log
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
<2.0.0
Claude Code Version
2.0.1
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
I'm using Wezterm
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗