fix(kiro): prefer scored URL extraction for stderr manual callback

Use extractLikelyOAuthAuthorizationUrl before falling back to naive
regex when detecting auth URLs in stderr for manual callback replay.
Prevents prompting with non-OAuth URLs when stderr emits multiple URLs.
This commit is contained in:
Tam Nhu Tran committed 2026-04-07 09:15:36 -04:00
1 parent d95cee1e84
commit 5b1754a320
1 file changed
+4 -3
+4 -3
View File
@@ -765,13 +765,14 @@ export function executeOAuthProcess(options: OAuthProcessOptions): Promise<Accou
displayUrlFromStderr(output, state, oauthConfig); displayUrlFromStderr(output, state, oauthConfig);
} }
if (options.manualCallback && !state.manualCallbackPrompted) { if (options.manualCallback && !state.manualCallbackPrompted) {
const urlMatch = output.match(/https?:\/\/[^\s]+/); const authUrl =
if (urlMatch) { extractLikelyOAuthAuthorizationUrl(output) ?? output.match(/https?:\/\/[^\s]+/)?.[0];
if (authUrl) {
state.manualCallbackPrompted = true; state.manualCallbackPrompted = true;
await replayManualCallback( await replayManualCallback(
options.oauthConfig, options.oauthConfig,
authProcess, authProcess,
urlMatch[0], authUrl,
options.verbose, options.verbose,
state, state,
10 * 60 * 1000 10 * 60 * 1000