opencode-magi 0.0.0-dev-20260722234348 → 0.0.0-dev-20260723005332
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MagiError } from "@/magi";
|
|
2
2
|
import { Prompt } from "@/prompts";
|
|
3
|
-
import { command, filterEmpty, isArray, isObject, isString, loop, marker, omitNullish, quote, retry, wait, Worker, } from "@/utils";
|
|
3
|
+
import { command, filterEmpty, ignoreError, isArray, isObject, isString, loop, marker, omitNullish, quote, retry, wait, Worker, } from "@/utils";
|
|
4
4
|
const events = {
|
|
5
5
|
APPROVED: "APPROVE",
|
|
6
6
|
CHANGES_REQUESTED: "REQUEST_CHANGES",
|
|
@@ -233,7 +233,10 @@ export async function automate() {
|
|
|
233
233
|
const octokit = await this.magi.createOctokit(this.config, this.context.abort, account);
|
|
234
234
|
const graphql = this.magi.createGraphql(octokit);
|
|
235
235
|
const enqueuedAt = new Date().toISOString();
|
|
236
|
-
await graphql.enqueuePullRequest({ id: this.state.pr.metadata.node_id })
|
|
236
|
+
await ignoreError(() => graphql.enqueuePullRequest({ id: this.state.pr.metadata.node_id }), (e) => {
|
|
237
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
238
|
+
return /pull request is already in the queue/i.test(message);
|
|
239
|
+
});
|
|
237
240
|
await this.updateEvent(`Waiting for merge queue.`);
|
|
238
241
|
const result = await waitMergeQueue.call(this, enqueuedAt);
|
|
239
242
|
if (result === "CONFLICT")
|
|
@@ -388,8 +391,11 @@ async function waitMergeQueue(enqueuedAt, leftMergeQueue = false, retries = 0) {
|
|
|
388
391
|
const attempt = retries + 1;
|
|
389
392
|
const nextEnqueuedAt = new Date().toISOString();
|
|
390
393
|
await this.updateEvent(`Attempt ${attempt} failed to merge from the merge queue. Retrying...`);
|
|
391
|
-
await this.graphql.enqueuePullRequest({
|
|
394
|
+
await ignoreError(() => this.graphql.enqueuePullRequest({
|
|
392
395
|
id: this.state.pr.metadata.node_id,
|
|
396
|
+
}), (e) => {
|
|
397
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
398
|
+
return /pull request is already in the queue/i.test(message);
|
|
393
399
|
});
|
|
394
400
|
return await waitMergeQueue.call(this, nextEnqueuedAt, false, attempt);
|
|
395
401
|
}
|
package/dist/utils/function.js
CHANGED
|
@@ -12,6 +12,15 @@ export function wait(ms = 0, signal) {
|
|
|
12
12
|
signal?.addEventListener("abort", abort, { once: true });
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
export async function ignoreError(cb, shouldIgnore) {
|
|
16
|
+
try {
|
|
17
|
+
return await cb();
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
if (!shouldIgnore(e))
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
15
24
|
export async function loop(cb, ms = 0) {
|
|
16
25
|
for (;;) {
|
|
17
26
|
const value = await cb();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-magi",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260723005332",
|
|
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>",
|