Skip to content

Commit 44b806f

Browse files
committed
fix(ci): remove isStaleCiRun to prevent ci pr hang on SSH host-key prompt
1 parent cdba458 commit 44b806f

1 file changed

Lines changed: 0 additions & 32 deletions

File tree

scopes/git/ci/ci.main.runtime.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -856,14 +856,6 @@ export class CiMain {
856856
return await this.exporter.export();
857857
} catch (e: any) {
858858
if (!isHashMismatchErr(e) || attempt === maxAttempts) throw e;
859-
if (await this.isStaleCiRun()) {
860-
this.logger.console(
861-
chalk.yellow(
862-
`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.`
863-
)
864-
);
865-
throw e;
866-
}
867859
this.logger.console(
868860
chalk.yellow(
869861
`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 {
889881
throw new Error(`exportWithRetryOnLaneHashMismatch: exhausted ${maxAttempts} attempts for lane ${laneIdStr}`);
890882
}
891883

892-
/**
893-
* Returns true when the PR branch on the remote has advanced past our local HEAD, meaning a
894-
* newer commit was pushed to the branch while this CI run was in flight. Best-effort: when we
895-
* can't determine the branch or reach the remote we return false (don't block retry).
896-
*/
897-
private async isStaleCiRun(): Promise<boolean> {
898-
try {
899-
const branch = await this.getBranchName();
900-
if (!branch) return false;
901-
const localSha = (await git.revparse(['HEAD'])).trim();
902-
// `--` separator and fully-qualified ref so a branch name starting with `-` can't be
903-
// interpreted as a git option (defense in depth for untrusted PR branches).
904-
await git.raw(['fetch', 'origin', '--', `refs/heads/${branch}:refs/remotes/origin/${branch}`]);
905-
const remoteSha = (await git.revparse([`refs/remotes/origin/${branch}`])).trim();
906-
if (remoteSha === localSha) return false;
907-
const mergeBase = (await git.raw(['merge-base', localSha, remoteSha])).trim();
908-
// local is strictly behind remote - remote has commits we don't.
909-
return mergeBase === localSha;
910-
} catch (err: any) {
911-
this.logger.console(chalk.yellow(`Unable to verify CI run freshness (assuming fresh): ${err?.message || err}`));
912-
return false;
913-
}
914-
}
915-
916884
/**
917885
* Archives (deletes) a lane with proper error handling and logging.
918886
* @param throwOnError - if true, throws on failure (use for critical operations like pre-export cleanup)

0 commit comments

Comments
 (0)