[BUG] Session context lost when exiting immediately after git commit/push
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?
When a Claude Code session ends immediately after git commit and git push operations, the session context is truncated on resume. Only the git-related conversation is visible; earlier work is hidden behind a poor-quality summary.
Key finding: The bug is triggered specifically when git operations are the LAST action before exit. If you have any follow-up conversation after git operations, the full context is preserved.
Evidence: Session file shows summary "Git commit and push script execution" that hides earlier work (analyzing data, creating config files). The data IS in the .jsonl file - it's a display/summarization bug, not data loss.
What Should Happen?
Full conversation history should be visible when resuming. Small sessions (168KB / 70 lines) should not be summarized. If summarization occurs, it should capture the main tasks, not just the last action
Error Messages/Logs
No error messages. Session file shows:
Line 69: Summary = 'Git commit and push script execution'
Line 91: Summary = 'Git commit script with ablation experiment context'
Steps to Reproduce
Scenario A: Context LOST
- Start a Claude Code session
- Have a multi-turn conversation (e.g., analyze data, create config files)
- Ask Claude to
git commit and push - Exit Claude Code immediately after git push completes
- Resume with
claude --resume <session-id> - Result: Only git conversation visible
Scenario B: Context PRESERVED
- Same as above, but after git push...
- Have any follow-up conversation (e.g., "what did we commit?")
- Then exit
- Resume with
claude --resume <session-id> - Result: Full history preserved
Workaround: Always have a conversation after git operations before exiting.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.31
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
## RunPod Setup
Tested on RunPod with symlink persistence:
- ~/.claude/projects → /workspace/.claude-persistent/projects
- Untested on local installations
## Related Issues
- #22107 - Similar symptom but different cause (parentUuid chains vs summarization)
- This issue has a specific trigger and workaround not covered by #22107
## Detection
Session data IS preserved in .jsonl file:
grep '"content"' ~/.claude/projects/<project>/<session>.jsonl
The conversation exists - it's hidden, not lost.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗