[BUG] Session context lost when exiting immediately after git commit/push

Resolved 💬 3 comments Opened Feb 4, 2026 by ZONGHAOLISOTA Closed Feb 8, 2026

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

  1. Start a Claude Code session
  2. Have a multi-turn conversation (e.g., analyze data, create config files)
  3. Ask Claude to git commit and push
  4. Exit Claude Code immediately after git push completes
  5. Resume with claude --resume <session-id>
  6. Result: Only git conversation visible

Scenario B: Context PRESERVED

  1. Same as above, but after git push...
  2. Have any follow-up conversation (e.g., "what did we commit?")
  3. Then exit
  4. Resume with claude --resume <session-id>
  5. 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗