@link-assistant/hive-mind 2.13.3 → 2.13.4
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 +6 -0
- package/package.json +1 -1
- package/src/github-url-parser.lib.mjs +31 -1
- package/src/github.lib.mjs +3 -2
- package/src/solve.mjs +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @link-assistant/hive-mind
|
|
2
2
|
|
|
3
|
+
## 2.13.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 36b0ff9: Stop `solve` from crashing with `TypeError: A GitHub pull request URL requires owner, repo, and a positive integer number` when `--auto-continue` resumes an `issue-<n>-<hash>` branch that has no pull request yet. Continue mode has always had two shapes — resume an existing pull request, or reuse a leftover branch from an interrupted run (`prNumber: null`) — and since #2158 the "Your prepared Pull Request" URL was built from `prNumber` unconditionally, so the second shape aborted the run right after branch checkout, one step before `handleAutoPrCreation()` would have created the missing pull request. The URL is now built through a nullable `buildGitHubPullRequestUrlOrNull()` helper, the run logs that the pull request is still pending, and the strict builder reports the values it received so a bare stack trace is actionable. Full analysis in `docs/case-studies/issue-2170/`.
|
|
8
|
+
|
|
3
9
|
## 2.13.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -270,10 +270,40 @@ export function canonicalizeGitHubUrl(url) {
|
|
|
270
270
|
/** Build the canonical web URL for a pull request already identified by GitHub. */
|
|
271
271
|
export function buildGitHubPullRequestUrl({ owner, repo, number } = {}) {
|
|
272
272
|
if (!owner || !repo || !Number.isInteger(Number(number)) || Number(number) <= 0) {
|
|
273
|
-
|
|
273
|
+
// Issue #2170: the bare message left no way to tell which of the three
|
|
274
|
+
// parts was missing from a stack trace alone, so name the received values.
|
|
275
|
+
throw new TypeError(`A GitHub pull request URL requires owner, repo, and a positive integer number (received owner=${describeUrlPart(owner)}, repo=${describeUrlPart(repo)}, number=${describeUrlPart(number)})`);
|
|
274
276
|
}
|
|
275
277
|
return `https://github.com/${owner}/${repo}/pull/${Number(number)}`;
|
|
276
278
|
}
|
|
279
|
+
|
|
280
|
+
/** Render a value for the diagnostic above without hiding null/undefined/''. */
|
|
281
|
+
function describeUrlPart(value) {
|
|
282
|
+
if (value === null) return 'null';
|
|
283
|
+
if (value === undefined) return 'undefined';
|
|
284
|
+
if (typeof value === 'string') return JSON.stringify(value);
|
|
285
|
+
return String(value);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Build a pull request URL when the pull request is already identified, and
|
|
290
|
+
* return `null` when it is not (for example, `--auto-continue` resumed a
|
|
291
|
+
* leftover branch whose pull request has not been created yet).
|
|
292
|
+
*
|
|
293
|
+
* Callers that legitimately run before a pull request exists must use this
|
|
294
|
+
* instead of `buildGitHubPullRequestUrl`, whose throw aborts the whole run.
|
|
295
|
+
*
|
|
296
|
+
* @see https://github.com/link-assistant/hive-mind/issues/2170
|
|
297
|
+
* @param {{owner?: string, repo?: string, number?: number|string|null}} [params]
|
|
298
|
+
* @returns {string|null}
|
|
299
|
+
*/
|
|
300
|
+
export function buildGitHubPullRequestUrlOrNull(params = {}) {
|
|
301
|
+
try {
|
|
302
|
+
return buildGitHubPullRequestUrl(params);
|
|
303
|
+
} catch {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
277
307
|
/**
|
|
278
308
|
* Check if a URL is a valid GitHub URL of a specific type
|
|
279
309
|
* @param {string} url - The URL to check
|
package/src/github.lib.mjs
CHANGED
|
@@ -20,8 +20,8 @@ export { buildCostInfoString };
|
|
|
20
20
|
// #1756: route gh exec calls through transient + rate-limit retry wrapper
|
|
21
21
|
import { execGhWithRetry } from './github-rate-limit.lib.mjs';
|
|
22
22
|
import { QUIET_PROBE } from './quiet-probe.lib.mjs'; // issues #2130, #2135: keep read-only probe payloads out of the attached log
|
|
23
|
-
import { buildGitHubPullRequestUrl, isGitHubUrlType, normalizeGitHubUrl, parseGitHubUrl } from './github-url-parser.lib.mjs';
|
|
24
|
-
export { buildGitHubPullRequestUrl, isGitHubUrlType, normalizeGitHubUrl, parseGitHubUrl };
|
|
23
|
+
import { buildGitHubPullRequestUrl, buildGitHubPullRequestUrlOrNull, isGitHubUrlType, normalizeGitHubUrl, parseGitHubUrl } from './github-url-parser.lib.mjs';
|
|
24
|
+
export { buildGitHubPullRequestUrl, buildGitHubPullRequestUrlOrNull, isGitHubUrlType, normalizeGitHubUrl, parseGitHubUrl };
|
|
25
25
|
// Issue #1625: Named marker constants (single source of truth) + in-memory tracking for tool-posted comments. See tool-comments.lib.mjs for design.
|
|
26
26
|
import { SOLUTION_DRAFT_LOG_MARKER, SOLUTION_DRAFT_FAILED_MARKER, SOLUTION_DRAFT_FINISHED_WITH_ERRORS_MARKER, USAGE_LIMIT_REACHED_MARKER, NOW_WORKING_SESSION_IS_ENDED_MARKER, postTrackedComment, postTrackedCommentFromFile } from './tool-comments.lib.mjs';
|
|
27
27
|
export const maskGitHubToken = maskToken; // Alias for backward compatibility
|
|
@@ -1171,6 +1171,7 @@ export default {
|
|
|
1171
1171
|
isRateLimitError,
|
|
1172
1172
|
batchCheckPullRequestsForIssues,
|
|
1173
1173
|
buildGitHubPullRequestUrl,
|
|
1174
|
+
buildGitHubPullRequestUrlOrNull,
|
|
1174
1175
|
parseGitHubUrl,
|
|
1175
1176
|
normalizeGitHubUrl,
|
|
1176
1177
|
isGitHubUrlType,
|
package/src/solve.mjs
CHANGED
|
@@ -553,8 +553,18 @@ try {
|
|
|
553
553
|
// Issue #2158: auto-continue can discover a PR while the input remains an
|
|
554
554
|
// issue URL. Passing that issue URL as "Your prepared Pull Request" sent
|
|
555
555
|
// the first Formal AI attempt to the wrong GitHub entity.
|
|
556
|
-
|
|
557
|
-
//
|
|
556
|
+
//
|
|
557
|
+
// Issue #2170: continue mode does not imply a PR exists. --auto-continue
|
|
558
|
+
// also resumes a leftover `issue-<n>-<hash>` branch that never got a PR,
|
|
559
|
+
// and then prNumber is null. Building the URL unconditionally threw
|
|
560
|
+
// "A GitHub pull request URL requires owner, repo, and a positive integer
|
|
561
|
+
// number" and killed the run right after checkout. The PR is created a few
|
|
562
|
+
// lines below by handleAutoPrCreation, which sets both prUrl and prNumber.
|
|
563
|
+
prUrl = githubLib.buildGitHubPullRequestUrlOrNull({ owner, repo, number: prNumber });
|
|
564
|
+
if (!prUrl) {
|
|
565
|
+
await log(formatAligned('ℹ️', 'Continue mode:', 'Resuming an existing branch that has no pull request yet'));
|
|
566
|
+
await log(formatAligned('', 'Pull request:', 'Will be created before the tool session starts', 2));
|
|
567
|
+
}
|
|
558
568
|
}
|
|
559
569
|
// Handle auto PR creation using the new module
|
|
560
570
|
const autoPrResult = await handleAutoPrCreation({
|