@link-assistant/hive-mind 2.6.0 → 2.6.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 2.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ab8794: Make `HIVE_MIND_MIN_START_INTERVAL_MS` authoritative, warn when it is below the recommended 10-minute interval, and deprecate the redundant floor variable.
8
+
3
9
  ## 2.6.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -16,6 +16,19 @@ function readExplicitEnv(envVar) {
16
16
  return rawValue === undefined ? null : rawValue;
17
17
  }
18
18
 
19
+ /**
20
+ * Emit a warning once when an environment variable was explicitly configured.
21
+ *
22
+ * @param {string} envVar
23
+ * @param {string} warningKey
24
+ * @param {string} message
25
+ */
26
+ export function warnExplicitEnv(envVar, warningKey, message) {
27
+ if (readExplicitEnv(envVar) !== null) {
28
+ warnOnce(`${warningKey}:${envVar}`, message);
29
+ }
30
+ }
31
+
19
32
  function warnInvalid(envVar, rawValue, type, defaultValue, scope) {
20
33
  warnOnce(`invalid:${envVar}`, `[${scope}] ${envVar}=${JSON.stringify(rawValue)} is not a valid ${type}; using default ${defaultValue}.`);
21
34
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { ensureUseM } from './use-m-bootstrap.lib.mjs';
3
- import { clampEnvValue, parseIntegerEnv, parseNumberEnv } from './env-config.lib.mjs';
3
+ import { parseIntegerEnv, parseNumberEnv, warnExplicitEnv } from './env-config.lib.mjs';
4
4
 
5
5
  /**
6
6
  * Queue Configuration Module
@@ -183,7 +183,32 @@ const parseFloatWithDefault = (envVar, defaultValue) => parseNumberEnv(envVar, d
183
183
  const parseIntWithDefault = (envVar, defaultValue) => parseIntegerEnv(envVar, defaultValue, { scope: 'queue-config' });
184
184
 
185
185
  const DEFAULT_MINIMUM_START_INTERVAL_MS = 10 * 60 * 1000;
186
- const minimumStartIntervalMs = parseIntWithDefault('HIVE_MIND_MIN_START_INTERVAL_FLOOR_MS', DEFAULT_MINIMUM_START_INTERVAL_MS);
186
+ const START_INTERVAL_ENV = 'HIVE_MIND_MIN_START_INTERVAL_MS';
187
+ const LEGACY_START_INTERVAL_FLOOR_ENV = 'HIVE_MIND_MIN_START_INTERVAL_FLOOR_MS';
188
+
189
+ function resolveMinimumStartIntervalMs() {
190
+ const hasExplicitInterval = process.env[START_INTERVAL_ENV] !== undefined;
191
+ const hasLegacyFloor = process.env[LEGACY_START_INTERVAL_FLOOR_ENV] !== undefined;
192
+
193
+ if (hasLegacyFloor) {
194
+ warnExplicitEnv(LEGACY_START_INTERVAL_FLOOR_ENV, 'deprecated', `[queue-config] ${LEGACY_START_INTERVAL_FLOOR_ENV} is deprecated; use ${START_INTERVAL_ENV} instead.`);
195
+ }
196
+
197
+ let interval = DEFAULT_MINIMUM_START_INTERVAL_MS;
198
+ if (hasExplicitInterval) {
199
+ interval = parseIntWithDefault(START_INTERVAL_ENV, DEFAULT_MINIMUM_START_INTERVAL_MS);
200
+ } else if (hasLegacyFloor) {
201
+ interval = parseIntWithDefault(LEGACY_START_INTERVAL_FLOOR_ENV, DEFAULT_MINIMUM_START_INTERVAL_MS);
202
+ }
203
+
204
+ if (hasExplicitInterval && interval < DEFAULT_MINIMUM_START_INTERVAL_MS) {
205
+ warnExplicitEnv(START_INTERVAL_ENV, 'recommendation', `[queue-config] ${START_INTERVAL_ENV}=${interval} is below the recommended ${DEFAULT_MINIMUM_START_INTERVAL_MS} ms; short intervals can start a backlog before host metrics settle (#2015).`);
206
+ }
207
+
208
+ return interval;
209
+ }
210
+
211
+ const minimumStartIntervalMs = resolveMinimumStartIntervalMs();
187
212
 
188
213
  // Parse links notation config from environment variable (if provided)
189
214
  const linoConfig = parseQueueConfig(getenv('HIVE_MIND_QUEUE_CONFIG', ''));
@@ -267,13 +292,10 @@ export const QUEUE_CONFIG = {
267
292
  // MIN_START_INTERVAL_MS: Minimum global spacing between task startups.
268
293
  // Issue #2015: after resource thresholds clear, starting a backlog in a burst
269
294
  // can kill the next batch before host metrics have time to settle.
270
- // Issue #2053: operators can explicitly lower the safety floor on hosts where
271
- // resource metrics settle sooner. The default remains 10 minutes.
272
- MIN_START_INTERVAL_MS: clampEnvValue('HIVE_MIND_MIN_START_INTERVAL_MS', parseIntWithDefault('HIVE_MIND_MIN_START_INTERVAL_MS', DEFAULT_MINIMUM_START_INTERVAL_MS), {
273
- minimum: minimumStartIntervalMs,
274
- scope: 'queue-config',
275
- hint: 'Set HIVE_MIND_MIN_START_INTERVAL_FLOOR_MS to lower the minimum.',
276
- }),
295
+ // Issue #2065: an explicit interval is authoritative. The deprecated floor
296
+ // remains a fallback for existing deployments, while the default remains the
297
+ // safe 10-minute interval introduced for issue #2015.
298
+ MIN_START_INTERVAL_MS: minimumStartIntervalMs,
277
299
  CONSUMER_POLL_INTERVAL_MS: parseIntWithDefault('HIVE_MIND_CONSUMER_POLL_INTERVAL_MS', 60000), // 1 minute between queue checks
278
300
  MESSAGE_UPDATE_INTERVAL_MS: parseIntWithDefault('HIVE_MIND_MESSAGE_UPDATE_INTERVAL_MS', 60000), // 1 minute between status message updates
279
301