You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve PDF cancellation during page lookup and cleanup #531
PDF knowledge-base extraction now receives the cancellation signal, but two edge cases remain: cancellation during page lookup can still start text extraction, and a cleanup error can replace the caller's abort reason.
What is fixed
#1529 propagated the signal into PDF extraction and added checks after document loading and between page operations. The original claim that the signal never reaches extractPdf() is no longer current.
Remaining cases
Cancellation while getPage() is pending
If the caller aborts after the loop's initial check but before getPage() resolves, the current extraction loop proceeds to getTextContent() before checking again. Work can start after cancellation is already known.
Expected: check the signal after page lookup and before starting text extraction.
Cleanup replaces the abort reason
The finally block awaits loadingTask.destroy(). If extraction has already thrown the caller's abort reason and destroy() also rejects, the cleanup error replaces the original cancellation.
Expected: attempt cleanup while preserving the caller's cancellation reason. Cleanup errors outside a cancellation still need their normal handling.
Validation
Use controlled PDF-loader promises to abort during page lookup and assert that text extraction never starts. Separately make cleanup reject after an abort and assert that the caller receives the original abort reason.
#532 remains open and addresses both cases. The 17 October follow-up reproduced these gaps after the initial signal-propagation fix.
#1529 addressed the basic cancellation case, but I reproduced two remaining gaps: cancellation during page lookup still starts text extraction, and a cleanup error can replace the cancellation reason. Keeping this open for #532, which fixes both.
changed the title [-]Knowledge-base cancellation is ignored once PDF extraction starts[/-][+]Preserve PDF cancellation during page lookup and cleanup[/+]on Oct 19, 2026
I reproduced this on main. Canceling during page lookup still started text extraction, and a cleanup failure could hide the reason the caller canceled. I also found that canceling while a blank PDF finished closing could surface a misleading “no extractable text” error.
I updated #532 to cover that last case too. The tests now check all three through both SDK entry points, along with what happens when cleanup fails without a cancellation.
The focused cases passed on Linux and Windows. I also ran the full SDK suite twice on Linux. Both runs passed 7,183 tests, with 108 skipped and no failures.
Activity
mldangelo-oai commentedon Oct 8, 2026
#939 and #1103 also pass cancellation through PDF extraction and check it between pages. Both are still open.
mldangelo-oai commentedon Oct 17, 2026
#1529 addressed the basic cancellation case, but I reproduced two remaining gaps: cancellation during page lookup still starts text extraction, and a cleanup error can replace the cancellation reason. Keeping this open for #532, which fixes both.
[-]Knowledge-base cancellation is ignored once PDF extraction starts[/-][+]Preserve PDF cancellation during page lookup and cleanup[/+]mldangelo-oai commentedon Oct 25, 2026
I reproduced this on
main. Canceling during page lookup still started text extraction, and a cleanup failure could hide the reason the caller canceled. I also found that canceling while a blank PDF finished closing could surface a misleading “no extractable text” error.I updated #532 to cover that last case too. The tests now check all three through both SDK entry points, along with what happens when cleanup fails without a cancellation.
The focused cases passed on Linux and Windows. I also ran the full SDK suite twice on Linux. Both runs passed 7,183 tests, with 108 skipped and no failures.
fix(knowledge): honor cancellation during PDF extraction (#532)