Repository navigation
feat(accessibility): wait for a report to finish processing before reading its issues #503
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
Merged
gaurav-singh-9227
merged 3 commits into
feat/a11y-fetch-build-and-workflow-issues
from
feat/a11y-wait-for-processing
Oct 22, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
2c5b131
feat(accessibility): wait for a report to finish processing before re…
Aaryan430 7a1e5a5
fix(accessibility): wait only while a report is finalizing, not while…
Aaryan430 959cb63
Merge branch 'feat/a11y-fetch-build-and-workflow-issues' into feat/a1…
Aaryan430 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Stop polling when the MCP request is canceled.
fetchAccessibilityIssuesreceives the MCP cancellation signal, butwaitForProcessingdoes not use it. After cancellation, the polling delay can still complete and trigger repeatedreportFetcher.reportStatus(source)calls for up to five minutes. Pass the signal towaitForProcessing, reject its delay when the signal aborts, and check the signal before each status request.One status request can still finish after cancellation because
apiClientdoes not support abort signals. This localized fix prevents subsequent polling requests without changing that transport.Suggested fix
async function waitForProcessing( reportFetcher: AccessibilityReportFetcher, source: IssueSource, wait: boolean, context: ScanProgressContext | undefined, ): Promise<ProcessingState> { const started = Date.now(); + const signal = context?.signal; const firstStatus = await reportFetcher.reportStatus(source); let status = firstStatus; while ( wait && status && PROCESSING_STATUSES.has(status) && Date.now() - started < REPORT_STATUS_WAIT_MS ) { @@ - await new Promise((resolve) => setTimeout(resolve, REPORT_STATUS_POLL_MS)); + await new Promise<void>((resolve, reject) => { + if (!signal) { + setTimeout(resolve, REPORT_STATUS_POLL_MS); + return; + } + if (signal.aborted) { + reject(signal.reason); + return; + } + const timer = setTimeout(resolve, REPORT_STATUS_POLL_MS); + signal.addEventListener( + "abort", + () => { + clearTimeout(timer); + reject(signal.reason); + }, + { once: true }, + ); + }); + if (signal?.aborted) throw signal.reason; status = await reportFetcher.reportStatus(source); } return { status, firstStatus, waitedMs: Date.now() - started }; }🤖 Prompt for AI Agents
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: browserstack/mcp-server
Length of output: 6147
🏁 Script executed:
Repository: browserstack/mcp-server
Length of output: 10369
🏁 Script executed:
Repository: browserstack/mcp-server
Length of output: 7387
🏁 Script executed:
Repository: browserstack/mcp-server
Length of output: 12113
🏁 Script executed:
Repository: browserstack/mcp-server
Length of output: 12886
🌐 Web query:
official @modelcontextprotocol/sdk TypeScript RequestHandlerExtra sendNotification Promise transport rejection behavior💡 Result:
Treat progress notifications as best effort.
When
context.sendNotificationrejects,waitForProcessingpropagates the rejection beforegetReportLinkor CSV parsing. The outer handler converts it to an error response, so the rejection does not escape, but available issues are not returned.Suggested fix
if (context) { - await notifyScanProgress( - context, - `The report is still ${status}; waiting for it to complete (${formatDuration(waited)} of up to ${formatDuration(REPORT_STATUS_WAIT_MS)}).`, - Math.min(99, Math.round((waited / REPORT_STATUS_WAIT_MS) * 100)), - ); + try { + await notifyScanProgress( + context, + `The report is still ${status}; waiting for it to complete (${formatDuration(waited)} of up to ${formatDuration(REPORT_STATUS_WAIT_MS)}).`, + Math.min(99, Math.round((waited / REPORT_STATUS_WAIT_MS) * 100)), + ); + } catch { + // Progress delivery must not prevent issue retrieval. + } }📝 Committable suggestion
🤖 Prompt for AI Agents