Add stream inactivity timeout to prevent mid-session hangs (Issue #1444)#1445
Open
konard wants to merge 5 commits into
Open
Add stream inactivity timeout to prevent mid-session hangs (Issue #1444)#1445konard wants to merge 5 commits into
konard wants to merge 5 commits into
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #1444
The /hive command got stuck when Claude CLI stopped producing output mid-session (likely due to API rate limiting). The existing Issue #1280 timeout only triggers after a `result` event, which never arrived in this case. This adds a configurable inactivity timeout (default 5 min) that force-kills the process if no output is received for too long. - Add HIVE_MIND_STREAM_INACTIVITY_TIMEOUT_MS config (default 300000ms) - Reset inactivity timer on each stream chunk received - Clear inactivity timer when result event received (Issue #1280 takes over) - Add case study with full timeline reconstruction and root cause analysis Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
konard
marked this pull request as ready for review
March 19, 2026 10:36
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1444 —
/hivecommand stuck on completion requiring CTRL+C interruption.Root Cause
The Claude CLI stopped producing output mid-session while processing issue #299 from
suenot/machine-learning-for-trading, likely due to hitting the Anthropic API 7-day rate limit (utilization: 0.85,overage-status: rejected).The existing Issue #1280 fix (30s force-kill timeout) only activates after a
resultevent is received. Since the Claude CLI never emitted aresultevent (it was stuck waiting for an API response), the timeout was never started, and the process hung indefinitely.Solution
HIVE_MIND_STREAM_INACTIVITY_TIMEOUT_MS, default: 5 minutes) that force-kills the Claude CLI process if no output chunks are received for the configured durationresultevent is received, the inactivity timer is cleared and the existing Issue--tool claudecommand execution is stuck just after the success, and I had to manually interrupt it #1280 timer takes overTimeline from Log Analysis (156,197 lines)
09:50:52Z09:54:39Z7d-utilization: 0.85,overage-status: rejected09:55:55Ztool_resultfor file creation09:57:09ZFiles Changed
src/config.lib.mjs— AddstreamInactivityMstimeout configsrc/claude.lib.mjs— Add inactivity timeout logic complementing Issue--tool claudecommand execution is stuck just after the success, and I had to manually interrupt it #1280 fixdocs/case-studies/issue-1444/ANALYSIS.md— Full case study with timeline and root causeHow the Two Timeouts Work Together
resultevent)Test plan
npm test)npx eslint)/hiveagainst a repo and verify inactivity timeout fires if API becomes unresponsiveHIVE_MIND_STREAM_INACTIVITY_TIMEOUT_MSenv var override works🤖 Generated with Claude Code