bug(tools): delayed background output reads ignore cancellation
What happened?
ReadBackgroundOutputInvocation ignores its AbortSignal. Its delay_ms option uses an unconditional setTimeout promise, then continues with process lookup and file reads even after cancellation.
Reproduction: invoke read_background_output with delay_ms=300 and abort its signal after 20 ms. The actual tool still waits roughly 300 ms and returns the fixture log successfully. A long requested delay can therefore keep the underlying invocation running after cancellation.
What did you expect to happen?
An already-aborted signal should reject immediately, and cancelling during the delay should clear the timer and reject promptly with AbortError without reading the process log. Successful delayed reads should continue to work normally.
Client information
Windows, Node.js 22.19.0, npm 10.9.3, upstream main at cd1b45c. Reproduced by executing the actual tool/invocation classes with local fixture files or stubbed remote transport; no authenticated Gemini CLI session or live remote server was required.
Login information
Not applicable to the local reproductions.
Anything else we need to know?
A focused fix and regression tests are being prepared on the fork branch listed below. Could a maintainer triage this for community contribution and apply help wanted if appropriate?
Fork branch: Web4everyone32:codex/background-log-cancellation.
/assign
👋 @yuvrajangadsingh, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our contributing guidelines.
PR is up: #29977
cancelling now stops the wait right away (it reuses the existing abortable delay helper), and a call that is already cancelled returns without reading the log.
👋 @yuvrajangadsingh — it has been more than 7 days since you were assigned to this issue and we could not find a pull request ready for review.
To keep the backlog moving and ensure issues stay accessible to all contributors, we require a PR that is open and ready for review (not a draft) within 7 days of assignment.
We are automatically unassigning you so that other contributors can pick this up. If you are still actively working on this, please:
- Re-assign yourself by commenting
/assign. - Open a PR (not a draft) linked to this issue (e.g.
Fixes #29945) within 7 days so the automation knows real progress is being made.
Thank you for your contribution — we hope to see a PR from you soon! 🙏
/assign
👋 @yuvrajangadsingh, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our contributing guidelines.
👋 @yuvrajangadsingh — it has been more than 7 days since you were assigned to this issue and we could not find a pull request ready for review.
To keep the backlog moving and ensure issues stay accessible to all contributors, we require a PR that is open and ready for review (not a draft) within 7 days of assignment.
We are automatically unassigning you so that other contributors can pick this up. If you are still actively working on this, please:
- Re-assign yourself by commenting
/assign. - Open a PR (not a draft) linked to this issue (e.g.
Fixes #29945) within 7 days so the automation knows real progress is being made.
Thank you for your contribution — we hope to see a PR from you soon! 🙏
/assign
👋 @yuvrajangadsingh, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our contributing guidelines.
👋 @yuvrajangadsingh — it has been more than 7 days since you were assigned to this issue and we could not find a pull request ready for review.
To keep the backlog moving and ensure issues stay accessible to all contributors, we require a PR that is open and ready for review (not a draft) within 7 days of assignment.
We are automatically unassigning you so that other contributors can pick this up. If you are still actively working on this, please:
- Re-assign yourself by commenting
/assign. - Open a PR (not a draft) linked to this issue (e.g.
Fixes #29945) within 7 days so the automation knows real progress is being made.
Thank you for your contribution — we hope to see a PR from you soon! 🙏
/assign
👋 @prajwal-dn, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our contributing guidelines.