mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 22:49:41 +02:00
fix: address medium severity issues from code review
- Fix inconsistent null handling in state-store (use ?? instead of ||) - Add JSON.stringify error handling with specific messages - Add error handling for SSE init event in app.js - Fix spawn orchestrator silent failures (add logging) - Fix statSync race condition in subagent-watcher - Fix unbounded _taskNumberToContent Map in ralph-tracker - Fix YAML pattern case sensitivity in ralph-config Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1250,6 +1250,9 @@ export class Session extends EventEmitter {
|
||||
}
|
||||
|
||||
private processOutput(data: string): void {
|
||||
// Early return if session is stopped to prevent any processing or timer creation
|
||||
if (this._isStopped) return;
|
||||
|
||||
// Try to extract JSON from output (Claude may output JSON in stream mode)
|
||||
this._lineBuffer += data;
|
||||
|
||||
@@ -1391,8 +1394,12 @@ export class Session extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
/** Maximum number of task descriptions to keep */
|
||||
private static readonly MAX_TASK_DESCRIPTIONS = 100;
|
||||
|
||||
/**
|
||||
* Remove task descriptions older than TASK_DESCRIPTION_MAX_AGE_MS.
|
||||
* Also enforces MAX_TASK_DESCRIPTIONS size limit.
|
||||
*/
|
||||
private cleanupOldTaskDescriptions(): void {
|
||||
const cutoff = Date.now() - Session.TASK_DESCRIPTION_MAX_AGE_MS;
|
||||
@@ -1401,6 +1408,15 @@ export class Session extends EventEmitter {
|
||||
this._recentTaskDescriptions.delete(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
// Enforce size limit by removing oldest entries
|
||||
if (this._recentTaskDescriptions.size > Session.MAX_TASK_DESCRIPTIONS) {
|
||||
const sortedKeys = Array.from(this._recentTaskDescriptions.keys()).sort((a, b) => a - b);
|
||||
const keysToRemove = sortedKeys.slice(0, this._recentTaskDescriptions.size - Session.MAX_TASK_DESCRIPTIONS);
|
||||
for (const key of keysToRemove) {
|
||||
this._recentTaskDescriptions.delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user