claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] IDE Diff Approval Adds Entire File to Context Instead of Diff

Open Dragonight opened this issue 1 year ago • 3 comments

Bug Description IDE diff approval adds entire file content to context instead of just the diff. This happens for ALL file sizes, causing rapid context exhaustion even with smaller files.

Critical Discovery:

  • BUG OCCURS: When clicking "Accept" in JetBrains IDE diff confirmation → entire file added to context (very bad)
  • BUG AVOIDED: When clicking confirmation in Claude Code terminal while IDE diff is open → only diff added to context (correct behavior)

Reproduction (clean session test - consistently reproduced every time):

  1. Start fresh Claude Code session
  2. Run /context - empty (9% usage)
  3. Make a small edit in a big file of 9000+ lines / 300KB+ (for example, ask Claude to add an import)
  4. IDE shows diff confirmation dialog with "Accept" or "Reject" buttons.
  5. Path A: Click "Accept" in IDE → ERROR "Context low" and cannot continue → /context shows over 100% overflow ❌
  6. Path B: Click "Accept" in Claude Code terminal → Continues with no error → /context shows almost empty context like before ✅

The Problem:

  • Large files (7000+ lines / 300KB+): Immediate context overflow, session unusable
  • Medium files (1000-5000 lines): Context fills fast, requiring frequent compaction

This means even normal-sized projects become unmanageable as edits add entire file contents, not just the changes.

Workaround Found: Always confirm changes in Claude Code terminal, never use IDE's Accept button. Or always use auto-accept on so no changes are being asked for approval at all.

Expected Behavior: Both confirmation methods should only add the diff to context. A 1-word change should add ~10-50 tokens regardless of file size.

Impact:

  • Makes IDE's natural workflow unusable
  • Forces constant context management even for small files
  • Requires users to remember terminal-only confirmation
  • Unable to manually modify suggested changes before accepting them.

Environment:

  • JetBrains IDE WebStorm (latest) & PyCharm (latest) with official Claude Code plugin 0.1.11-beta (latest)
  • Terminal: pycharm / webstorm (PowerShell 7 inside the IDE)
  • Platform: win32 (Windows 11)
  • Version: 1.0.112
  • All Claude Code versions affected (including latest 1.0.112)
  • Bug isolated to IDE plugin's diff approval handler

This is a critical bug in the IDE plugin that breaks the fundamental context management model.

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 205699 tokens > 200000 maximum\"}}\n    at J4.generate"}]

Dragonight avatar Sep 13 '25 01:09 Dragonight

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 08 '25 10:12 github-actions[bot]

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] avatar Jan 08 '26 10:01 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jan 15 '26 14:01 github-actions[bot]