@link-assistant/hive-mind 1.56.0 → 1.56.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,23 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.56.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 32035a2: Issue #1651: When fork-parent auto-recovery tries to delete the mismatched
8
+ fork and the GitHub CLI token is missing the `delete_repo` scope, `solve`
9
+ now prints the real remediation (`gh auth refresh -h github.com -s delete_repo`)
10
+ plus a non-destructive alternative (rename/archive + `--prefix-fork-name-with-owner-name`)
11
+ instead of re-recommending the same `gh repo delete` command that just failed.
12
+ In `--verbose` mode the full `gh` output is also printed so future root-cause
13
+ analyses have the diagnostic lines GitHub already provides.
14
+
15
+ Pre-PR failures that are posted back to GitHub issues now use user-facing
16
+ guidance: they ask the issue reporter to fix repository/account state when
17
+ possible or ask a Hive Mind administrator to handle the affected repository,
18
+ while keeping administrator CLI details in the terminal log instead of the
19
+ public issue comment.
20
+
3
21
  ## 1.56.0
4
22
 
5
23
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.56.0",
3
+ "version": "1.56.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",
@@ -21,6 +21,18 @@ export { buildCostInfoString };
21
21
  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';
22
22
  export const maskGitHubToken = maskToken; // Alias for backward compatibility
23
23
  export const escapeCodeBlocksInLog = logContent => logContent.replace(/```/g, '\\`\\`\\`'); // Escape ``` in logs
24
+ const buildIssueFailureActionSection = targetType => {
25
+ if (targetType !== 'issue') return '';
26
+
27
+ return `
28
+
29
+ ### What you can do
30
+ - Resolve the repository, account, permissions, or environment problem described above, then rerun the solver.
31
+ - If this requires elevated Hive Mind access, ask a Hive Mind administrator to handle the specific failure described above.
32
+ - Repository deletion can require a separate GitHub account or token with repository deletion permission; Hive Mind does not rely on that permission by default.
33
+
34
+ Administrator-only CLI details, if any, are printed in the solver terminal log rather than in this issue comment.`;
35
+ };
24
36
  export const checkFileInBranch = async (owner, repo, fileName, branchName) => {
25
37
  const { $ } = await use('command-stream');
26
38
 
@@ -486,7 +498,7 @@ ${footerNote}`;
486
498
  The automated solution draft encountered an error:
487
499
  \`\`\`
488
500
  ${errorMessage}
489
- \`\`\`${modelInfoString}
501
+ \`\`\`${buildIssueFailureActionSection(targetType)}${modelInfoString}
490
502
 
491
503
  <details>
492
504
  <summary>Click to expand failure log (${Math.round(logStats.size / 1024)}KB)</summary>
@@ -675,7 +687,7 @@ ${uploadFooterNote}`;
675
687
  The automated solution draft encountered an error:
676
688
  \`\`\`
677
689
  ${errorMessage}
678
- \`\`\`${modelInfoString}
690
+ \`\`\`${buildIssueFailureActionSection(targetType)}${modelInfoString}
679
691
 
680
692
  ### 📎 **Failure log uploaded as ${uploadTypeLabel}${chunkInfo}** (${Math.round(logStats.size / 1024)}KB)
681
693
  - [View complete failure log](${logUrl})
@@ -8,6 +8,26 @@ const truncate = (value, maxLength = 2000) => {
8
8
 
9
9
  const fence = value => truncate(value || 'Unknown error').replaceAll('```', '` ` `');
10
10
 
11
+ export function buildPrePullRequestFailureActionSection(reason = '') {
12
+ const normalizedReason = String(reason || '').toLowerCase();
13
+ const isForkOrRecoveryFailure = normalizedReason.includes('fork') || normalizedReason.includes('auto-recovery') || normalizedReason.includes('repository setup');
14
+
15
+ if (isForkOrRecoveryFailure) {
16
+ return `### What you can do
17
+ - If the affected fork or repository belongs to you, remove, rename, archive, initialize, or otherwise repair it in GitHub, then rerun the solver.
18
+ - If the action requires elevated Hive Mind access, ask a Hive Mind administrator to handle the affected fork or repository and rerun the solver.
19
+ - Repository deletion can require a separate GitHub account or token with repository deletion permission; Hive Mind does not rely on that permission by default.
20
+
21
+ Administrator-only CLI details, if any, are printed in the solver terminal log rather than in this issue comment.`;
22
+ }
23
+
24
+ return `### What you can do
25
+ - Resolve the repository, account, permissions, or environment problem described above, then rerun the solver.
26
+ - If this requires elevated Hive Mind access, ask a Hive Mind administrator to handle the specific failure described above.
27
+
28
+ Administrator-only CLI details, if any, are printed in the solver terminal log rather than in this issue comment.`;
29
+ }
30
+
11
31
  export function shouldNotifyIssueAboutPrePullRequestFailure({ code, globalState }) {
12
32
  if (code === 0) return false;
13
33
  if (!globalState?.issueNumber || !globalState?.owner || !globalState?.repo) return false;
@@ -16,18 +36,11 @@ export function shouldNotifyIssueAboutPrePullRequestFailure({ code, globalState
16
36
  return getTrackedToolCommentIds().size === 0;
17
37
  }
18
38
 
19
- export function buildPrePullRequestFailureComment({ reason, owner, repo, issueNumber, argv = {}, rawCommand = null, logAttachmentAttempted = false }) {
39
+ export function buildPrePullRequestFailureComment({ reason, owner, repo, issueNumber, argv = {}, logAttachmentAttempted = false }) {
20
40
  const tool = argv.tool || 'claude';
21
41
  const modelLine = argv.model ? `\n- **Requested model**: \`${argv.model}\`` : '';
22
- const commandBlock = rawCommand
23
- ? `
24
-
25
- ### Command
26
- \`\`\`bash
27
- ${fence(rawCommand)}
28
- \`\`\``
29
- : '';
30
42
  const logLine = logAttachmentAttempted ? 'Log attachment was attempted but failed. Check the solver terminal log for the complete failure output.' : 'Logs were not attached because `--attach-logs` was not enabled.';
43
+ const actionSection = buildPrePullRequestFailureActionSection(reason);
31
44
 
32
45
  return `## 🚨 ${SOLUTION_DRAFT_FAILED_MARKER}
33
46
 
@@ -41,11 +54,12 @@ The automated solver stopped before creating a pull request, so no PR was opened
41
54
  **Reason**
42
55
  \`\`\`text
43
56
  ${fence(reason)}
44
- \`\`\`${commandBlock}
57
+ \`\`\`
45
58
 
46
- ${logLine}
59
+ ${actionSection}
47
60
 
48
- Please resolve the reported problem and rerun the solve command.`;
61
+ ${logLine}
62
+ `;
49
63
  }
50
64
 
51
65
  export async function notifyIssueAboutPrePullRequestFailure(options) {
@@ -553,8 +553,9 @@ export const setupRepository = async (argv, owner, repo, forkOwner = null, issue
553
553
  if (deleteResult.code !== 0) {
554
554
  const delOut = (deleteResult.stderr?.toString() || '') + (deleteResult.stdout?.toString() || '');
555
555
  await log(`${formatAligned('❌', 'Delete failed:', delOut.split('\n')[0])}`, { level: 'error' });
556
- await log(` 💡 Manual fix: gh repo delete ${existingForkName} --yes, then re-run`);
557
- await safeExit(1, 'Auto-recovery failed - could not delete problematic repository');
556
+ await log(/delete_repo/i.test(delOut) || (/HTTP 403/.test(delOut) && /admin rights/i.test(delOut)) ? ` 💡 Token missing "delete_repo" scope. Hive Mind does not request it by default. Admin fix: gh auth refresh -h github.com -s delete_repo\n 🔧 Or no-scope alternative: gh repo rename ${existingForkName} ${existingForkName.split('/')[1]}-old (or gh repo archive ${existingForkName} --yes), then re-run with --prefix-fork-name-with-owner-name` : ` 💡 Manual fix: gh repo delete ${existingForkName} --yes, then re-run`); // Issue #1651
557
+ if (argv.verbose) await log(`${formatAligned('🔧', 'Full delete output:', delOut.trim())}`);
558
+ await safeExit(1, `Auto-recovery failed - ask the fork owner or Hive Mind administrator to delete, rename, or archive ${existingForkName}`);
558
559
  }
559
560
  await log(`${formatAligned('✅', 'Deleted:', existingForkName)}`);
560
561
  existingForkName = null; // Fall through to fork creation below