@yemi33/minions 0.1.2358 → 0.1.2360

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/engine/github.js CHANGED
@@ -1161,7 +1161,7 @@ async function pollPrStatus(config) {
1161
1161
  try {
1162
1162
  const mergeMethod = ['squash', 'merge', 'rebase'].includes(config.engine?.prMergeMethod) ? config.engine.prMergeMethod : 'squash';
1163
1163
  // P-a7c4d2e8 (F1): argv-form merge call — eliminates shell interpolation of slug/prNum/mergeMethod.
1164
- await shared.shellSafeGh(['pr', 'merge', String(prNum), `--${mergeMethod}`, '--repo', shared.validateGhSlug(slug), '--delete-branch'], { timeout: 30000, maxBuffer: GH_MAX_BUFFER });
1164
+ await shared.shellSafeGh(['pr', 'merge', String(prNum), `--${mergeMethod}`, '--repo', shared.validateGhSlug(slug), '--delete-branch', '--admin'], { timeout: 30000, maxBuffer: GH_MAX_BUFFER });
1165
1165
  pr._autoCompleted = true;
1166
1166
  log('info', `Auto-completed PR ${pr.id}: builds green + review approved → merged (${mergeMethod})`);
1167
1167
  updated = true;
package/engine.js CHANGED
@@ -1023,22 +1023,44 @@ async function runWorktreeAdd(rootDir, worktreePath, addArgs, gitOpts, worktreeC
1023
1023
  // origin/<mainRef>; the stale-HEAD guard at the top of spawn-agent then
1024
1024
  // trips on every dispatch and the cooldown machinery starves the PR.
1025
1025
  //
1026
- // Returns true only on a confirmed advertised head; ls-remote exit code 2
1027
- // (no matching ref) and any other failure (network/auth) return false so
1028
- // the caller falls back to the existing `-b origin/<mainRef>` path.
1026
+ // Returns true only on a confirmed advertised head. ls-remote exit code 2
1027
+ // (no matching ref a clean, authoritative "branch does not exist upstream")
1028
+ // returns false so the caller falls back to the `-b origin/<mainRef>` path.
1029
+ //
1030
+ // Any OTHER failure (network blip, transient auth/401, ADO throttle, timeout)
1031
+ // is NOT a confirmed absence — conflating the two caused #767: a transient
1032
+ // probe failure against a branch that genuinely exists on origin (e.g. a
1033
+ // PR-author's real branch) silently took the fresh-branch fallback and
1034
+ // forked a divergent local branch under the same name instead of retrying.
1035
+ // We retry once with a short backoff (mirroring `_fetchWithTransientRetry`);
1036
+ // if the retry still doesn't cleanly resolve to "not found", we throw so the
1037
+ // caller does NOT treat this as a confirmed absence.
1029
1038
  async function probeBranchOnRemote(rootDir, branchName, gitOpts) {
1030
1039
  if (!branchName || !rootDir) return false;
1040
+ const _attemptProbe = () => shared.shellSafeGit(
1041
+ ['ls-remote', '--exit-code', '--heads', 'origin', branchName],
1042
+ { ...gitOpts, cwd: rootDir, timeout: 10000 },
1043
+ );
1031
1044
  try {
1032
- await shared.shellSafeGit(
1033
- ['ls-remote', '--exit-code', '--heads', 'origin', branchName],
1034
- { ...gitOpts, cwd: rootDir, timeout: 10000 },
1035
- );
1045
+ await _attemptProbe();
1036
1046
  return true;
1037
1047
  } catch (e) {
1038
- if (e && e.code !== 2) {
1039
- log('warn', `probeBranchOnRemote: ls-remote --heads origin ${branchName} failed: ${(e.message || '').split('\n')[0].slice(0, 200)} — treating as not-on-remote`);
1048
+ if (e && e.code === 2) return false; // clean, authoritative "not found"
1049
+ const firstErrMsg = adoGitAuth.redactBearer(String(e?.message || e)).split('\n')[0].slice(0, 200);
1050
+ log('warn', `probeBranchOnRemote: ls-remote --heads origin ${branchName} failed (${firstErrMsg}) — retrying once after 1.5s before giving up`);
1051
+ await new Promise(r => setTimeout(r, 1500));
1052
+ try {
1053
+ await _attemptProbe();
1054
+ return true;
1055
+ } catch (e2) {
1056
+ if (e2 && e2.code === 2) return false; // clean, authoritative "not found" on retry
1057
+ const retryErrMsg = adoGitAuth.redactBearer(String(e2?.message || e2)).split('\n')[0].slice(0, 200);
1058
+ log('warn', `probeBranchOnRemote: ls-remote --heads origin ${branchName} retry also failed (${retryErrMsg}) — cannot confirm branch absence, surfacing error`);
1059
+ const probeErr = new Error(`probeBranchOnRemote: could not determine whether origin has ${branchName} after retry: ${retryErrMsg}`);
1060
+ probeErr._probeFailed = true;
1061
+ probeErr._cause = e2;
1062
+ throw probeErr;
1040
1063
  }
1041
- return false;
1042
1064
  }
1043
1065
  }
1044
1066
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2358",
3
+ "version": "0.1.2360",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"