| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
- Add JWT expiration check utility - Implement dynamic base URL resolution based on token environment - Add missing x-api-key and Authorization: Bearer headers - Add organizationId to ApiAuth schema - Add proactive token expiration warnings in CLI and model discovery
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…itely When network issues occur mid-stream (TCP half-open connections, stalled LLM providers, proxy timeouts), the streaming loop would hang forever waiting for the next chunk. This fix adds an idle timeout that detects when no data has been received for a configurable period (default 60 seconds) and triggers a retry with exponential backoff. Changes: - Add StreamIdleTimeoutError class to message-v2.ts - Add withIdleTimeout() async generator wrapper in processor.ts - Wrap stream.fullStream with idle timeout in the process loop - Mark StreamIdleTimeoutError as retryable so sessions recover automatically - Add stream_idle_timeout config option under experimental settings - Add additional network error types (ETIMEDOUT, ENOTFOUND, etc) as retryable Fixes issues where sessions get stuck for hours on LLM requests. Related: anomalyco#8383, anomalyco#2512, anomalyco#2819, anomalyco#4255
fix: add stream idle timeout to prevent sessions from hanging indefinitely
Integrate Kilo Code provider: - Add kilocode device authorization flow in auth.ts - Add kilocode provider loader in provider.ts - Add dynamic model discovery from Kilo Code API in models.ts - Add JWT expiry check for kilocode tokens in run.ts - Add install:local script for developer convenience - Add desktop infra import in sst.config.ts Preserves dev branch improvements: - Provider filtering (enabled/disabled providers) - Improved Data lazy loading with Flag support - Better message handling in run command - Plugin auth handling
This feature was causing more problems than it solved. Tool execution blocks the stream, so the timeout couldn't distinguish between: 1. LLM provider stalled (actual problem) 2. Tool executing (normal operation) Reverting to upstream behavior - no stream idle timeout.
…andlers - Add SIGTERM/SIGINT/SIGHUP handlers in index.ts and worker.ts to run Instance.disposeAll() on signal-based termination - Fix unreachable cleanup code in serve.ts by replacing infinite promise with signal-based exit - Replace O(n²) string concatenation in bash tool with Buffer[] ring buffer capped at 10MB - Replace deep clone of message history in prompt.ts with shallow copy - Add dispose callbacks to PermissionNext and Question state to reject pending promises on instance disposal - Add dispose() method to ACPSessionManager to clear sessions map - Add close() method to AsyncQueue with done signal for bounded iteration - Add dispose callback to FileTime state to clear read records and locks Closes anomalyco#12687
|
The following comment was made by an LLM, it may be inaccurate: Found potentially related PRs:
Note: The PR description already acknowledges these overlapping community PRs (#12053, #10392, #12259, #9693, #9146, #9147, #7914) as partial solutions that this comprehensive PR supersedes. PR #12877 appears most directly related as it attempts the same signal handler approach. |
Sorry, something went wrong.
|
slop why would this be touching infra files for our web stuff? |
Sorry, something went wrong.
Self-Review and CleanupAfter a thorough review of the initial commit, I found and corrected several issues before force-pushing: Problems caught and fixed
Final state: 8 files, all meaningful
All 844 tests pass. Typecheck passes across all 17 packages. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fixes critical memory leaks and zombie process accumulation that cause kernel panics on macOS. Users with 16GB MacBook Pros report 10+ zombie opencode processes consuming ~9.4GB, requiring forced reboots every few days.
Closes #12687
Root Causes Addressed
No signal handlers — index.ts and worker.ts had no SIGTERM/SIGINT/SIGHUP handlers. When a terminal is closed (SIGHUP), all child processes (LSP servers, MCP servers, bash tool processes spawned with detached: true) are orphaned as zombies. This is the primary cause.
Unreachable cleanup code in serve.ts — await new Promise(() => {}) blocks forever, making server.stop() dead code.
O(n²) string concatenation in bash tool and prompt shell — output += chunk.toString() causes massive transient memory spikes for verbose commands, plus Buffer.concat(chunks).toString() was being called on every data event for TUI metadata preview.
Deep clone of entire message history — clone(msgs) from remeda deep-copies all messages (including large tool outputs) every prompt loop iteration just to wrap text in <system-reminder> tags.
Missing dispose callbacks — PermissionNext and Question modules register state without dispose callbacks. Pending promise closures (holding references to resolve/reject functions and their associated data) leak on instance disposal.
Unbounded FileTime data — FileTime read records and locks grow without bound and have no cleanup on instance disposal.
Changes (8 files)
Fix 1: Graceful shutdown signal handlers (index.ts, worker.ts, serve.ts)
Fix 2: Bash/shell output ring buffer (bash.ts, prompt.ts)
Fix 3: Shallow copy instead of deep clone (prompt.ts)
Fix 4: Missing dispose callbacks (permission/next.ts, question/index.ts)
Fix 5: FileTime cleanup (file/time.ts)
Testing
Related Issues/PRs
Multiple community PRs address overlapping subsets of this problem: #12053, #10392, #12259, #9693, #9146, #9147, #7914. This PR provides a comprehensive fix covering all identified root causes.