claude-code - 💡(How to fix) Fix [BUG] PostToolUse hook blocks Edit diff rendering in CLI [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#50831Fetched 2026-04-20 12:11:50
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×3
RAW_BUFFERClick to expand / collapse

Version: 2.1.114 OS: Windows 11, CLI

When a long-running PostToolUse hook fires after Edit, the CLI withholds the diff until the hook exits. Diff + hook stdout appear together after the full duration — with a 30–60s hook the agent appears completely frozen.

VS Code extension handles this correctly: diff renders immediately, hook output appears after. CLI should match.

Repro:

  1. Configure a PostToolUse hook on Edit that takes 30+ seconds
  2. Claude edits a file in CLI
  3. Diff is not shown until hook completes

Related: #47692

extent analysis

TL;DR

The CLI should be modified to render the diff immediately, without waiting for the PostToolUse hook to complete, to match the behavior of the VS Code extension.

Guidance

  • Investigate the current implementation of the PostToolUse hook in the CLI to understand why it withholds the diff until the hook exits.
  • Consider introducing a mechanism to render the diff immediately, while allowing the hook to run in the background and display its output afterwards.
  • Review the related issue #47692 for potential insights or solutions that could be applied to this problem.
  • Test any proposed changes with a long-running PostToolUse hook to ensure the diff is displayed promptly and the hook output appears as expected.

Example

No code snippet is provided as the issue does not contain sufficient technical details to generate a specific example.

Notes

The solution may require significant changes to the CLI's architecture or the PostToolUse hook implementation, and may involve trade-offs between functionality and performance.

Recommendation

Apply workaround: Modify the CLI to render the diff immediately, without waiting for the PostToolUse hook to complete, to improve the user experience and match the behavior of the VS Code extension. This approach is recommended because it addresses the primary issue of the CLI appearing frozen during long-running hooks.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] PostToolUse hook blocks Edit diff rendering in CLI [3 comments, 3 participants]