@link-assistant/hive-mind 1.50.3 → 1.50.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.50.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 15f25db: Make merge queue cancel immediate during CI waits so users don't have to wait for CI to finish before cancellation takes effect
8
+
3
9
  ## 1.50.3
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.50.3",
3
+ "version": "1.50.4",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -29,7 +29,7 @@ const exec = promisify(execCallback);
29
29
  * @returns {Promise<{success: boolean, status: string, runs: Array, failedRuns: Array, error: string|null}>}
30
30
  */
31
31
  export async function waitForCommitCI(owner, repo, sha, options = {}, verbose = false) {
32
- const { timeout = 60 * 60 * 1000, pollInterval = 30 * 1000, onStatusUpdate = null } = options;
32
+ const { timeout = 60 * 60 * 1000, pollInterval = 30 * 1000, onStatusUpdate = null, isCancelled = null } = options;
33
33
 
34
34
  const startTime = Date.now();
35
35
  let noRunsIterations = 0;
@@ -40,6 +40,9 @@ export async function waitForCommitCI(owner, repo, sha, options = {}, verbose =
40
40
  }
41
41
 
42
42
  while (Date.now() - startTime < timeout) {
43
+ // Issue #1588: Check for cancellation before each poll to allow early exit
44
+ if (isCancelled?.()) return { success: false, status: 'cancelled', runs: [], failedRuns: [], error: 'Operation was cancelled' };
45
+
43
46
  let runs;
44
47
  try {
45
48
  runs = await getWorkflowRunsForSha(owner, repo, sha, verbose);
@@ -16,7 +16,6 @@ import { exec as execCallback } from 'child_process';
16
16
 
17
17
  const exec = promisify(execCallback);
18
18
 
19
- // Import GitHub URL parser
20
19
  import { parseGitHubUrl } from './github.lib.mjs';
21
20
 
22
21
  // Issue #1413: Import ready tag sync, timeline, and label constant from separate module
@@ -728,7 +727,7 @@ export async function getActiveBranchRuns(owner, repo, branch = 'main', verbose
728
727
  * @returns {Promise<{success: boolean, waitedForRuns: boolean, completedRuns: number, error: string|null}>}
729
728
  */
730
729
  export async function waitForBranchCI(owner, repo, branch = 'main', options = {}, verbose = false) {
731
- const { timeout = 45 * 60 * 1000, pollInterval = 30 * 1000, onStatusUpdate = null } = options;
730
+ const { timeout = 45 * 60 * 1000, pollInterval = 30 * 1000, onStatusUpdate = null, isCancelled = null } = options;
732
731
 
733
732
  const startTime = Date.now();
734
733
  let totalWaitedRuns = 0;
@@ -738,6 +737,7 @@ export async function waitForBranchCI(owner, repo, branch = 'main', options = {}
738
737
  }
739
738
 
740
739
  while (Date.now() - startTime < timeout) {
740
+ if (isCancelled?.()) return { success: false, waitedForRuns: totalWaitedRuns > 0, completedRuns: totalWaitedRuns, error: 'Operation was cancelled' };
741
741
  let activeRuns;
742
742
  try {
743
743
  activeRuns = await getActiveBranchRuns(owner, repo, branch, verbose);
@@ -238,11 +238,13 @@ export function registerMergeCommand(bot, options) {
238
238
  // Update message with progress and cancel button
239
239
  try {
240
240
  const message = processor.formatProgressMessage();
241
+ // Issue #1588: Do not show cancel button once cancellation has been requested.
242
+ // Without this check, progress updates from CI wait loops would re-add
243
+ // the cancel button after the cancel handler had already removed it.
244
+ const replyMarkup = processor.isCancelled ? undefined : { inline_keyboard: [[{ text: '🛑 Cancel', callback_data: `merge_cancel_${repoKey}` }]] };
241
245
  await ctx.telegram.editMessageText(statusMessage.chat.id, statusMessage.message_id, undefined, message, {
242
246
  parse_mode: 'MarkdownV2',
243
- reply_markup: {
244
- inline_keyboard: [[{ text: '🛑 Cancel', callback_data: `merge_cancel_${repoKey}` }]],
245
- },
247
+ ...(replyMarkup ? { reply_markup: replyMarkup } : {}),
246
248
  });
247
249
  } catch (err) {
248
250
  // Ignore message edit errors (e.g., message not modified)
@@ -513,6 +513,8 @@ export class MergeQueueProcessor {
513
513
  await this.onProgress(this.getProgressUpdate());
514
514
  }
515
515
  },
516
+ // Issue #1588: Pass cancellation check so branch CI wait can abort early
517
+ isCancelled: () => this.isCancelled,
516
518
  },
517
519
  this.verbose
518
520
  );
@@ -617,6 +619,8 @@ export class MergeQueueProcessor {
617
619
  await this.onProgress(this.getProgressUpdate());
618
620
  }
619
621
  },
622
+ // Issue #1588: Pass cancellation check so post-merge CI wait can abort early
623
+ isCancelled: () => this.isCancelled,
620
624
  },
621
625
  this.verbose
622
626
  );