fix(auth): scope km alias mapping to settings profiles

- prevent km continuity mappings from affecting kimi cliproxy executions

- apply canonical alias fallback only for settings profile lookups

- add regression test for cross-type alias isolation
This commit is contained in:
Tam Nhu Tran committed 2026-03-03 02:58:49 +07:00
1 parent 1eb41cc4e2
commit d827c3ab0b
2 files changed
+33 -6

No files matched your search

+11 -6
View File
@@ -65,12 +65,13 @@ function loadLegacyContinuityInheritanceMap(): Record<string, string> {
function resolveMappedAccount(
profileName: string,
profileType: ProfileType,
inheritFromAccount: Record<string, string>
): string | undefined {
const candidates = new Set<string>([
...getProfileLookupCandidates(profileName),
resolveAliasToCanonical(profileName),
]);
const candidates = new Set<string>(getProfileLookupCandidates(profileName));
if (profileType === 'settings') {
candidates.add(resolveAliasToCanonical(profileName));
}
for (const candidate of candidates) {
const mapped = inheritFromAccount[candidate];
@@ -118,9 +119,13 @@ export async function resolveProfileContinuityInheritance(
const inheritFromAccount = getContinuityInheritanceMap();
const sourceAccount =
resolveMappedAccount(input.profileName, inheritFromAccount) ??
resolveMappedAccount(input.profileName, input.profileType, inheritFromAccount) ??
(!isUnifiedMode()
? resolveMappedAccount(input.profileName, loadLegacyContinuityInheritanceMap())
? resolveMappedAccount(
input.profileName,
input.profileType,
loadLegacyContinuityInheritanceMap()
)
: undefined);
if (!sourceAccount) {
return {};