✅ feat: Default Machine Selection and Linked-Worktree Lanes On (#16678)

* ✅ feat: Default Machine Selection and Linked-Worktree Lanes On

Per-chat machine choice from an agent's saved allowlist and linked-worktree
lane routing were both opt-in, so neither worked until a deployment found and
set its flag. Both are now on unless set to false: machine choice still only
applies to agents with a saved allowlist, and lanes still require a worker
that advertises git_linked_worktree. One helper per flag in data-provider
decides the default for every server reader and the advertised client config.

* feat: Advertise the Code Environment Decision Protocol by Default

Per-chat machine choice needs the conversation decision protocol, which the
client requires before offering allowlisted machines, but the protocol was
only advertised when CODE_ENVIRONMENT_DECISION_VERSION=1. With selection on
by default, authors could save an allowlist the composer never offered.
An unset or blank value now advertises protocol v1; any other value, such as
0, keeps the legacy-safe path.

* fix: Turn Machine Choice Off With the Decision Protocol Opt-Out

CODE_ENVIRONMENT_DECISION_VERSION=0 stopped advertising the protocol but
routing still accepted a non-default machine, so a cached tab or a direct
client could persist a choice during a mixed-version rollout. Machine choice
is recorded through that protocol, so isCodeEnvironmentSelectionEnabled now
requires both, for routing and for the advertised endpoints config. The
protocol resolver moves to code/protocol.ts (re-exported from code/config)
so execution and endpoints can use it without an import cycle.

* style: Format checkout routing regression cases

---------

Co-authored-by: Lia <lia@librechat.ai>
This commit is contained in:
Danny Avila 2026-10-02 20:08:35 -04:00 • committed by GitHub
parent 2d35614a0c
commit 1a8d23e1ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 218 additions and 71 deletions

View file

@ -736,9 +736,11 @@ TTS_API_KEY=
# LIBRECHAT_CODE_API_KEY=
# Advertise the immutable per-conversation code-environment decision protocol.
# Enable only after every LibreChat API replica runs a version that supports protocol v1.
# CODE_ENVIRONMENT_DECISION_VERSION=1
# The immutable per-conversation code-environment decision protocol (v1) is advertised by
# default; per-chat machine choice depends on it. Set 0 to keep the legacy path, for example
# while LibreChat API replicas that predate protocol v1 are still running; 0 also turns off
# per-chat machine choice, so every agent stays on its fixed machine.
# CODE_ENVIRONMENT_DECISION_VERSION=0
# LIBRECHAT_CODE_BASEURL=
# Current self-hosted Code Interpreter deployments use per-user LibreChat JWTs outside local mode.
# Configure the matching public verifier on Code Interpreter; see:

View file

@ -511,7 +511,7 @@ describe('GET /api/config', () => {
expect(response.body.modelSpecs).toEqual({ list: [{ name: 'test-spec' }] });
expect(response.body.balance).toEqual({ enabled: true, startBalance: 10000 });
expect(response.body.webSearch).toEqual({ searchProvider: 'tavily' });
expect(response.body.codeEnvironmentDecisionVersion).toBeUndefined();
expect(response.body.codeEnvironmentDecisionVersion).toBe(1);
});
it('does not advertise conversation moves unless the effective policy enables them', async () => {
@ -536,7 +536,7 @@ describe('GET /api/config', () => {
},
},
});
delete process.env.CODE_ENVIRONMENT_DECISION_VERSION;
process.env.CODE_ENVIRONMENT_DECISION_VERSION = '0';
const app = createApp(mockUser);
const response = await request(app).get('/api/config');
@ -549,15 +549,22 @@ describe('GET /api/config', () => {
expect(response.body.codeWorkspaceRecoveryVersion).toBe(1);
});
it('advertises code environment decisions only after deployment-wide activation', async () => {
mockGetAppConfig.mockResolvedValue(baseAppConfig);
process.env.CODE_ENVIRONMENT_DECISION_VERSION = '1';
const app = createApp(mockUser);
it.each([undefined, '1'])(
'advertises code environment decisions by default and when set to 1 (%p)',
async (version) => {
mockGetAppConfig.mockResolvedValue(baseAppConfig);
if (version === undefined) {
delete process.env.CODE_ENVIRONMENT_DECISION_VERSION;
} else {
process.env.CODE_ENVIRONMENT_DECISION_VERSION = version;
}
const app = createApp(mockUser);
const response = await request(app).get('/api/config');
const response = await request(app).get('/api/config');
expect(response.body.codeEnvironmentDecisionVersion).toBe(1);
});
expect(response.body.codeEnvironmentDecisionVersion).toBe(1);
},
);
it.each(['0', '2', '1.0', 'true'])(
'does not advertise unsupported code environment decision version %s',

View file

@ -62,8 +62,9 @@ do not relax that policy to make the test pass.
Both chats read different physical files. An offline B never falls back to A.
The disposable fixture enables `endpoints.agents.statefulCodeSessions.allowEnvironmentSelection`
and the environment-decision protocol. Production deployments keep fixed-agent routing unless
that opt-in is enabled and the agent has a nonempty `code_environment_ids` list. The default
and the environment-decision protocol. Machine selection is on by default, but an agent keeps
fixed routing unless it has a nonempty `code_environment_ids` list, and a deployment can turn it
off with `allowEnvironmentSelection: false`. The default
`code_environment_id` is implicitly allowed; every additional machine still requires the user's
own access and current worker capabilities. This does not move an existing chat between machines.

View file

@ -782,9 +782,9 @@ endpoints:
# # (optional) Limit the workspace scopes users may select. Omit to allow all three.
# statefulCodeSessions:
# # Let new chats choose an attached machine from their agent's explicit machine allowlist.
# # Keep false until ALL API replicas support this field, then refresh clients.
# # Omitted/false preserves agents' fixed machine bindings.
# allowEnvironmentSelection: false
# # On by default; only agents with a saved allowlist are affected. Set false to keep
# # every agent on its fixed machine (for example while older API replicas still run).
# allowEnvironmentSelection: true
# # Maximum additional machines per agent; default 32, supported ceiling 128.
# maxEnvironmentChoices: 32
# # Keep move-only behavior unless attach/detach is explicitly enabled.

View file

@ -3531,11 +3531,12 @@ describe('initializeAgent — execute_code capability expansion', () => {
);
});
it('keeps legacy opt-out classification until the deployment protocol is enabled', async () => {
it('keeps legacy opt-out classification when the deployment opts out of the protocol', async () => {
const { agent, req, res, loadTools, db } = createMocks();
agent.tools = [Tools.execute_code];
agent.stateful_code_sessions = true;
delete agent.code_environment_id;
process.env.CODE_ENVIRONMENT_DECISION_VERSION = '0';
process.env.LIBRECHAT_CODE_BASEURL_STATEFUL = 'https://stateful-code.example.com/v1/';
req.config = {
endpoints: {
@ -3568,6 +3569,7 @@ describe('initializeAgent — execute_code capability expansion', () => {
expect(result.codeEnvAvailable).toBe(false);
expect(result.statefulCodeSessions).toBe(false);
} finally {
delete process.env.CODE_ENVIRONMENT_DECISION_VERSION;
delete process.env.LIBRECHAT_CODE_BASEURL_STATEFUL;
}
});

View file

@ -152,6 +152,20 @@ describe('resolveCodeExecutionContext', () => {
);
});
it('routes to the chosen machine when the deployment leaves the flag unset', () => {
const { allowEnvironmentSelection: _unset, ...unset } = params;
expect(resolveCodeExecutionContext(unset).environmentId).toBe('runtime-vm');
});
it('retains fixed routing when the deployment turns the decision protocol off', () => {
process.env.CODE_ENVIRONMENT_DECISION_VERSION = '0';
try {
expect(resolveCodeExecutionContext(params).environmentId).toBe('application-vm');
} finally {
delete process.env.CODE_ENVIRONMENT_DECISION_VERSION;
}
});
it.each(['allowEnvironmentSelection', 'environmentIds'] as const)(
'retains fixed routing when %s is disabled',
(gate) => {

View file

@ -13,6 +13,7 @@ import type {
TAgentsEndpoint,
} from 'librechat-data-provider';
import type { WorkspaceEditFileFeature } from '~/code/edits';
import { isCodeEnvironmentSelectionEnabled } from '~/code/protocol';
import { CodeWorkspaceSelectionError } from '~/code/errors';
export const CODE_API_EXPECTED_PROFILE_HEADER = 'X-CodeAPI-Expected-Profile';
@ -352,7 +353,8 @@ export function resolveCodeExecutionContext(params: {
userId?: string | null;
agentId?: string | null;
conversationId?: string | null;
/** Deployment ceiling and the persisted agent machine allowlist are both required. */
/** Deployment ceiling (on unless `false` or the decision protocol is off) and a persisted
* agent machine allowlist are both required. */
allowEnvironmentSelection?: boolean;
environmentIds?: readonly string[];
workspaceSelections?: unknown;
@ -373,7 +375,7 @@ export function resolveCodeExecutionContext(params: {
(params.environmentId ? candidate.id === params.environmentId : candidate.default === true),
);
const allowSelection =
params.allowEnvironmentSelection === true &&
isCodeEnvironmentSelectionEnabled(params.allowEnvironmentSelection) &&
(params.environmentIds?.length ?? 0) > 0 &&
(defaultEnvironment?.type === 'attached' ||
(defaultEnvironment == null && Boolean(params.environmentId)));

View file

@ -452,19 +452,32 @@ describe('resolveCodeExecutionWorkspaceContext', () => {
expect(resolved.codeWorkspace?.environment).toEqual(environment);
});
it.each(['source', 'isolated'] as const)(
'honors an explicit %s checkout choice',
async (checkout) => {
jest
.spyOn(globalThis, 'fetch')
.mockResolvedValue(
workspaceStatus([{ id: 'worktree', workspaceInstances: ['git_worktree'] }]),
);
it.each([
{ checkout: 'source', linkedWorktrees: undefined, lanes: true },
{ checkout: 'source', linkedWorktrees: true, lanes: true },
{ checkout: 'source', linkedWorktrees: false, lanes: false },
{ checkout: 'isolated', linkedWorktrees: undefined, lanes: false },
{ checkout: 'isolated', linkedWorktrees: true, lanes: false },
{ checkout: 'isolated', linkedWorktrees: false, lanes: false },
] as const)(
'honors checkout $checkout with linkedWorktrees=$linkedWorktrees',
async ({ checkout, linkedWorktrees, lanes }) => {
jest.spyOn(globalThis, 'fetch').mockResolvedValue(
workspaceStatus([
{
id: 'worktree',
workspaceInstances: ['git_worktree'],
workspaceScopes: ['git_linked_worktree'],
},
]),
);
const resolved = await resolveCodeExecutionWorkspaceContext({
context: {
...context,
conversationWorkspaceInstanceId: 'c'.repeat(64),
codeEnvironmentConfigSchema: { workspaces: { allowCheckoutSelection: true } },
codeEnvironmentConfigSchema: {
workspaces: { allowCheckoutSelection: true, linkedWorktrees },
},
},
requestedSelections: [{ environmentId: 'personal', workspaceId: 'worktree', checkout }],
environments,
@ -474,6 +487,7 @@ describe('resolveCodeExecutionWorkspaceContext', () => {
expect(resolved.codeWorkspace?.workspaceInstanceId).toBe(
checkout === 'isolated' ? 'c'.repeat(64) : undefined,
);
expect(resolved.codeWorkspace?.linkedWorktrees).toBe(lanes ? true : undefined);
},
);
@ -549,7 +563,7 @@ describe('resolveCodeExecutionWorkspaceContext', () => {
expect(legacy.codeWorkspace).not.toHaveProperty('workspaceInstanceId');
});
it('routes linked worktrees into lanes only when configured and no conversation instance owns the checkout', async () => {
it('routes linked worktrees into lanes unless disabled or a conversation instance owns the checkout', async () => {
const workspaceInstanceId = 'c'.repeat(64);
jest.spyOn(globalThis, 'fetch').mockImplementation(async () =>
workspaceStatus([
@ -588,7 +602,7 @@ describe('resolveCodeExecutionWorkspaceContext', () => {
expect(lanes.codeWorkspace?.linkedWorktrees).toBe(true);
expect(disabled.codeWorkspace).not.toHaveProperty('linkedWorktrees');
expect(unconfigured.codeWorkspace).not.toHaveProperty('linkedWorktrees');
expect(unconfigured.codeWorkspace?.linkedWorktrees).toBe(true);
expect(instance.codeWorkspace?.workspaceInstanceId).toBe(workspaceInstanceId);
expect(instance.codeWorkspace).not.toHaveProperty('linkedWorktrees');
expect(legacy.codeWorkspace).not.toHaveProperty('linkedWorktrees');

View file

@ -1,6 +1,7 @@
import { logger } from '@librechat/data-schemas';
import {
isCodeWorkspaceSelections,
isLinkedWorktreeRoutingAllowed,
canonicalizeCodeWorkspaceSelections,
isCodeWorkspaceCheckoutAvailable,
} from 'librechat-data-provider';
@ -161,7 +162,9 @@ export async function resolveCodeExecutionWorkspaceContext({
...selection,
operations: [...(workspace.operations ?? status.operations)],
...(usesIsolation ? { workspaceInstanceId: context.conversationWorkspaceInstanceId } : {}),
...(context.codeEnvironmentConfigSchema?.workspaces?.linkedWorktrees === true &&
...(isLinkedWorktreeRoutingAllowed(
context.codeEnvironmentConfigSchema?.workspaces?.linkedWorktrees,
) &&
workspace.workspaceScopes?.includes('git_linked_worktree') &&
!usesIsolation
? { linkedWorktrees: true }

View file

@ -2,6 +2,7 @@ import { EModelEndpoint } from 'librechat-data-provider';
import type { AppConfig } from '@librechat/data-schemas';
import {
isImplicitStatefulCodeRouteAvailable,
isCodeEnvironmentSelectionEnabled,
mergeAccessibleCodeEnvironments,
resolveCodeEnvironmentDecisionVersion,
resolveCodeEnvironmentMoveVersion,
@ -14,7 +15,11 @@ describe('resolveCodeEnvironmentDecisionVersion', () => {
expect(resolveCodeEnvironmentDecisionVersion('1')).toBe(1);
});
it.each([undefined, '0', '2', '1.0', 'true'])(
it.each([undefined, '', ' '])('advertises the supported version when unset (%p)', (version) => {
expect(resolveCodeEnvironmentDecisionVersion(version)).toBe(1);
});
it.each(['0', '2', '1.0', 'true'])(
'keeps unsupported configured version %s on the legacy-safe path',
(version) => {
expect(resolveCodeEnvironmentDecisionVersion(version)).toBeUndefined();
@ -82,10 +87,23 @@ describe('resolveCodeEnvironmentMoveVersion', () => {
});
});
describe('isCodeEnvironmentSelectionEnabled', () => {
it.each([
[undefined, undefined, true],
[true, '1', true],
[false, undefined, false],
[undefined, '0', false],
[true, '0', false],
])('flag %p with decision version %p resolves to %p', (flag, version, expected) => {
expect(isCodeEnvironmentSelectionEnabled(flag, version)).toBe(expected);
});
});
describe('isImplicitStatefulCodeRouteAvailable', () => {
it('requires both the deployed protocol version and a non-empty managed base URL', () => {
expect(isImplicitStatefulCodeRouteAvailable('1', 'https://code.example/v1')).toBe(true);
expect(isImplicitStatefulCodeRouteAvailable(undefined, 'https://code.example/v1')).toBe(false);
expect(isImplicitStatefulCodeRouteAvailable(undefined, 'https://code.example/v1')).toBe(true);
expect(isImplicitStatefulCodeRouteAvailable('0', 'https://code.example/v1')).toBe(false);
expect(isImplicitStatefulCodeRouteAvailable('1', ' ')).toBe(false);
});
});

View file

@ -1,6 +1,5 @@
import { logger } from '@librechat/data-schemas';
import {
CODE_ENVIRONMENT_DECISION_VERSION,
CODE_ENVIRONMENT_MOVE_VERSION,
CODE_ENVIRONMENT_TRANSITION_VERSION,
CODE_WORKSPACE_RECOVERY_VERSION,
@ -12,6 +11,12 @@ import type {
AccessibleCodeEnvironmentConfiguration,
CodeEnvironmentPrincipalContext,
} from './environments';
import { resolveCodeEnvironmentDecisionVersion } from './protocol';
export {
resolveCodeEnvironmentDecisionVersion,
isCodeEnvironmentSelectionEnabled,
} from './protocol';
type ConfigurationRegistry = {
listAccessibleConfigurations: (
@ -25,18 +30,6 @@ type StatefulCodeConfig = NonNullable<
>['statefulCodeSessions'];
type CodeEnvironmentConfig = NonNullable<NonNullable<StatefulCodeConfig>['environments']>[number];
/**
* Resolves the deployment-wide browser protocol gate. The exact version match
* keeps older and future wire shapes on the legacy-safe path.
*/
export function resolveCodeEnvironmentDecisionVersion(
configuredVersion?: string,
): typeof CODE_ENVIRONMENT_DECISION_VERSION | undefined {
return configuredVersion === String(CODE_ENVIRONMENT_DECISION_VERSION)
? CODE_ENVIRONMENT_DECISION_VERSION
: undefined;
}
function conversationMovesEnabled(appConfig?: Pick<AppConfig, 'endpoints'> | null): boolean {
return (
appConfig?.endpoints?.[EModelEndpoint.agents]?.statefulCodeSessions?.conversationMoves

View file

@ -0,0 +1,33 @@
import {
CODE_ENVIRONMENT_DECISION_VERSION,
isCodeEnvironmentSelectionAllowed,
} from 'librechat-data-provider';
/**
* Resolves the deployment-wide browser protocol gate. Unset or blank advertises the supported
* version, so per-chat machine choice works without a second opt-in. Any other value than the
* exact version — `0` to opt out, or an older or future wire shape — keeps the legacy-safe path.
*/
export function resolveCodeEnvironmentDecisionVersion(
configuredVersion?: string,
): typeof CODE_ENVIRONMENT_DECISION_VERSION | undefined {
const version = configuredVersion?.trim() ?? '';
return version === '' || version === String(CODE_ENVIRONMENT_DECISION_VERSION)
? CODE_ENVIRONMENT_DECISION_VERSION
: undefined;
}
/**
* Per-chat machine choice is recorded through the decision protocol, so a deployment that turns
* the protocol off (`CODE_ENVIRONMENT_DECISION_VERSION=0`) turns machine choice off as well, for
* both what the server advertises and what it routes.
*/
export function isCodeEnvironmentSelectionEnabled(
allowEnvironmentSelection?: boolean | null,
configuredDecisionVersion: string | undefined = process.env.CODE_ENVIRONMENT_DECISION_VERSION,
): boolean {
return (
isCodeEnvironmentSelectionAllowed(allowEnvironmentSelection) &&
resolveCodeEnvironmentDecisionVersion(configuredDecisionVersion) != null
);
}

View file

@ -246,6 +246,8 @@ describe('createEndpointsConfigService', () => {
expect(result?.[EModelEndpoint.agents]?.statefulCodeSessions).toEqual({
allowedEnvironments: ['user', 'agent-user'],
allowEnvironmentSelection: true,
maxEnvironmentChoices: 32,
approvalsEnabled: false,
approvalModes: [],
environments: [
@ -299,32 +301,68 @@ describe('createEndpointsConfigService', () => {
expect(result?.[EModelEndpoint.agents]?.statefulCodeSessions).toEqual({
allowedEnvironments: ['user'],
allowEnvironmentSelection: true,
maxEnvironmentChoices: 32,
approvalsEnabled: true,
approvalModes: ['ask', 'acceptEdits', 'fullAccess'],
environments: [],
});
});
it('advertises machine selection only when the deployment enables it', async () => {
const deps = createMockDeps({
loadDefaultEndpointsConfig: jest.fn().mockResolvedValue({
[EModelEndpoint.agents]: { userProvide: false, order: 0 },
}),
getAppConfig: jest.fn().mockResolvedValue(
appConfig({
endpoints: {
[EModelEndpoint.agents]: {
statefulCodeSessions: { allowEnvironmentSelection: true },
},
},
it.each([
[undefined, true],
[true, true],
[false, undefined],
])(
'advertises machine selection unless the deployment turns it off (configured: %p)',
async (allowEnvironmentSelection, advertised) => {
const deps = createMockDeps({
loadDefaultEndpointsConfig: jest.fn().mockResolvedValue({
[EModelEndpoint.agents]: { userProvide: false, order: 0 },
}),
),
});
const { getEndpointsConfig } = createEndpointsConfigService(deps);
const result = await getEndpointsConfig(fakeReq());
expect(result?.[EModelEndpoint.agents]?.statefulCodeSessions?.allowEnvironmentSelection).toBe(
true,
);
getAppConfig: jest.fn().mockResolvedValue(
appConfig({
endpoints: {
[EModelEndpoint.agents]: {
statefulCodeSessions: {
...(allowEnvironmentSelection === undefined
? {}
: { allowEnvironmentSelection }),
},
},
},
}),
),
});
const { getEndpointsConfig } = createEndpointsConfigService(deps);
const result = await getEndpointsConfig(fakeReq());
const advertisedConfig = result?.[EModelEndpoint.agents]?.statefulCodeSessions;
expect(advertisedConfig?.allowEnvironmentSelection).toBe(advertised);
expect(advertisedConfig?.maxEnvironmentChoices).toBe(advertised ? 32 : undefined);
},
);
it('does not advertise machine selection when the decision protocol is off', async () => {
process.env.CODE_ENVIRONMENT_DECISION_VERSION = '0';
try {
const deps = createMockDeps({
loadDefaultEndpointsConfig: jest.fn().mockResolvedValue({
[EModelEndpoint.agents]: { userProvide: false, order: 0 },
}),
getAppConfig: jest.fn().mockResolvedValue(
appConfig({
endpoints: { [EModelEndpoint.agents]: { statefulCodeSessions: {} } },
}),
),
});
const { getEndpointsConfig } = createEndpointsConfigService(deps);
const result = await getEndpointsConfig(fakeReq());
expect(
result?.[EModelEndpoint.agents]?.statefulCodeSessions?.allowEnvironmentSelection,
).toBeUndefined();
} finally {
delete process.env.CODE_ENVIRONMENT_DECISION_VERSION;
}
});
it.each([

View file

@ -12,6 +12,7 @@ import type { AppConfig } from '@librechat/data-schemas';
import type { ServerRequest, TCustomEndpointsConfig } from '~/types';
import type { GetAppConfigOptions } from '~/app/service';
import { loadCustomEndpointsConfig as defaultLoadCustomEndpoints } from '~/endpoints/custom';
import { isCodeEnvironmentSelectionEnabled } from '~/code/protocol';
import { getAppConfigOptionsFromUser } from '~/app/service';
import { getResponsesApiRouting } from './responses';
@ -103,7 +104,7 @@ export function createEndpointsConfigService(deps: EndpointsConfigDeps): {
const clientStatefulCodeSessions = statefulCodeSessions
? {
allowedEnvironments: statefulCodeSessions.allowedEnvironments,
...(statefulCodeSessions.allowEnvironmentSelection === true
...(isCodeEnvironmentSelectionEnabled(statefulCodeSessions.allowEnvironmentSelection)
? {
allowEnvironmentSelection: true,
maxEnvironmentChoices:

View file

@ -6,6 +6,25 @@ export const CODE_WORKSPACE_MAX_COUNT = 32;
/** Wire/storage safety ceiling; deployments may set a lower per-agent choice limit. */
export const MAX_AGENT_CODE_ENVIRONMENT_CHOICES = 128;
export const DEFAULT_AGENT_CODE_ENVIRONMENT_CHOICES = 32;
/**
* Per-chat machine choice is on unless a deployment sets `allowEnvironmentSelection: false`.
* It only ever applies to agents whose author saved a machine allowlist; every other agent
* keeps its fixed machine either way.
*/
export function isCodeEnvironmentSelectionAllowed(
allowEnvironmentSelection?: boolean | null,
): boolean {
return allowEnvironmentSelection !== false;
}
/**
* Linked-worktree lanes are on unless an environment sets `workspaces.linkedWorktrees: false`.
* They only apply where the worker advertises the `git_linked_worktree` scope.
*/
export function isLinkedWorktreeRoutingAllowed(linkedWorktrees?: boolean | null): boolean {
return linkedWorktrees !== false;
}
/** API/client protocol for immutable conversation-owned environment decisions. */
export const CODE_ENVIRONMENT_DECISION_VERSION = 1 as const;
/** API/client protocol for an owner's explicit move of a sealed environment decision. */

View file

@ -1347,8 +1347,8 @@ export const codeEnvironmentUserConfigSchema = z
workspaces: z
.object({
/** Run requests aimed at `.worktrees/<name>` in that worktree's own lane when the
* worker advertises linked-worktree lanes. Omission keeps every request scoped to
* its checkout. */
* worker advertises linked-worktree lanes. Omission allows it; `false` keeps every
* request scoped to its checkout. */
linkedWorktrees: z.boolean().optional(),
/** Permit explicit per-conversation checkout choices after every API replica supports
* them. Omission preserves automatic worker isolation and hides the selector. */
@ -1526,8 +1526,8 @@ export const agentsEndpointSchema = baseEndpointSchema
statefulCodeSessions: z
.object({
allowedEnvironments: z.array(z.enum(STATEFUL_CODE_ENVIRONMENTS)).min(1),
/** Allow agents with a machine allowlist to use a chat-owned machine instead of their default.
* Enable after every API replica supports per-chat machine routing. */
/** Let new chats pick a machine from their agent's saved allowlist instead of its default.
* Omission allows it; `false` keeps every agent on its fixed machine. */
allowEnvironmentSelection: z.boolean().optional(),
/** Maximum additional machine choices saved on an agent (wire ceiling: 128). */
maxEnvironmentChoices: z