Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Entries record changes when they were made, including superseded decisions.
See [ARCHITECTURE.md](ARCHITECTURE.md) for current direction and
[README.md](README.md) for current capabilities.

## Unreleased

- **A `claude-multi` started inside another Multi session uses its own gateway.** Run
from an agent's shell or a Remote Control shell, the new session's gateway inherited
the outer session's proxy setting and sent its OpenAI and other provider traffic
through the outer, possibly older, gateway. The launch now starts from the user's own
environment, as a nested `claude` already did.

## 0.4.3 — 2026-11-27

Multi's own safety reviewer is removed; it drained the Codex quota.
Expand Down
18 changes: 12 additions & 6 deletions plugins/multi-core/src/install/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,26 @@ import {
} from './process.ts';

async function dispatch(state: Installation, args: string[], management: boolean) {
const { root, providers } = await installedPlugins(state.claude, settingsArguments(args));
// A run from inside another Multi session (an agent's or Remote Control's shell) starts
// from the user's own environment. Otherwise its Claude calls and a new gateway would
// inherit the outer session's HTTPS_PROXY and go through the outer gateway.
const own = withoutGateway(process.env);
const { root, providers } = await installedPlugins(state.claude, settingsArguments(args), {
env: own,
});
if (management && args[0] === 'status') {
console.log(JSON.stringify({ core: root ?? null, providers, claude: state.claude }, null, 2));
return 0;
}
if (!management && (!root || providers.length === 0)) {
return run(state.claude, args, { env: withoutGateway(process.env) });
return run(state.claude, args, { env: own });
}
if (!management && state.command === 'claude' && process.env.MULTI_GATEWAY_TOKEN) {
// A launch command named `claude` also catches Claude's own nested runs (agents
// calling `claude -p`, SDK spawns, hooks). Inside a Multi session those must
// reach the real executable rather than start a second gateway, and without this
// session's gateway URL and credentials: that gateway is not theirs.
return run(state.claude, args, { env: withoutGateway(process.env) });
return run(state.claude, args, { env: own });
}
if (!root) {
throw new Error('Enable multi-core at user scope before using Multi commands.');
Expand All @@ -37,12 +43,12 @@ async function dispatch(state: Installation, args: string[], management: boolean
throw new Error('Installed core manifest does not identify multi-core');
}
const env = withLoopbackNoProxy({
...process.env,
...(state.models !== undefined && process.env.MULTI_MODELS === undefined
...own,
...(state.models !== undefined && own.MULTI_MODELS === undefined
? { MULTI_MODELS: state.models }
: {}),
// Node reads this at startup only, so the launcher process has to be started with it.
...(needsEnvProxy(process.env) ? { NODE_USE_ENV_PROXY: '1' } : {}),
...(needsEnvProxy(own) ? { NODE_USE_ENV_PROXY: '1' } : {}),
MULTI_REAL_CLAUDE: state.claude,
MULTI_ENABLED_PROVIDERS: providers.join(','),
MULTI_ANTIGRAVITY: providers.includes('antigravity') ? '1' : '0',
Expand Down
5 changes: 4 additions & 1 deletion plugins/multi-core/src/install/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ export function providerSelection(value: string | undefined): string[] | undefin
export async function installedPlugins(
claude: string,
settingsArgs: string[] = [],
options: { platform?: NodeJS.Platform } = {},
options: { platform?: NodeJS.Platform; env?: NodeJS.ProcessEnv } = {},
) {
const platform = options.platform ?? process.platform;
const env = options.env ?? process.env;
const invocation = executableInvocation(
claude,
[...settingsArgs, 'plugin', 'list', '--json'],
platform,
env,
);
const { stdout } = await promisify(execFile)(invocation.command, invocation.args, {
env,
timeout: 15000,
maxBuffer: 4 * 1024 * 1024,
encoding: 'utf8',
Expand Down
Loading