Frontend freezes when background Task agent completes, input buffer lost

Resolved 💬 3 comments Opened Jan 2, 2026 by sjc00 Closed Jan 6, 2026

Description

When a background agent (spawned via Task tool with run_in_background: true) completes, the Claude Code frontend freezes momentarily. Any text the user was typing in the input buffer at that moment is lost.

Steps to Reproduce

  1. Start a Claude Code session
  2. Spawn a background agent:

``
Task(
subagent_type="general-purpose",
run_in_background=true,
prompt="..."
)
``

  1. While agent runs, start typing a long message in the input field
  2. When agent completes (notification appears), the frontend freezes
  3. Input buffer is cleared - typed text is lost

Expected Behavior

  • Frontend should not freeze when background agents complete
  • Input buffer should be preserved regardless of background events
  • User should be able to continue typing uninterrupted

Actual Behavior

  • Frontend freezes briefly when background agent completes
  • Any text in the input buffer is lost
  • User must retype their message

Environment

  • macOS Darwin 24.6.0
  • Apple M4, 16GB RAM
  • Claude Code (latest as of 2026-01-02)

Impact

High - users lose work (typed text) unexpectedly. In this case, ~100 words of thought were lost.

Suggested Fix

Decouple the background agent completion notification/UI update from the input buffer state. Consider:

  • Debouncing UI updates
  • Preserving input buffer contents across re-renders
  • Using a separate thread/process for notification handling

View original on GitHub ↗

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