Skip to content

Commit 09c9dbb

Browse files
fix(agents): use first @ after last slash in splitTrailingAuthProfile
The parser used `lastIndexOf("@")` which incorrectly split email-based Auth Profile IDs like `google-gemini-cli:[email protected]`. By searching for the first `@` after the last `/` instead, both scoped model paths (e.g. `@cf/...`) and email-containing profiles are handled correctly. Closes #30912 Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 907c09e commit 09c9dbb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/agents/model-ref-profile.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,11 @@ describe("splitTrailingAuthProfile", () => {
4646
model: "provider/foo@bar/baz",
4747
});
4848
});
49+
50+
it("uses first @ after last slash for email-based auth profiles", () => {
51+
expect(splitTrailingAuthProfile("flash@google-gemini-cli:[email protected]")).toEqual({
52+
model: "flash",
53+
profile: "google-gemini-cli:[email protected]",
54+
});
55+
});
4956
});

src/agents/model-ref-profile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ export function splitTrailingAuthProfile(raw: string): {
77
return { model: "" };
88
}
99

10-
const profileDelimiter = trimmed.lastIndexOf("@");
1110
const lastSlash = trimmed.lastIndexOf("/");
12-
if (profileDelimiter <= 0 || profileDelimiter <= lastSlash) {
11+
const profileDelimiter = trimmed.indexOf("@", lastSlash + 1);
12+
if (profileDelimiter <= 0) {
1313
return { model: trimmed };
1414
}
1515

0 commit comments

Comments
 (0)