Repository navigation
Stop AI functions mid-block on KILL QUERY and max_execution_time - #125698
Conversation
`AIQuotaTracker` checks the query status before each request and retry. Split out of #122484. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [582e356] Summary: ✅
AI ReviewSummaryThe PR checks query cancellation and time limits through the shared Missing context / blind spots
Findings
Final VerdictStatus: |
| """With `timeout_overflow_mode = 'break'` the query returns without an error once the time limit is | ||
| reached, and no further requests are sent.""" | ||
| _reset_concurrency() | ||
| instance.query( |
There was a problem hiding this comment.
TIMEOUT_EXCEEDED in the break regression test
Once the two-second limit expires inside this 400-row block, QueryStatus::checkTimeLimit returns false and the new AIQuotaTracker::throwIfCancelled explicitly throws TIMEOUT_EXCEEDED. That check runs outside the provider retry handler, and PipelineExecutor propagates the exception; instance.query therefore raises before the request-count assertion. This test cannot pass on the mid-block timeout path it is meant to cover.
Use instance.query_and_get_error, assert that the error contains TIMEOUT_EXCEEDED, and update the docstring to match the deliberate scalar-function behavior described in the PR. Keep the request-count assertion so the test still proves that no further provider calls are issued.
There was a problem hiding this comment.
The test is correct; it passes in CI and locally. The TIMEOUT_EXCEEDED thrown from AIQuotaTracker::throwIfCancelled is caught in ISimpleTransform::work and pushed to the output port. By then PullingAsyncPipelineExecutor has already cancelled the pipeline with CancelledByTimeout, so the exception is never pulled downstream, and the query finishes as a regular break result. Locally: QueryFinish, exception_code 0, AIAPICalls = 4 of 400.
Keep only the `ai_slow` collection from #125698; drop `ai_mock_no_structured_output`, which comes from a master-only change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep only the `ai_slow` collection from #125698; drop `ai_mock_no_structured_output`, which comes from a master-only change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry pick #125698 to 26.8: Stop AI functions mid-block on `KILL QUERY` and `max_execution_time`
… and `max_execution_time`
Cherry pick #125698 to 26.9: Stop AI functions mid-block on `KILL QUERY` and `max_execution_time`
… and `max_execution_time`
Backport #125698 to 26.9: Stop AI functions mid-block on `KILL QUERY` and `max_execution_time`
Backport #125698 to 26.8: Stop AI functions mid-block on `KILL QUERY` and `max_execution_time`
Related: #122484
An AI function sends its provider requests row by row within a block, and nothing checked the query status between requests.
KILL QUERYandmax_execution_timeonly took effect at the next block boundary, after every row in the block had its request and retries finish.AIQuotaTrackernow checks the query status incheckQuotasandrecordApiCall, i.e. before each request and each retry. Undertimeout_overflow_mode = 'break'it throwsTIMEOUT_EXCEEDEDas well, because a function cannot return fewer rows than it received. The pipeline is already cancelled by the time limit at that point, so the exception is dropped and the query returns a partial result, as usual forbreak.Split out of #122484.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
KILL QUERYandmax_execution_time(includingtimeout_overflow_mode = 'break') now stop AI functions in the middle of a block, instead of only after all requests for the block have finished.Workflow [PR]
Sync PR [sync-upstream/pr/125698]
Version info
26.10.1.2414-master(included in26.10and later)26.9.26.25,26.8.35.22