Fix issue where an undefined variable was passed to the sandbox constructor (#9279)

This commit is contained in:
Jacob Richman
2025-09-23 17:06:31 -07:00
committed by GitHub
parent c6f8ecc227
commit ce92ed3f68
+15 -12
View File
@@ -255,8 +255,20 @@ export async function main() {
? getNodeMemoryArgs(isDebugMode) ? getNodeMemoryArgs(isDebugMode)
: []; : [];
const sandboxConfig = await loadSandboxConfig(settings.merged, argv); const sandboxConfig = await loadSandboxConfig(settings.merged, argv);
// We intentially omit the list of extensions here because extensions
// should not impact auth or setting up the sandbox.
// TODO(jacobr): refactor loadCliConfig so there is a minimal version
// that only initializes enough config to enable refreshAuth or find
// another way to decouple refreshAuth from requiring a config.
if (sandboxConfig) { if (sandboxConfig) {
const partialConfig = await loadCliConfig(
settings.merged,
[],
sessionId,
argv,
);
if ( if (
settings.merged.security?.auth?.selectedType && settings.merged.security?.auth?.selectedType &&
!settings.merged.security?.auth?.useExternal !settings.merged.security?.auth?.useExternal
@@ -269,17 +281,6 @@ export async function main() {
if (err) { if (err) {
throw new Error(err); throw new Error(err);
} }
// We intentially omit the list of extensions here because extensions
// should not impact auth.
// TODO(jacobr): refactor loadCliConfig so there is a minimal version
// that only initializes enough config to enable refreshAuth or find
// another way to decouple refreshAuth from requiring a config.
const partialConfig = await loadCliConfig(
settings.merged,
[],
sessionId,
argv,
);
await partialConfig.refreshAuth( await partialConfig.refreshAuth(
settings.merged.security.auth.selectedType, settings.merged.security.auth.selectedType,
@@ -320,7 +321,7 @@ export async function main() {
const sandboxArgs = injectStdinIntoArgs(process.argv, stdinData); const sandboxArgs = injectStdinIntoArgs(process.argv, stdinData);
await relaunchOnExitCode(() => await relaunchOnExitCode(() =>
start_sandbox(sandboxConfig, memoryArgs, config, sandboxArgs), start_sandbox(sandboxConfig, memoryArgs, partialConfig, sandboxArgs),
); );
process.exit(0); process.exit(0);
} else { } else {
@@ -333,6 +334,7 @@ export async function main() {
// We are now past the logic handling potentially launching a child process // We are now past the logic handling potentially launching a child process
// to run Gemini CLI. It is now safe to perform expensive initialization that // to run Gemini CLI. It is now safe to perform expensive initialization that
// may have side effects. // may have side effects.
{
const extensions = loadExtensions(); const extensions = loadExtensions();
const config = await loadCliConfig( const config = await loadCliConfig(
settings.merged, settings.merged,
@@ -447,6 +449,7 @@ export async function main() {
// Call cleanup before process.exit, which causes cleanup to not run // Call cleanup before process.exit, which causes cleanup to not run
await runExitCleanup(); await runExitCleanup();
process.exit(0); process.exit(0);
}
} }
function setWindowTitle(title: string, settings: LoadedSettings) { function setWindowTitle(title: string, settings: LoadedSettings) {