From 44b806f96208f187bf02ae88539db92caefc9ac7 Mon Sep 17 00:00:00 2001 From: David First Date: Wed, 15 Apr 2026 15:45:02 -0400 Subject: [PATCH] fix(ci): remove isStaleCiRun to prevent ci pr hang on SSH host-key prompt --- scopes/git/ci/ci.main.runtime.ts | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/scopes/git/ci/ci.main.runtime.ts b/scopes/git/ci/ci.main.runtime.ts index 83fd17af9c81..fa8a795ec75f 100644 --- a/scopes/git/ci/ci.main.runtime.ts +++ b/scopes/git/ci/ci.main.runtime.ts @@ -856,14 +856,6 @@ export class CiMain { return await this.exporter.export(); } catch (e: any) { if (!isHashMismatchErr(e) || attempt === maxAttempts) throw e; - if (await this.isStaleCiRun()) { - this.logger.console( - chalk.yellow( - `Export failed with lane hash mismatch on "${laneIdStr}" and the PR branch has advanced past our commit. Not retrying - a newer CI run will publish the correct lane.` - ) - ); - throw e; - } this.logger.console( chalk.yellow( `Export attempt ${attempt}/${maxAttempts} failed with lane hash mismatch on "${laneIdStr}" (likely a concurrent CI push). Deleting remote lane and retrying.` @@ -889,30 +881,6 @@ export class CiMain { throw new Error(`exportWithRetryOnLaneHashMismatch: exhausted ${maxAttempts} attempts for lane ${laneIdStr}`); } - /** - * Returns true when the PR branch on the remote has advanced past our local HEAD, meaning a - * newer commit was pushed to the branch while this CI run was in flight. Best-effort: when we - * can't determine the branch or reach the remote we return false (don't block retry). - */ - private async isStaleCiRun(): Promise { - try { - const branch = await this.getBranchName(); - if (!branch) return false; - const localSha = (await git.revparse(['HEAD'])).trim(); - // `--` separator and fully-qualified ref so a branch name starting with `-` can't be - // interpreted as a git option (defense in depth for untrusted PR branches). - await git.raw(['fetch', 'origin', '--', `refs/heads/${branch}:refs/remotes/origin/${branch}`]); - const remoteSha = (await git.revparse([`refs/remotes/origin/${branch}`])).trim(); - if (remoteSha === localSha) return false; - const mergeBase = (await git.raw(['merge-base', localSha, remoteSha])).trim(); - // local is strictly behind remote - remote has commits we don't. - return mergeBase === localSha; - } catch (err: any) { - this.logger.console(chalk.yellow(`Unable to verify CI run freshness (assuming fresh): ${err?.message || err}`)); - return false; - } - } - /** * Archives (deletes) a lane with proper error handling and logging. * @param throwOnError - if true, throws on failure (use for critical operations like pre-export cleanup)