fix: OAuth MCP tool is not enabled after login when the model has default tools (#32488)

Enabling an OAuth MCP tool from the Integrations menu sends the user through the OAuth login and back to a new chat, where the tool should be on. When the selected model had tools of its own enabled by default, the tool came back switched off, so it had to be enabled a second time. Now it stays on, together with the model's own tools. For the same reason, a link like `/?tools=my_tool` opened with such a model ignored the listed tools, and now turns them on.

Fixes #32476
This commit is contained in:
Classic298 2026-10-16 01:00:34 +02:00 • committed by GitHub
parent 1bc5648a7b
commit 8172291838
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1071,10 +1071,12 @@
lastTerminalSkillSelector = $selectedTerminalId;
}
let settingDefaults = false;
let settingDefaults: Promise<void> | null = null;
const setDefaults = async () => {
if (settingDefaults) return;
settingDefaults = true;
// Concurrent callers must wait, or the earlier run overwrites what they write afterwards
if (settingDefaults) return settingDefaults;
let resolveDefaults = () => {};
settingDefaults = new Promise<void>((resolve) => (resolveDefaults = resolve));
try {
if (!$tools) {
@ -1217,7 +1219,8 @@
}
}
} finally {
settingDefaults = false;
settingDefaults = null;
resolveDefaults();
}
};