@h-rig/runtime 0.0.6-alpha.11 → 0.0.6-alpha.13
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/dist/bin/rig-agent-dispatch.js +5 -313
- package/dist/bin/rig-agent.js +3 -2
- package/dist/src/control-plane/agent-wrapper.js +10 -15
- package/dist/src/control-plane/harness-main.js +914 -153
- package/dist/src/control-plane/hooks/completion-verification.js +1182 -281
- package/dist/src/control-plane/native/git-ops.js +31 -43
- package/dist/src/control-plane/native/harness-cli.js +914 -153
- package/dist/src/control-plane/native/pr-automation.js +1008 -38
- package/dist/src/control-plane/native/pr-review-gate.js +905 -0
- package/dist/src/control-plane/native/task-ops.js +909 -151
- package/dist/src/control-plane/native/verifier.js +911 -150
- package/native/darwin-arm64/rig-git +0 -0
- package/native/darwin-arm64/rig-git.build-manifest.json +1 -1
- package/native/darwin-arm64/rig-shell +0 -0
- package/native/darwin-arm64/rig-shell.build-manifest.json +1 -1
- package/native/darwin-arm64/rig-tools +0 -0
- package/native/darwin-arm64/rig-tools.build-manifest.json +1 -1
- package/native/darwin-arm64/runtime-native.dylib +0 -0
- package/package.json +6 -6
|
@@ -1939,8 +1939,9 @@ function defaultPrCloseoutLine(taskId, repoNameWithOwner) {
|
|
|
1939
1939
|
const sourceIssueId = loadRuntimeContextFromEnv()?.sourceTask?.sourceIssueId;
|
|
1940
1940
|
if (sourceIssueId) {
|
|
1941
1941
|
const match = sourceIssueId.match(/^([^#]+)#(\d+)$/);
|
|
1942
|
-
if (match) {
|
|
1943
|
-
const
|
|
1942
|
+
if (match?.[1] && match[2]) {
|
|
1943
|
+
const sourceRepo = match[1];
|
|
1944
|
+
const issueNumber = match[2];
|
|
1944
1945
|
return sourceRepo.toLowerCase() === repoNameWithOwner.toLowerCase() ? `Closes #${issueNumber}` : `Closes ${sourceRepo}#${issueNumber}`;
|
|
1945
1946
|
}
|
|
1946
1947
|
}
|
|
@@ -2035,56 +2036,43 @@ function gitMergePr(options) {
|
|
|
2035
2036
|
if (isDraft) {
|
|
2036
2037
|
throw new Error(`Cannot auto-merge draft PR ${options.pr.url}.`);
|
|
2037
2038
|
}
|
|
2039
|
+
const strictGateHeadSha = options.strictGateHeadSha?.trim();
|
|
2040
|
+
if (!strictGateHeadSha) {
|
|
2041
|
+
throw new Error(`Refusing to merge PR ${options.pr.url}: strict merge gate did not provide a current head SHA.`);
|
|
2042
|
+
}
|
|
2038
2043
|
const mergeArgs = withGhRepo([gh, "pr", "merge", options.pr.url], repoNameWithOwner);
|
|
2039
2044
|
const method = options.method || "squash";
|
|
2040
2045
|
mergeArgs.push(method === "merge" ? "--merge" : method === "rebase" ? "--rebase" : "--squash");
|
|
2046
|
+
mergeArgs.push("--match-head-commit", strictGateHeadSha);
|
|
2041
2047
|
if (options.deleteBranch !== false) {
|
|
2042
2048
|
mergeArgs.push("--delete-branch");
|
|
2043
2049
|
}
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
}
|
|
2058
|
-
adminMergeArgs.push("--admin");
|
|
2059
|
-
const adminMerge = runCapture2(adminMergeArgs, repoRoot);
|
|
2060
|
-
if (adminMerge.exitCode === 0) {
|
|
2061
|
-
const postAdminMergeState = readPrViewState(gh, repoRoot, repoNameWithOwner, options.pr.url);
|
|
2062
|
-
if (postAdminMergeState.state === "MERGED" || postAdminMergeState.mergedAt) {
|
|
2063
|
-
console.log(`Merged PR (${options.pr.repoLabel}) with admin fallback: ${options.pr.url}`);
|
|
2064
|
-
return { status: "merged", url: options.pr.url };
|
|
2065
|
-
}
|
|
2066
|
-
throw new Error(`Admin merge command succeeded for PR ${options.pr.url} in ${options.pr.repoLabel}, but GitHub still reports it open.`);
|
|
2067
|
-
}
|
|
2068
|
-
const adminMergeMessage = `${adminMerge.stderr}
|
|
2069
|
-
${adminMerge.stdout}`.trim();
|
|
2070
|
-
if (!/admin|administrator|permission|not permitted|not allowed/i.test(adminMergeMessage)) {
|
|
2071
|
-
throw new Error(`Failed to admin-merge PR ${options.pr.url} in ${options.pr.repoLabel}: ${adminMergeMessage}`);
|
|
2072
|
-
}
|
|
2050
|
+
const directMerge = runCapture2(mergeArgs, repoRoot);
|
|
2051
|
+
if (directMerge.exitCode === 0) {
|
|
2052
|
+
console.log(`Merged PR (${options.pr.repoLabel}): ${options.pr.url}`);
|
|
2053
|
+
return { status: "merged", url: options.pr.url };
|
|
2054
|
+
}
|
|
2055
|
+
const postDirectState = readPrViewState(gh, repoRoot, repoNameWithOwner, options.pr.url);
|
|
2056
|
+
if (canAdminMergeApprovedPr(postDirectState)) {
|
|
2057
|
+
const adminMergeArgs = [...mergeArgs, "--admin"];
|
|
2058
|
+
const adminMerge = runCapture2(adminMergeArgs, repoRoot);
|
|
2059
|
+
if (adminMerge.exitCode === 0) {
|
|
2060
|
+
const postAdminMergeState = readPrViewState(gh, repoRoot, repoNameWithOwner, options.pr.url);
|
|
2061
|
+
if (postAdminMergeState.state === "MERGED" || postAdminMergeState.mergedAt) {
|
|
2062
|
+
console.log(`Merged PR (${options.pr.repoLabel}) with admin fallback: ${options.pr.url}`);
|
|
2063
|
+
return { status: "merged", url: options.pr.url };
|
|
2073
2064
|
}
|
|
2074
|
-
|
|
2075
|
-
|
|
2065
|
+
throw new Error(`Admin merge command succeeded for PR ${options.pr.url} in ${options.pr.repoLabel}, but GitHub still reports it open.`);
|
|
2066
|
+
}
|
|
2067
|
+
const adminMergeMessage = `${adminMerge.stderr}
|
|
2068
|
+
${adminMerge.stdout}`.trim();
|
|
2069
|
+
if (!/admin|administrator|permission|not permitted|not allowed/i.test(adminMergeMessage)) {
|
|
2070
|
+
throw new Error(`Failed to admin-merge PR ${options.pr.url} in ${options.pr.repoLabel}: ${adminMergeMessage}`);
|
|
2076
2071
|
}
|
|
2077
|
-
throw new Error(`Auto-merge command succeeded for PR ${options.pr.url} in ${options.pr.repoLabel}, but GitHub did not report a merged or auto-merge-enabled state.`);
|
|
2078
|
-
}
|
|
2079
|
-
const autoMergeMessage = `${autoMerge.stderr}
|
|
2080
|
-
${autoMerge.stdout}`.trim();
|
|
2081
|
-
const autoMergeUnsupported = /auto.?merge.*(not enabled|not allowed|disabled|unsupported)|enablePullRequestAutoMerge|Auto merge is not allowed/i.test(autoMergeMessage);
|
|
2082
|
-
if (!autoMergeUnsupported) {
|
|
2083
|
-
throw new Error(`Failed to auto-merge PR ${options.pr.url} in ${options.pr.repoLabel}: ${autoMergeMessage}`);
|
|
2084
2072
|
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2073
|
+
const directMergeMessage = `${directMerge.stderr}
|
|
2074
|
+
${directMerge.stdout}`.trim();
|
|
2075
|
+
throw new Error(`Failed to merge PR ${options.pr.url} in ${options.pr.repoLabel}: ${directMergeMessage}`);
|
|
2088
2076
|
}
|
|
2089
2077
|
function assertPrHasNoGitConflicts(prState, repoLabel, baseRef) {
|
|
2090
2078
|
const mergeable = prState.mergeable.toUpperCase();
|