Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Stop pre-filling one organisation's GCP project in the Vertex AI login form (#978)

Abel Dantas557b62b23002
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 030786534..1b18bf3ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2103,6 +2103,11 @@ version of their own to them without also giving them a release of their own.
agent"; it was the only place Console showed that name.
#### Fixed
+- **Giving a machine a Vertex AI login no longer pre-fills a project.** The
+ Google Cloud project field started out filled with one organisation's own
+ project, so anyone else who kept it got a sign-in failure with nothing to
+ say why. It now starts empty, with a placeholder; the region still starts
+ at `global`.
- **Two agent hosts starting at once on Windows no longer crash each other.**
A host reading another host's ownership ticket while that host replaced or
deleted it got `EPERM` from Windows and exited. It now tries the read again
diff --git a/console/apps/switch-console-desktop/src/main/core/managed-agents/give-machine-login.test.ts b/console/apps/switch-console-desktop/src/main/core/managed-agents/give-machine-login.test.ts
index 688695967..ff5853a5f 100644
--- a/console/apps/switch-console-desktop/src/main/core/managed-agents/give-machine-login.test.ts
+++ b/console/apps/switch-console-desktop/src/main/core/managed-agents/give-machine-login.test.ts
@@ -149,7 +149,7 @@ describe('giving a machine a provider login', () => {
const give = (
credentials: { from: 'key'; json: string } | { from: 'this-computer' },
provider: 'claude' | 'codex' = 'claude',
- project = 'cg-vertexai'
+ project = 'acme-ai'
) =>
managedAgentsController.giveMachineLogin({
serverId: 'server-1',
@@ -170,7 +170,7 @@ describe('giving a machine a provider login', () => {
expect(JSON.stringify(mocks.giveMachineLogin.mock.calls[0]![3])).not.toContain('PRIVATE KEY');
expect(given()).toEqual({
v: 1,
- project: 'cg-vertexai',
+ project: 'acme-ai',
region: 'global',
credentials: SERVICE_ACCOUNT_KEY_FIXTURE,
});
diff --git a/console/apps/switch-console-desktop/src/renderer/features/locations/components/add-agent-modal/give-machine-login.tsx b/console/apps/switch-console-desktop/src/renderer/features/locations/components/add-agent-modal/give-machine-login.tsx
index e99347b8f..62d808703 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/locations/components/add-agent-modal/give-machine-login.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/locations/components/add-agent-modal/give-machine-login.tsx
@@ -23,8 +23,8 @@ const VERTEX_SOURCES: { value: VertexSource; label: string }[] = [
{ value: 'this-computer', label: "This computer's Google sign-in" },
];
-/** What Claude Code on Vertex AI is set up with at SandboxAQ (`cg-claude-code-starter`). */
-const VERTEX_DEFAULTS = { project: 'cg-vertexai', region: 'global' };
+/** Claude on Vertex AI is served from the global endpoint unless the project pins a region. */
+const VERTEX_DEFAULT_REGION = 'global';
/** The ways a machine can be given each provider's login. */
export function loginKindsFor(provider: AgentProviderId): { value: LoginKind; label: string }[] {
@@ -84,8 +84,8 @@ export function GiveMachineLogin({
const [kind, setKind] = useState<LoginKind>(kinds[0]!.value);
const [credential, setCredential] = useState('');
const [vertexSource, setVertexSource] = useState<VertexSource>('key');
- const [project, setProject] = useState(VERTEX_DEFAULTS.project);
- const [region, setRegion] = useState(VERTEX_DEFAULTS.region);
+ const [project, setProject] = useState('');
+ const [region, setRegion] = useState(VERTEX_DEFAULT_REGION);
const [pickedFile, setPickedFile] = useState<string | null>(null);
const [pickError, setPickError] = useState<string | null>(null);
const fileInput = useRef<HTMLInputElement>(null);
@@ -254,6 +254,7 @@ export function GiveMachineLogin({
<span>Google Cloud project</span>
<Input
aria-label="Google Cloud project"
+ placeholder="my-gcp-project"
value={project}
onChange={(event) => setProject(event.target.value)}
disabled={waiting}
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/give-machine-login-vertex.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/give-machine-login-vertex.test.tsx
index 0304f5da6..cf410b569 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/give-machine-login-vertex.test.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/give-machine-login-vertex.test.tsx
@@ -144,11 +144,12 @@ describe('giving a machine a Claude login through Vertex AI', () => {
);
expect(el.textContent).toContain('roles/aiplatform.user');
expect(el.textContent).not.toContain('all of your Google Cloud access');
- expect(byLabel<HTMLInputElement>(el, 'Google Cloud project').value).toBe('cg-vertexai');
+ expect(byLabel<HTMLInputElement>(el, 'Google Cloud project').value).toBe('');
expect(byLabel<HTMLInputElement>(el, 'Region').value).toBe('global');
expect(button(el, 'Give login').disabled).toBe(true);
await type(byLabel<HTMLTextAreaElement>(el, 'Service account key'), KEY);
+ await type(byLabel<HTMLInputElement>(el, 'Google Cloud project'), 'acme-ai');
await type(byLabel<HTMLInputElement>(el, 'Region'), 'us-east5');
await click(button(el, 'Give login'));
@@ -158,7 +159,7 @@ describe('giving a machine a Claude login through Vertex AI', () => {
provider: 'claude',
login: {
source: 'vertex',
- project: 'cg-vertexai',
+ project: 'acme-ai',
region: 'us-east5',
credentials: { from: 'key', json: KEY },
},
@@ -182,6 +183,7 @@ describe('giving a machine a Claude login through Vertex AI', () => {
expect(byLabel<HTMLTextAreaElement>(el, 'Service account key').value).toBe(KEY);
});
expect(el.textContent).toContain('Read vertex-sa.json');
+ await type(byLabel<HTMLInputElement>(el, 'Google Cloud project'), 'acme-ai');
await click(button(el, 'Give login'));
expect(giveMachineLogin.mock.calls[0]![0].login.credentials).toEqual({
from: 'key',
@@ -198,12 +200,13 @@ describe('giving a machine a Claude login through Vertex AI', () => {
'This gives cloud-box all of your Google Cloud access'
);
expect(el.querySelector('[aria-label="Service account key"]')).toBeNull();
+ await type(byLabel<HTMLInputElement>(el, 'Google Cloud project'), 'acme-ai');
expect(button(el, 'Give login').disabled).toBe(false);
await click(button(el, 'Give login'));
expect(giveMachineLogin.mock.calls[0]![0].login).toEqual({
source: 'vertex',
- project: 'cg-vertexai',
+ project: 'acme-ai',
region: 'global',
credentials: { from: 'this-computer' },
});
@@ -218,6 +221,7 @@ describe('giving a machine a Claude login through Vertex AI', () => {
const el = await render();
await chooseVertex(el);
await click(byLabel(el, "This computer's Google sign-in"));
+ await type(byLabel<HTMLInputElement>(el, 'Google Cloud project'), 'acme-ai');
await click(button(el, 'Give login'));
expect(el.querySelector('[role="alert"]')?.textContent).toContain(
@@ -230,6 +234,10 @@ describe('giving a machine a Claude login through Vertex AI', () => {
const el = await render();
await chooseVertex(el);
await click(byLabel(el, "This computer's Google sign-in"));
+ expect(byLabel<HTMLInputElement>(el, 'Google Cloud project').placeholder).toBe(
+ 'my-gcp-project'
+ );
+ expect(button(el, 'Give login').disabled).toBe(true);
await type(byLabel<HTMLInputElement>(el, 'Google Cloud project'), ' ');
expect(button(el, 'Give login').disabled).toBe(true);
});
diff --git a/console/packages/agent-controller/src/runtime.test.ts b/console/packages/agent-controller/src/runtime.test.ts
index 52032cd37..cd0133a3f 100644
--- a/console/packages/agent-controller/src/runtime.test.ts
+++ b/console/packages/agent-controller/src/runtime.test.ts
@@ -299,7 +299,7 @@ describe('InProcessRuntime', () => {
const path = join(checkDir, 'provider-home', 'google-credentials.json');
expect(env).toEqual({
CLAUDE_CODE_USE_VERTEX: '1',
- ANTHROPIC_VERTEX_PROJECT_ID: 'cg-vertexai',
+ ANTHROPIC_VERTEX_PROJECT_ID: 'acme-ai',
CLOUD_ML_REGION: 'global',
GOOGLE_APPLICATION_CREDENTIALS: path,
});
diff --git a/console/packages/agent-providers/src/host/hosted-provider.test.ts b/console/packages/agent-providers/src/host/hosted-provider.test.ts
index 86ff48b92..e31fb8c1e 100644
--- a/console/packages/agent-providers/src/host/hosted-provider.test.ts
+++ b/console/packages/agent-providers/src/host/hosted-provider.test.ts
@@ -129,7 +129,7 @@ it('writes a Vertex AI login’s Google credential under the root, and signs Cla
const path = join(root, 'provider-home', 'google-credentials.json');
expect(env).toEqual({
CLAUDE_CODE_USE_VERTEX: '1',
- ANTHROPIC_VERTEX_PROJECT_ID: 'cg-vertexai',
+ ANTHROPIC_VERTEX_PROJECT_ID: 'acme-ai',
CLOUD_ML_REGION: 'global',
GOOGLE_APPLICATION_CREDENTIALS: path,
});
diff --git a/console/packages/agent-providers/src/host/provider-login.test.ts b/console/packages/agent-providers/src/host/provider-login.test.ts
index 64fba1620..b6bf2c88b 100644
--- a/console/packages/agent-providers/src/host/provider-login.test.ts
+++ b/console/packages/agent-providers/src/host/provider-login.test.ts
@@ -65,7 +65,7 @@ describe('provider logins handed to an agent host', () => {
const vertex = { ...login, kind: 'vertex' as const, credential: vertexCredentialFixture() };
expect(providerLoginEnvironment('/root', vertex)).toEqual({
CLAUDE_CODE_USE_VERTEX: '1',
- ANTHROPIC_VERTEX_PROJECT_ID: 'cg-vertexai',
+ ANTHROPIC_VERTEX_PROJECT_ID: 'acme-ai',
CLOUD_ML_REGION: 'global',
GOOGLE_APPLICATION_CREDENTIALS: join('/root', 'provider-home', 'google-credentials.json'),
ANTHROPIC_API_KEY: '',
diff --git a/console/packages/agent-providers/src/testing/vertex-fixtures.ts b/console/packages/agent-providers/src/testing/vertex-fixtures.ts
index 73e986a67..ea28d6387 100644
--- a/console/packages/agent-providers/src/testing/vertex-fixtures.ts
+++ b/console/packages/agent-providers/src/testing/vertex-fixtures.ts
@@ -1,10 +1,10 @@
/** Google credentials shaped as real ones are, holding nothing that signs in. */
export const SERVICE_ACCOUNT_KEY_FIXTURE = {
type: 'service_account',
- project_id: 'cg-vertexai',
+ project_id: 'acme-ai',
private_key_id: 'fixture-key-id',
private_key: '-----BEGIN PRIVATE KEY-----\nfixture\n-----END PRIVATE KEY-----\n',
- client_email: '[email protected]',
+ client_email: '[email protected]',
client_id: '1234567890',
token_uri: 'https://oauth2.googleapis.com/token',
universe_domain: 'googleapis.com',
@@ -19,7 +19,7 @@ export const AUTHORIZED_USER_FIXTURE = {
universe_domain: 'googleapis.com',
} as const;
-/** A `vertex` login's credential for project `cg-vertexai` in `global`. */
+/** A `vertex` login's credential for project `acme-ai` in `global`. */
export function vertexCredentialFixture(credentials: object = SERVICE_ACCOUNT_KEY_FIXTURE): string {
- return JSON.stringify({ v: 1, project: 'cg-vertexai', region: 'global', credentials });
+ return JSON.stringify({ v: 1, project: 'acme-ai', region: 'global', credentials });
}
diff --git a/console/packages/agent-providers/src/vertex-login.test.ts b/console/packages/agent-providers/src/vertex-login.test.ts
index 336f2126b..abb7528bb 100644
--- a/console/packages/agent-providers/src/vertex-login.test.ts
+++ b/console/packages/agent-providers/src/vertex-login.test.ts
@@ -16,7 +16,7 @@ import {
const SERVICE_ACCOUNT_KEY = SERVICE_ACCOUNT_KEY_FIXTURE;
const AUTHORIZED_USER = AUTHORIZED_USER_FIXTURE;
-function credential(credentials: unknown, project = 'cg-vertexai', region = 'global'): string {
+function credential(credentials: unknown, project = 'acme-ai', region = 'global'): string {
return vertexLoginCredential({ project, region, credentials: credentials as GoogleCredentials });
}
@@ -25,7 +25,7 @@ describe('Vertex AI logins', () => {
for (const credentials of [SERVICE_ACCOUNT_KEY, AUTHORIZED_USER]) {
expect(parseVertexLogin(credential(credentials))).toEqual({
v: 1,
- project: 'cg-vertexai',
+ project: 'acme-ai',
region: 'global',
credentials,
});
@@ -63,21 +63,21 @@ describe('Vertex AI logins', () => {
for (const project of ['Upper-Case', 'short', '1starts-with-digit', 'ends-with-hyphen-', ''])
expect(() => credential(SERVICE_ACCOUNT_KEY, project)).toThrow(/project id/);
for (const region of ['', 'us east', 'US-EAST5', 'us_east5'])
- expect(() => credential(SERVICE_ACCOUNT_KEY, 'cg-vertexai', region)).toThrow(/region/);
+ expect(() => credential(SERVICE_ACCOUNT_KEY, 'acme-ai', region)).toThrow(/region/);
});
it('refuses a login that is not one', () => {
expect(() => parseVertexLogin('{')).toThrow(/not JSON/);
expect(() =>
parseVertexLogin(
- JSON.stringify({ v: 2, project: 'cg-vertexai', region: 'global', credentials: {} })
+ JSON.stringify({ v: 2, project: 'acme-ai', region: 'global', credentials: {} })
)
).toThrow(/invalid v/);
expect(() =>
parseVertexLogin(
JSON.stringify({
v: 1,
- project: 'cg-vertexai',
+ project: 'acme-ai',
region: 'global',
credentials: AUTHORIZED_USER,
extra: true,