-
-
Notifications
You must be signed in to change notification settings - Fork 272
oauth: let the debugger's warnings arrive as warnings #4483
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -272,6 +272,28 @@ const UNREPORTED_STEP_FAILURES = new Set([ | |
| AUTHORIZATION_SERVER_METADATA_MISSING_ISSUER, | ||
| ]); | ||
|
|
||
| /** | ||
| * One failure, or two? | ||
| * | ||
| * A step that fails twice over — DCR, say — writes its bare message first and | ||
| * then the same message with the recovery hint appended | ||
| * (`errorWithFallbackHint` in the SDK is `${error} ${FALLBACK_HINT}`). Exact | ||
| * comparison saw two different strings and reported both, one millisecond | ||
| * apart, so a single refusal arrived as a pair: 29 of 378 events over 18 days. | ||
| * | ||
| * Prefix, not equality, and in whichever order they arrive. This is | ||
| * deliberately narrow — an unrelated failure never begins with the whole text | ||
| * of the one before it, so widening a step's message cannot swallow the next | ||
| * step's. | ||
| */ | ||
| function isSameStepFailure( | ||
| error: string, | ||
| lastReported: string | undefined | ||
| ): boolean { | ||
| if (lastReported === undefined) return false; | ||
| return error.startsWith(lastReported) || lastReported.startsWith(error); | ||
|
Contributor
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. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Restrict deduplication to the recovery hint.
Remove only the exact recovery-hint suffix before comparing messages. Add a regression case for distinct messages where one is a prefix of the other. 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| /** | ||
| * Wrap the caller's `updateState` so every NEW step failure is reported. | ||
| * | ||
|
|
@@ -309,7 +331,11 @@ function withStepFailureReporting( | |
| updateState(updates); | ||
| return; | ||
| } | ||
| if (typeof error === "string" && error !== "" && error !== lastReportedError) { | ||
| if ( | ||
| typeof error === "string" && | ||
| error !== "" && | ||
| !isSameStepFailure(error, lastReportedError) | ||
| ) { | ||
| lastReportedError = error; | ||
| reportCaught(new Error(sanitizeStepError(error)), { | ||
| source: "oauth_debugger_step", | ||
|
|
||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: MCPJam/inspector
Length of output: 50372
🏁 Script executed:
Repository: MCPJam/inspector
Length of output: 50373
🏁 Script executed:
Repository: MCPJam/inspector
Length of output: 11374
Keep
$exception_levelauthoritative.reportCaughtpasses...(options.extra ?? {})after$exception_level, soextra: { $exception_level: "error" }overwrites a declaredlevel: "warning". Spreadoptions.extrafirst, then assign$exception_level, and add a regression test for this collision.🤖 Prompt for AI Agents