diff --git a/e2e/release/src/version-plans.test.ts b/e2e/release/src/version-plans.test.ts index 4e02d2d885..f815d81252 100644 --- a/e2e/release/src/version-plans.test.ts +++ b/e2e/release/src/version-plans.test.ts @@ -1,4 +1,4 @@ -import { NxJsonConfiguration } from '@nx/devkit'; +import { NxJsonConfiguration, readJsonFile, workspaceRoot } from '@nx/devkit'; import { cleanupProject, exists, @@ -459,7 +459,11 @@ Update the independent packages with a patch, preminor, and prerelease. expect(exists(join(versionPlansDir, 'bump-fixed.md'))).toBe(true); expect(exists(join(versionPlansDir, 'bump-independent.md'))).toBe(true); - packageInstall('yargs', null, 'latest', 'dev'); + // Reference the same version of yargs as nx uses to avoid compatibility issues + const nxPackageJson = readJsonFile( + join(workspaceRoot, 'packages/nx/package.json') + ); + packageInstall('yargs', null, nxPackageJson.dependencies.yargs, 'dev'); await writeFile( tmpProjPath('release.js'), diff --git a/packages/nx/src/tasks-runner/run-command.ts b/packages/nx/src/tasks-runner/run-command.ts index 6cbbe250df..5b5a487e19 100644 --- a/packages/nx/src/tasks-runner/run-command.ts +++ b/packages/nx/src/tasks-runner/run-command.ts @@ -1154,6 +1154,18 @@ function getTasksRunnerPath( runner: string, nxJson: NxJsonConfiguration ) { + // If running inside of Codex, there will be no internet access, so we cannot use the cloud runner, regardless of other config. + // We can infer this scenario by checking for certain environment variables defined in their base image: https://github.com/openai/codex-universal + if (process.env.CODEX_ENV_NODE_VERSION) { + output.warn({ + title: 'Codex environment detected, using default tasks runner', + bodyLines: [ + 'Codex does not have internet access when it runs tasks, so Nx will use the default tasks runner and only leverage local caching.', + ], + }); + return defaultTasksRunnerPath; + } + const isCloudRunner = // No tasksRunnerOptions for given --runner nxJson.nxCloudAccessToken ||