@link-assistant/hive-mind 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/telegram-solve-queue.lib.mjs +33 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @link-assistant/hive-mind
|
|
2
2
|
|
|
3
|
+
## 1.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d39bf3e: Fix disk threshold to use one-at-a-time mode instead of blocking all commands
|
|
8
|
+
- When disk usage exceeds threshold (90%), now allows exactly one command to run
|
|
9
|
+
- Previously, disk threshold blocked ALL commands unconditionally (like RAM/CPU)
|
|
10
|
+
- Now matches behavior of Claude API thresholds (CLAUDE_5_HOUR_SESSION_THRESHOLD, CLAUDE_WEEKLY_THRESHOLD)
|
|
11
|
+
- Allows controlled task execution during high disk usage while preventing multiple tasks from exhausting resources
|
|
12
|
+
|
|
13
|
+
Fixes #1155
|
|
14
|
+
|
|
3
15
|
## 1.9.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -34,16 +34,16 @@ import { getCachedClaudeLimits, getCachedGitHubLimits, getCachedMemoryInfo, getC
|
|
|
34
34
|
export const QUEUE_CONFIG = {
|
|
35
35
|
// Resource thresholds (usage ratios: 0.0 - 1.0)
|
|
36
36
|
// All thresholds use >= comparison (inclusive)
|
|
37
|
-
RAM_THRESHOLD: 0.65, //
|
|
37
|
+
RAM_THRESHOLD: 0.65, // Enqueue if RAM usage >= 65%
|
|
38
38
|
// CPU threshold uses 5-minute load average, not instantaneous CPU usage
|
|
39
|
-
CPU_THRESHOLD: 0.
|
|
40
|
-
DISK_THRESHOLD: 0.
|
|
39
|
+
CPU_THRESHOLD: 0.65, // Enqueue if 5-minute load average >= 65% of CPU count
|
|
40
|
+
DISK_THRESHOLD: 0.9, // One-at-a-time if disk usage >= 90%
|
|
41
41
|
|
|
42
42
|
// API limit thresholds (usage ratios: 0.0 - 1.0)
|
|
43
43
|
// All thresholds use >= comparison (inclusive)
|
|
44
|
-
CLAUDE_5_HOUR_SESSION_THRESHOLD: 0.85, //
|
|
44
|
+
CLAUDE_5_HOUR_SESSION_THRESHOLD: 0.85, // One-at-a-time if 5-hour limit >= 85%
|
|
45
45
|
CLAUDE_WEEKLY_THRESHOLD: 0.98, // One-at-a-time if weekly limit >= 98%
|
|
46
|
-
GITHUB_API_THRESHOLD: 0.8, //
|
|
46
|
+
GITHUB_API_THRESHOLD: 0.8, // Enqueue if GitHub >= 80% with parallel claude
|
|
47
47
|
|
|
48
48
|
// Timing
|
|
49
49
|
// MIN_START_INTERVAL_MS: Time to allow solve command to start actual claude process
|
|
@@ -431,11 +431,15 @@ export class SolveQueue {
|
|
|
431
431
|
this.recordThrottle('claude_running');
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
// Check system resources (
|
|
435
|
-
|
|
434
|
+
// Check system resources (RAM, CPU block unconditionally; disk uses one-at-a-time mode)
|
|
435
|
+
// See: https://github.com/link-assistant/hive-mind/issues/1155
|
|
436
|
+
const resourceCheck = await this.checkSystemResources(totalProcessing);
|
|
436
437
|
if (!resourceCheck.ok) {
|
|
437
438
|
reasons.push(...resourceCheck.reasons);
|
|
438
439
|
}
|
|
440
|
+
if (resourceCheck.oneAtATime) {
|
|
441
|
+
oneAtATime = true;
|
|
442
|
+
}
|
|
439
443
|
|
|
440
444
|
// Check API limits (pass hasRunningClaude and totalProcessing for uniform checking)
|
|
441
445
|
const limitCheck = await this.checkApiLimits(hasRunningClaude, totalProcessing);
|
|
@@ -478,17 +482,22 @@ export class SolveQueue {
|
|
|
478
482
|
* This provides a more stable metric that isn't affected by brief spikes
|
|
479
483
|
* during claude process startup.
|
|
480
484
|
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
+
* Resource threshold modes:
|
|
486
|
+
* - RAM_THRESHOLD: Enqueue mode - blocks all commands unconditionally
|
|
487
|
+
* - CPU_THRESHOLD: Enqueue mode - blocks all commands unconditionally
|
|
488
|
+
* - DISK_THRESHOLD: One-at-a-time mode - allows exactly one command when nothing is processing
|
|
489
|
+
*
|
|
490
|
+
* See: https://github.com/link-assistant/hive-mind/issues/1155
|
|
485
491
|
*
|
|
486
|
-
* @
|
|
492
|
+
* @param {number} totalProcessing - Total processing count (queue + external claude processes)
|
|
493
|
+
* @returns {Promise<{ok: boolean, reasons: string[], oneAtATime: boolean}>}
|
|
487
494
|
*/
|
|
488
|
-
async checkSystemResources() {
|
|
495
|
+
async checkSystemResources(totalProcessing = 0) {
|
|
489
496
|
const reasons = [];
|
|
497
|
+
let oneAtATime = false;
|
|
490
498
|
|
|
491
499
|
// Check RAM (using cached value)
|
|
500
|
+
// Enqueue mode: blocks all commands unconditionally
|
|
492
501
|
const memResult = await getCachedMemoryInfo(this.verbose);
|
|
493
502
|
if (memResult.success) {
|
|
494
503
|
const usedRatio = memResult.memory.usedPercentage / 100;
|
|
@@ -499,6 +508,7 @@ export class SolveQueue {
|
|
|
499
508
|
}
|
|
500
509
|
|
|
501
510
|
// Check CPU using 5-minute load average (more stable than 1-minute)
|
|
511
|
+
// Enqueue mode: blocks all commands unconditionally
|
|
502
512
|
// Cache TTL is 2 minutes, which is appropriate for this metric
|
|
503
513
|
const cpuResult = await getCachedCpuInfo(this.verbose);
|
|
504
514
|
if (cpuResult.success) {
|
|
@@ -522,22 +532,26 @@ export class SolveQueue {
|
|
|
522
532
|
}
|
|
523
533
|
|
|
524
534
|
// Check disk space (using cached value)
|
|
525
|
-
//
|
|
526
|
-
// Unlike
|
|
527
|
-
//
|
|
528
|
-
// See: https://github.com/link-assistant/hive-mind/issues/
|
|
535
|
+
// One-at-a-time mode: allows exactly one command when nothing is processing
|
|
536
|
+
// Unlike RAM and CPU which block unconditionally, disk uses one-at-a-time mode
|
|
537
|
+
// because we cannot predict how much disk space a task will use
|
|
538
|
+
// See: https://github.com/link-assistant/hive-mind/issues/1155
|
|
529
539
|
const diskResult = await getCachedDiskInfo(this.verbose);
|
|
530
540
|
if (diskResult.success) {
|
|
531
541
|
// Calculate usage from free percentage
|
|
532
542
|
const usedPercent = 100 - diskResult.diskSpace.freePercentage;
|
|
533
543
|
const usedRatio = usedPercent / 100;
|
|
534
544
|
if (usedRatio >= QUEUE_CONFIG.DISK_THRESHOLD) {
|
|
535
|
-
|
|
545
|
+
oneAtATime = true;
|
|
536
546
|
this.recordThrottle('disk_high');
|
|
547
|
+
// Only block if something is already processing (one-at-a-time mode)
|
|
548
|
+
if (totalProcessing > 0) {
|
|
549
|
+
reasons.push(formatWaitingReason('disk', usedPercent, QUEUE_CONFIG.DISK_THRESHOLD) + ' (waiting for current command)');
|
|
550
|
+
}
|
|
537
551
|
}
|
|
538
552
|
}
|
|
539
553
|
|
|
540
|
-
return { ok: reasons.length === 0, reasons };
|
|
554
|
+
return { ok: reasons.length === 0, reasons, oneAtATime };
|
|
541
555
|
}
|
|
542
556
|
|
|
543
557
|
/**
|