[FEATURE] Feature Request: SSE keep-alive / heartbeat during tool execution

Resolved 💬 3 comments Opened Apr 8, 2026 by Alessio-I Closed May 22, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Problem

When Claude Code executes long-running tools (e.g. reading large files), the SSE stream goes silent until the tool completes. During this idle period, corporate HTTP proxies with connection idle timeouts (typically 60–120s) drop the connection, causing persistent ECONNRESET errors.

Once a session hits this state, retries keep failing on the same broken connection. A fresh session works again — but only until the next long tool execution.

This affects users behind corporate networks who cannot modify proxy/firewall timeout settings.

Expected behavior

The API should send periodic SSE keep-alive comments (e.g. : ping or empty SSE comments) during tool execution to keep the connection alive through proxies.

This is a well-established pattern — for example, OpenAI sends empty SSE comments during long-running streaming responses for exactly this reason.

Proposed Solution

Suggestion

Implement periodic SSE keep-alive messages (e.g. every 15–30s) on the API stream during tool execution phases, so that proxies and firewalls see ongoing traffic and don't terminate the connection.

Alternative Solutions

Current workarounds

None of these fully solve the problem:

  • /clear and /compact help avoid context buildup but don't prevent long individual tool executions from stalling.
  • CLAUDE_ENABLE_STREAM_WATCHDOG=1 only aborts stalled streams faster — it doesn't prevent the drop.
  • Splitting reads into smaller chunks is possible but defeats the purpose of agentic tool use.
  • Using a mobile hotspot to bypass the corporate proxy works but is impractical as a permanent solution.

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

Use Case Example

A developer working on a large Java/Angular monorepo uses Claude Code to
analyze and refactor code. A typical task:

"Read src/main/java/com/example/service/PaymentService.java and suggest improvements for error handling"

The file is ~800 lines. Claude Code starts a tool execution to read the file.
During this phase, the SSE stream goes silent for 60-90 seconds. The corporate
proxy interprets this as an idle connection and drops it → ECONNRESET.

The developer now has to:

  1. Start a fresh session (/clear)
  2. Manually split the file (head -n 200 ... | claude)
  3. Repeat for each chunk
  4. Mentally stitch the results together

This turns a single 30-second agentic task into a 10-minute manual workflow,
eliminating the core value proposition of Claude Code as an autonomous coding agent.

With SSE keep-alive, the proxy would see ongoing traffic during tool execution
and the entire flow would complete without interruption.

Additional Context

Environment

  • Claude Code CLI (latest)
  • Behind corporate HTTP proxy with ~60–120s idle timeout
  • Windows + WSL

View original on GitHub ↗

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