opencode-magi 0.0.0-dev-20260522142016 → 0.0.0-dev-20260522144259

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.
@@ -403,6 +403,7 @@ function extractQuestionRequest(properties) {
403
403
  export class MagiRunManager {
404
404
  input;
405
405
  active = new Map();
406
+ activePrRuns = 0;
406
407
  activeTriageRuns = 0;
407
408
  countedToolParts = new Map();
408
409
  controllers = new Map();
@@ -411,6 +412,7 @@ export class MagiRunManager {
411
412
  runPaths = new Map();
412
413
  outputDirs = new Set();
413
414
  sessionToRun = new Map();
415
+ prQueue = [];
414
416
  triageQueue = [];
415
417
  constructor(input) {
416
418
  this.input = input;
@@ -462,9 +464,12 @@ export class MagiRunManager {
462
464
  });
463
465
  if (input.sync)
464
466
  return this.executeSync(state, controller, execute, input.timeoutMs);
465
- void execute().catch(async (error) => {
466
- await this.failRun(runId, error);
467
+ this.prQueue.push({
468
+ execute,
469
+ repository: input.repository,
470
+ runId,
467
471
  });
472
+ this.drainPrQueue();
468
473
  return state;
469
474
  }
470
475
  async startMerge(input) {
@@ -523,9 +528,12 @@ export class MagiRunManager {
523
528
  });
524
529
  if (input.sync)
525
530
  return this.executeSync(state, controller, execute, input.timeoutMs);
526
- void execute().catch(async (error) => {
527
- await this.failRun(runId, error);
531
+ this.prQueue.push({
532
+ execute,
533
+ repository: input.repository,
534
+ runId,
528
535
  });
536
+ this.drainPrQueue();
529
537
  return state;
530
538
  }
531
539
  async startTriage(input) {
@@ -591,6 +599,29 @@ export class MagiRunManager {
591
599
  this.drainTriageQueue();
592
600
  return state;
593
601
  }
602
+ drainPrQueue() {
603
+ while (this.prQueue.length) {
604
+ const next = this.prQueue[0];
605
+ if (!next)
606
+ return;
607
+ if (this.activePrRuns >= next.repository.concurrency.runs)
608
+ return;
609
+ this.prQueue.shift();
610
+ const state = this.active.get(next.runId);
611
+ if (!state || state.status === "cancelled")
612
+ continue;
613
+ this.activePrRuns += 1;
614
+ void next
615
+ .execute()
616
+ .catch(async (error) => {
617
+ await this.failRun(next.runId, error);
618
+ })
619
+ .finally(() => {
620
+ this.activePrRuns -= 1;
621
+ this.drainPrQueue();
622
+ });
623
+ }
624
+ }
594
625
  drainTriageQueue() {
595
626
  while (this.triageQueue.length) {
596
627
  const next = this.triageQueue[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magi",
3
- "version": "0.0.0-dev-20260522142016",
3
+ "version": "0.0.0-dev-20260522144259",
4
4
  "description": "Multi-agent PR review and merge orchestration plugin for OpenCode.",
5
5
  "license": "MIT",
6
6
  "author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",