@link-assistant/hive-mind 1.69.16 → 1.69.18
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 +22 -0
- package/package.json +1 -1
- package/src/config.lib.mjs +5 -3
- package/src/limits.lib.mjs +11 -6
- package/src/solve.repository.lib.mjs +6 -6
- package/src/telegram-show-limits.lib.mjs +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @link-assistant/hive-mind
|
|
2
2
|
|
|
3
|
+
## 1.69.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9aa5659: Fix `--auto-fork` mode failing when continuing an existing fork PR whose
|
|
8
|
+
fork name already contained the upstream-owner prefix. `setupRepository`
|
|
9
|
+
in `solve.repository.lib.mjs` was applying the
|
|
10
|
+
`--prefix-fork-name-with-owner-name` option to `forkRepoName` (which is
|
|
11
|
+
the authoritative head repo name from the PR's `headRepository.name`),
|
|
12
|
+
producing a doubled prefix like
|
|
13
|
+
`konard/labtgbot-labtgbot-telegram-claude-agent` and a 404 lookup. The
|
|
14
|
+
prefix option now only controls fork _creation_, not fork _lookup_:
|
|
15
|
+
when `forkRepoName` is present, the expected fork is
|
|
16
|
+
`${forkOwner}/${forkRepoName}` and no alternate-name fallback is
|
|
17
|
+
attempted. Resolves #1803.
|
|
18
|
+
|
|
19
|
+
## 1.69.17
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 46422f1: Increase the default `HIVE_MIND_USAGE_API_CACHE_TTL_MS` from 10 → 13 minutes so the Claude Usage API (`/api/oauth/usage`) is queried less frequently and we stop tripping the upstream "Resets in 3m Xs" rate-limit message. Operators can still override the value via the environment variable. Resolves #1798.
|
|
24
|
+
|
|
3
25
|
## 1.69.16
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/package.json
CHANGED
package/src/config.lib.mjs
CHANGED
|
@@ -528,12 +528,14 @@ export const getClaudeEnv = (options = {}) => {
|
|
|
528
528
|
// Cache TTL configurations (in milliseconds)
|
|
529
529
|
// The Usage API (Claude limits) has stricter rate limiting than regular APIs
|
|
530
530
|
// See: https://github.com/link-assistant/hive-mind/issues/1074
|
|
531
|
+
// See: https://github.com/link-assistant/hive-mind/issues/1798
|
|
531
532
|
export const cacheTtl = {
|
|
532
533
|
// General API cache TTL (GitHub API, etc.)
|
|
533
534
|
api: parseIntWithDefault('HIVE_MIND_API_CACHE_TTL_MS', 3 * 60 * 1000), // 3 minutes
|
|
534
|
-
// Claude Usage API cache TTL -
|
|
535
|
-
//
|
|
536
|
-
|
|
535
|
+
// Claude Usage API cache TTL - increased by 3 minutes (from 10 → 13) per issue #1798
|
|
536
|
+
// because users still hit "Resets in 3m xs" rate-limit responses. The API
|
|
537
|
+
// returns null values or 429 when called too frequently.
|
|
538
|
+
usageApi: parseIntWithDefault('HIVE_MIND_USAGE_API_CACHE_TTL_MS', 13 * 60 * 1000), // 13 minutes
|
|
537
539
|
// System metrics cache TTL (RAM, CPU, disk)
|
|
538
540
|
system: parseIntWithDefault('HIVE_MIND_SYSTEM_CACHE_TTL_MS', 2 * 60 * 1000), // 2 minutes
|
|
539
541
|
};
|
package/src/limits.lib.mjs
CHANGED
|
@@ -1271,17 +1271,20 @@ export function formatCodexLimitsSection(codexLimits, codexError = null, options
|
|
|
1271
1271
|
* Values are loaded from config.lib.mjs which supports environment variable overrides.
|
|
1272
1272
|
*
|
|
1273
1273
|
* IMPORTANT: The Claude Usage API has stricter rate limiting than regular APIs.
|
|
1274
|
-
* Calling it
|
|
1274
|
+
* Calling it too frequently may return null values or a 429 "Resets in Xm Xs" error.
|
|
1275
|
+
* Default raised from 10 → 13 minutes in issue #1798 (the previous 10-minute TTL still
|
|
1276
|
+
* occasionally tripped a ~3-minute rate-limit window).
|
|
1275
1277
|
* See: https://github.com/link-assistant/hive-mind/issues/1074
|
|
1278
|
+
* See: https://github.com/link-assistant/hive-mind/issues/1798
|
|
1276
1279
|
*
|
|
1277
1280
|
* Configurable via environment variables:
|
|
1278
1281
|
* - HIVE_MIND_API_CACHE_TTL_MS: General API cache TTL (default: 180000 = 3 minutes)
|
|
1279
|
-
* - HIVE_MIND_USAGE_API_CACHE_TTL_MS: Claude Usage API cache TTL (default:
|
|
1282
|
+
* - HIVE_MIND_USAGE_API_CACHE_TTL_MS: Claude Usage API cache TTL (default: 780000 = 13 minutes)
|
|
1280
1283
|
* - HIVE_MIND_SYSTEM_CACHE_TTL_MS: System metrics cache TTL (default: 120000 = 2 minutes)
|
|
1281
1284
|
*/
|
|
1282
1285
|
export const CACHE_TTL = {
|
|
1283
1286
|
API: cacheTtl.api, // 3 minutes for regular API calls (GitHub)
|
|
1284
|
-
USAGE_API: cacheTtl.usageApi, //
|
|
1287
|
+
USAGE_API: cacheTtl.usageApi, // 13 minutes for Claude Usage API (rate limited)
|
|
1285
1288
|
SYSTEM: cacheTtl.system, // 2 minutes for system metrics (RAM, CPU, disk)
|
|
1286
1289
|
};
|
|
1287
1290
|
|
|
@@ -1345,9 +1348,10 @@ export function resetLimitCache() {
|
|
|
1345
1348
|
|
|
1346
1349
|
export async function getCachedClaudeLimits(verbose = false) {
|
|
1347
1350
|
const cache = getLimitCache();
|
|
1348
|
-
// Use USAGE_API TTL (
|
|
1349
|
-
// The Claude Usage API returns null values when called too frequently
|
|
1351
|
+
// Use USAGE_API TTL (13 min by default, see issue #1798) for Claude limits to avoid rate limiting.
|
|
1352
|
+
// The Claude Usage API returns null values or 429 errors when called too frequently.
|
|
1350
1353
|
// See: https://github.com/link-assistant/hive-mind/issues/1074
|
|
1354
|
+
// See: https://github.com/link-assistant/hive-mind/issues/1798
|
|
1351
1355
|
const cached = cache.get('claude', CACHE_TTL.USAGE_API);
|
|
1352
1356
|
if (cached) {
|
|
1353
1357
|
if (verbose) console.log('[VERBOSE] /limits-cache: Using cached Claude limits (TTL: ' + Math.round(CACHE_TTL.USAGE_API / 60000) + ' minutes)');
|
|
@@ -1365,8 +1369,9 @@ export async function getCachedClaudeLimits(verbose = false) {
|
|
|
1365
1369
|
cache.set('claude', result, CACHE_TTL.USAGE_API);
|
|
1366
1370
|
} else if (result.error && result.error.includes('Rate limited')) {
|
|
1367
1371
|
// Cache rate-limit errors to prevent hammering the API
|
|
1368
|
-
// Use the same
|
|
1372
|
+
// Use the same USAGE_API TTL (13 min by default) as successful responses
|
|
1369
1373
|
// See: https://github.com/link-assistant/hive-mind/issues/1446
|
|
1374
|
+
// See: https://github.com/link-assistant/hive-mind/issues/1798
|
|
1370
1375
|
cache.set('claude-rate-limited', result, CACHE_TTL.USAGE_API);
|
|
1371
1376
|
if (verbose) console.log('[VERBOSE] /limits-cache: Cached rate-limit error for ' + Math.round(CACHE_TTL.USAGE_API / 60000) + ' minutes');
|
|
1372
1377
|
}
|
|
@@ -818,12 +818,12 @@ Thank you!`;
|
|
|
818
818
|
await log(`\n${formatAligned('🍴', 'Fork mode:', 'DETECTED from PR')}`);
|
|
819
819
|
await log(`${formatAligned('', 'Fork owner:', forkOwner)}`);
|
|
820
820
|
|
|
821
|
-
//
|
|
821
|
+
// Issue #1803: prefix flag controls fork CREATION; for lookup, trust forkRepoName from PR head data.
|
|
822
822
|
const headRepoName = forkRepoName || repo;
|
|
823
823
|
const standardForkName = `${forkOwner}/${headRepoName}`;
|
|
824
824
|
const prefixedForkName = `${forkOwner}/${owner}-${headRepoName}`;
|
|
825
|
-
const expectedForkName = argv.prefixForkNameWithOwnerName ? prefixedForkName : standardForkName;
|
|
826
|
-
const alternateForkName = argv.prefixForkNameWithOwnerName ? standardForkName : prefixedForkName;
|
|
825
|
+
const expectedForkName = forkRepoName ? `${forkOwner}/${forkRepoName}` : argv.prefixForkNameWithOwnerName ? prefixedForkName : standardForkName;
|
|
826
|
+
const alternateForkName = forkRepoName ? null : argv.prefixForkNameWithOwnerName ? standardForkName : prefixedForkName;
|
|
827
827
|
|
|
828
828
|
await log(`${formatAligned('✅', 'Using fork:', expectedForkName)}\n`);
|
|
829
829
|
|
|
@@ -832,9 +832,9 @@ Thank you!`;
|
|
|
832
832
|
let forkCheckResult = await $`gh repo view ${expectedForkName} --json name 2>/dev/null`;
|
|
833
833
|
let actualForkName = expectedForkName;
|
|
834
834
|
|
|
835
|
-
if (forkCheckResult.code !== 0 && !argv.prefixForkNameWithOwnerName) {
|
|
836
|
-
// Only try alternate name if
|
|
837
|
-
//
|
|
835
|
+
if (forkCheckResult.code !== 0 && alternateForkName && !argv.prefixForkNameWithOwnerName) {
|
|
836
|
+
// Only try alternate name if --prefix-fork-name-with-owner-name is off AND we're guessing
|
|
837
|
+
// (forkRepoName authoritative → alternateForkName is null and no fallback is attempted).
|
|
838
838
|
forkCheckResult = await $`gh repo view ${alternateForkName} --json name 2>/dev/null`;
|
|
839
839
|
if (forkCheckResult.code === 0) {
|
|
840
840
|
actualForkName = alternateForkName;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* the args before they are forwarded to /solve, /hive (or /task --split). When
|
|
6
6
|
* set, the bot:
|
|
7
7
|
* 1. Fetches usage limits for the selected tool (Claude or Codex) using the
|
|
8
|
-
* shared cached helpers in limits.lib.mjs (TTL:
|
|
9
|
-
*
|
|
8
|
+
* shared cached helpers in limits.lib.mjs (USAGE_API TTL: 13 minutes by
|
|
9
|
+
* default — see issue #1798 — to avoid rate limiting).
|
|
10
10
|
* 2. Embeds a compact "Limits at start" snapshot below the infoBlock so the
|
|
11
11
|
* starting/executing message shows the user how much budget they had at
|
|
12
12
|
* the moment the command was queued.
|