mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-06 07:29:42 +02:00
fix: memory leaks and error handling improvements
- execution-bridge: track and cleanup retry timers to prevent memory leaks - model-selector: add exhaustive type check for ModelTier - ralph-tracker: fix division by zero when summary.total is 0 - respawn-controller: remove event listeners on stop to prevent memory leaks - screen-manager: use Promise.allSettled for better error handling in stats - session-manager: use Promise.allSettled for stopAllSessions resilience Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -931,7 +931,7 @@ export class RalphTracker extends EventEmitter {
|
||||
// Prevent unbounded line buffer growth from very long lines
|
||||
if (this._lineBuffer.length > MAX_LINE_BUFFER_SIZE) {
|
||||
// Truncate to last portion to preserve recent data
|
||||
this._lineBuffer = this._lineBuffer.slice(-MAX_LINE_BUFFER_SIZE / 2);
|
||||
this._lineBuffer = this._lineBuffer.slice(-Math.floor(MAX_LINE_BUFFER_SIZE / 2));
|
||||
}
|
||||
|
||||
// Process complete lines
|
||||
@@ -2614,12 +2614,14 @@ export class RalphTracker extends EventEmitter {
|
||||
recommendations.push('More tasks have failed than completed. Review approach and consider plan adjustment.');
|
||||
}
|
||||
|
||||
const progressPercent = Math.round((summary.completed / summary.total) * 100);
|
||||
const progressPercent = summary.total > 0
|
||||
? Math.round((summary.completed / summary.total) * 100)
|
||||
: 0;
|
||||
if (progressPercent < 20 && this._loopState.cycleCount > 10) {
|
||||
recommendations.push('Progress is slow. Consider simplifying tasks or reviewing dependencies.');
|
||||
}
|
||||
|
||||
if (summary.blocked > summary.total / 3) {
|
||||
if (summary.total > 0 && summary.blocked > summary.total / 3) {
|
||||
recommendations.push('Many tasks are blocked. Review dependency chain for bottlenecks.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user