AI: improve blocked network condition reason `Blocked reason: inspector` was unclear and didn't let the AI know that it failed because of DevTools conditions. This new text is clearer and will help the AI understand the failure reason. Fixed: 460763995 Change-Id: I7827190f5182d2d899630e966028497d182df0f0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7806989 Commit-Queue: Kateryna Prokopenko <kprokopenko@chromium.org> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org> Reviewed-by: Kateryna Prokopenko <kprokopenko@chromium.org>
diff --git a/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.test.ts b/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.test.ts index ab85b03..0ff1b29 100644 --- a/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.test.ts +++ b/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.test.ts
@@ -226,7 +226,7 @@ corsErrorStatus: undefined, localizedFailDescription: null, }), - 'Blocked reason: inspector\n'); + 'Blocked reason: a custom network condition in DevTools is blocking this request\n'); }); it('handles CORS error correctly', () => {
diff --git a/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts b/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts index e70c2c3..0b0ccc0 100644 --- a/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +++ b/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import type * as SDK from '../../../core/sdk/sdk.js'; -import type * as Protocol from '../../../generated/protocol.js'; +import * as Protocol from '../../../generated/protocol.js'; import * as Annotations from '../../annotations/annotations.js'; import * as Logs from '../../logs/logs.js'; import * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js'; @@ -115,7 +115,11 @@ }): string { const lines = []; if (reasons.blockedReason) { - lines.push(`Blocked reason: ${reasons.blockedReason}`); + if (reasons.blockedReason === Protocol.Network.BlockedReason.Inspector) { + lines.push('Blocked reason: a custom network condition in DevTools is blocking this request'); + } else { + lines.push(`Blocked reason: ${reasons.blockedReason}`); + } } if (reasons.corsErrorStatus) { lines.push(`CORS error: ${reasons.corsErrorStatus.corsError} ${reasons.corsErrorStatus.failedParameter}`);