Skip to content

fix: add timeout to BunProc.run to prevent indefinite hangs#174

Merged
konard merged 4 commits intomainfrom
issue-173-6bb51d117e4a
Feb 14, 2026
Merged

fix: add timeout to BunProc.run to prevent indefinite hangs#174
konard merged 4 commits intomainfrom
issue-173-6bb51d117e4a

Conversation

@konard
Copy link
Contributor

@konard konard commented Feb 14, 2026

Summary

This PR adds timeout support to the BunProc.run function to prevent indefinite hangs when using --model kilo/glm-5-free. The issue was that bun add @openrouter/ai-sdk-provider@latest would hang forever due to known Bun package manager issues.

Changes

  • Added DEFAULT_TIMEOUT_MS (2 minutes) for subprocess commands
  • Added INSTALL_TIMEOUT_MS (60 seconds) for package installation
  • Created TimeoutError for better error handling and retry logic
  • Added retry logic for timeout errors (up to 3 attempts)
  • Added helpful error messages for timeout and recovery scenarios

Root Cause Analysis

The hang was caused by known issues in Bun's package manager:

See the full analysis in docs/case-studies/issue-173/CASE-STUDY.md

Test Plan

  • ESLint passes
  • Prettier format check passes
  • The fix adds timeout to Bun.spawn() which is documented to kill the process after the specified duration
  • Timeout errors are retried up to 3 times before failing
  • Manual test with --model kilo/glm-5-free (requires network access to Kilo API)

Fixes

Fixes #173


🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #173
@konard konard self-assigned this Feb 14, 2026
This commit adds timeout support to the BunProc.run function and the
package installation process. The changes prevent indefinite hangs
caused by known Bun package manager issues:

- HTTP 304 response handling (oven-sh/bun#5831)
- Failed dependency fetch (oven-sh/bun#26341)
- IPv6 configuration issues

Key changes:
- Added DEFAULT_TIMEOUT_MS (2 minutes) for subprocess commands
- Added INSTALL_TIMEOUT_MS (60 seconds) for package installation
- Created TimeoutError for better error handling
- Added retry logic for timeout errors (up to 3 attempts)
- Added helpful error messages for timeout scenarios

The fix ensures that when using --model kilo/glm-5-free, the agent
will not hang indefinitely if the bun add command encounters issues.
Instead, it will timeout after 60 seconds and retry up to 3 times.

Fixes #173

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] --model kilo/glm-5-free is still not working fix: add timeout to BunProc.run to prevent indefinite hangs Feb 14, 2026
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review February 14, 2026 13:59
@konard
Copy link
Contributor Author

konard commented Feb 14, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $5.316962
  • Calculated by Anthropic: $3.593375 USD
  • Difference: $-1.723587 (-32.42%)
    📎 Log file uploaded as Gist (878KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit 8f8a9cb into main Feb 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--model kilo/glm-5-free is still not working

1 participant