Skip to content

Fix: Cancel button now aborts in-flight text message requests#136

Merged
cnu1812 merged 1 commit intojenkinsci:mainfrom
divyansh-cyber:fix/issue-135
Feb 4, 2026
Merged

Fix: Cancel button now aborts in-flight text message requests#136
cnu1812 merged 1 commit intojenkinsci:mainfrom
divyansh-cyber:fix/issue-135

Conversation

@divyansh-cyber
Copy link
Copy Markdown
Contributor

@divyansh-cyber divyansh-cyber commented Feb 3, 2026

The Cancel button did not abort in-flight text message requests. Only the timeout could stop them the AbortSignal from the UI was ignored. This PR fixes that by combining the caller’s signal with the timeout signal in callChatbotApi, so user cancel and timeout both abort the request.
Problem
callChatbotApi always used its own timeout AbortController, overwriting the caller’s options.signal.
Result: clicking Cancel didn’t abort text requests; they ran until completion or timeout.

Solution
Respect the caller’s options.signal.
Combine it with the timeout using AbortSignal.timeout() and AbortSignal.any().
Pass the combined (or timeout-only) signal to fetch so Cancel and timeout both work.

Changes

callChatbotApi.ts: Combine caller + timeout signals, pass to fetch, use strict AbortError check, remove manual timers.
callChatbotApi.test.ts: Add test to verify abort on caller signal.

Testing

Unit tests pass, including cancel test.

Fixes: #135

Signed-off-by: Divyansh Rai <140232173+divyansh-cyber@users.noreply.github.com>
@divyansh-cyber divyansh-cyber requested a review from a team as a code owner February 3, 2026 17:21
@divyansh-cyber
Copy link
Copy Markdown
Contributor Author

@berviantoleo all checks have passed,Is there anything else you'd like me to adjust

@berviantoleo berviantoleo added the bug For changelog: Minor bug. Will be listed after features label Feb 4, 2026
@berviantoleo berviantoleo requested a review from cnu1812 February 4, 2026 09:14
@cnu1812 cnu1812 merged commit 6da7a32 into jenkinsci:main Feb 4, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants