Repository navigation
fix(core): prevent duplicate MCP processes from concurrent discovery #3819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
4606f56
42ae93c
ddb74f0
88d4b3a
54ece25
1701569
6ab6703
04220be
0727fd0
5ec9c8b
0535fe5
e931520
206ec8a
ad2ca85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,7 +17,11 @@ import type { | |||||||||||||||||||||||||||||||||||||||||||
| GenerateContentResponseUsageMetadata, | ||||||||||||||||||||||||||||||||||||||||||||
| } from '@google/genai'; | ||||||||||||||||||||||||||||||||||||||||||||
| import { createUserContent, FinishReason } from '@google/genai'; | ||||||||||||||||||||||||||||||||||||||||||||
| import { retryWithBackoff, isUnattendedMode } from '../utils/retry.js'; | ||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||
| retryWithBackoff, | ||||||||||||||||||||||||||||||||||||||||||||
| isUnattendedMode, | ||||||||||||||||||||||||||||||||||||||||||||
| classifyError, | ||||||||||||||||||||||||||||||||||||||||||||
| } from '../utils/retry.js'; | ||||||||||||||||||||||||||||||||||||||||||||
| import { getErrorStatus } from '../utils/errors.js'; | ||||||||||||||||||||||||||||||||||||||||||||
| import { createDebugLogger } from '../utils/debugLogger.js'; | ||||||||||||||||||||||||||||||||||||||||||||
| import { parseAndFormatApiError } from '../utils/errorParsing.js'; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -713,17 +717,21 @@ export class GeminiChat { | |||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||
| const streamResponse = await retryWithBackoff(apiCall, { | ||||||||||||||||||||||||||||||||||||||||||||
| shouldRetryOnError: (error: unknown) => { | ||||||||||||||||||||||||||||||||||||||||||||
| // Never retry deterministic client errors regardless of classification | ||||||||||||||||||||||||||||||||||||||||||||
| if (error instanceof Error) { | ||||||||||||||||||||||||||||||||||||||||||||
| if (isSchemaDepthError(error.message)) return false; | ||||||||||||||||||||||||||||||||||||||||||||
| if (isInvalidArgumentError(error.message)) return false; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const status = getErrorStatus(error); | ||||||||||||||||||||||||||||||||||||||||||||
| if (status === 400) return false; | ||||||||||||||||||||||||||||||||||||||||||||
| if (status === 429) return true; | ||||||||||||||||||||||||||||||||||||||||||||
| if (status && status >= 500 && status < 600) return true; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||
| // Delegate to classifyError for all other cases. Explicitly accepted | ||||||||||||||||||||||||||||||||||||||||||||
| // retryable categories for Gemini streaming: 408 (timeout), 409 (transient | ||||||||||||||||||||||||||||||||||||||||||||
| // lock/contention only), 429 (rate limit), 5xx (server errors), network | ||||||||||||||||||||||||||||||||||||||||||||
| // transport errors. Deterministic errors (400, 401, 403, 404, 422) are | ||||||||||||||||||||||||||||||||||||||||||||
| // handled by classifyError and return retryable=false. | ||||||||||||||||||||||||||||||||||||||||||||
| return classifyError(error).retryable; | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion]
Suggested change
— deepseek-v4-pro via Qwen Code /review
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion]
Suggested change
— deepseek-v4-pro via Qwen Code /review |
||||||||||||||||||||||||||||||||||||||||||||
| authType: this.config.getContentGeneratorConfig()?.authType, | ||||||||||||||||||||||||||||||||||||||||||||
| persistentMode: isUnattendedMode(), | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The comment says "Delegate to classifyError for all other cases", but
isSchemaDepthErrorandisInvalidArgumentErrorchecks (~10 lines above) still precede the delegation. These checks are not insideclassifyError— a future maintainer who trusts the comment may remove them, creating a gap.Update the comment to clarify these two message-level guards are independent safety nets not covered by
classifyError.Also: the
if (status === 400) return false;check above is now redundant dead code (classifyError already rejects 400). Either remove it or add a comment noting it's a safety net.— deepseek-v4-pro via Qwen Code /review