Skip to content

Disable the AI function per-query quotas by default - #121424

Merged
george-larionov merged 2 commits into
masterfrom
ai-functions-disable-quotas-by-default
Sep 22, 2026
Merged

george-larionov merged 2 commits into
masterfrom
ai-functions-disable-quotas-by-default

Conversation

@george-larionov

@george-larionov george-larionov commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Related: #111286
Related: #114885

Disable the AI function per-query quotas by default. Used to be:
ai_function_max_input_tokens_per_query at 1000000, ai_function_max_output_tokens_per_query
at 500000, and, since 26.8, ai_function_max_api_calls_per_query at 1000.

All three settings now default to 0, which AIQuotaTracker already treats as "no limit", so
no enforcement logic changed. Setting any of them to a non-zero value enables that quota exactly
as before, and compatibility = '26.9' restores the previous defaults.

Changelog category (leave one):

  • Improvement

Changelog entry:

The AI function per-query quotas are now disabled by default: ai_function_max_input_tokens_per_query (previously 1000000), ai_function_max_output_tokens_per_query (previously 500000) and ai_function_max_api_calls_per_query (previously 1000) default to 0, meaning no limit. To keep the previous caps, set the three settings explicitly or use compatibility = '26.9'.


Workflow [PR]
Sync PR [sync-upstream/pr/121424]

Version info

  • Merged into: 26.10.1.430-master (included in 26.10 and later)
  • Backported to: 26.9.3.34, 26.8.11.42, 26.7.14.42

george-larionov and others added 2 commits September 21, 2026 20:03
`ai_function_max_input_tokens_per_query`, `ai_function_max_output_tokens_per_query`
and `ai_function_max_api_calls_per_query` now default to 0, which means no limit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [240bc03]

Summary: ✅


AI Review

Summary

This PR disables the three AI-function per-query quota defaults by setting them to 0, records the 26.10 compatibility rollback, and updates the default-value tests. The implementation matches the existing AIQuotaTracker semantics, but the regression coverage only proves the ai_function_max_api_calls_per_query rollback; the two token-quota rollbacks are still untested, so the compatibility contract is not fully evidenced yet.

Tests
  • ⚠️ [tests/queries/0_stateless/04628_ai_functions_compatibility_defaults.sql:31] The PR promises compatibility = '26.9' restores the previous defaults for all three quota settings, but the stateless test only asserts ai_function_max_api_calls_per_query. Extend the getSetting checks and reference output to cover ai_function_max_input_tokens_per_query and ai_function_max_output_tokens_per_query under compatibility = '26.9'.
Final Verdict
  • Status: ⚠️ Request changes
  • Extend the compatibility regression test to assert the input and output token quota defaults, not just the API-call quota.

LLVM Coverage Report

Measured on commit 240bc03.

Metric Baseline Current Δ
Lines 88.00% 88.00% +0.00%
Functions 91.70% 91.70% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 27/27 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Sep 21, 2026
@rschu1ze rschu1ze self-assigned this Sep 21, 2026

SELECT '-- compatibility = 26.9 restores the API call quota';
SET compatibility = '26.9';
SELECT getSetting('ai_function_allow_insecure_endpoint'), getSetting('ai_function_max_api_calls_per_query'), getSetting('ai_function_max_retries');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check only asserts ai_function_max_api_calls_per_query, but this PR also flips ai_function_max_input_tokens_per_query and ai_function_max_output_tokens_per_query to 0, and the PR description promises compatibility = '26.9' restores the previous caps for all three settings. A typo or missing history row for either token quota would still pass CI. Please extend the getSetting assertion/reference here to cover both token quota settings under compatibility = '26.9'.

@clickhouse-gh

clickhouse-gh Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 240bc0322 with master e033cea64 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

8 translation units recompiled, 20 s compile time in total, 8 of them have a recent master baseline.

Job report

@george-larionov
george-larionov added this pull request to the merge queue Sep 22, 2026
Merged via the queue into master with commit aa5872d Sep 22, 2026
177 checks passed
@george-larionov
george-larionov deleted the ai-functions-disable-quotas-by-default branch September 22, 2026 14:18
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 22, 2026
@george-larionov george-larionov added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Sep 22, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 22, 2026
robot-ch-test-poll added a commit that referenced this pull request Sep 23, 2026
Cherry pick #121424 to 26.8: Disable the AI function per-query quotas by default
robot-clickhouse added a commit that referenced this pull request Sep 23, 2026
robot-ch-test-poll added a commit that referenced this pull request Sep 23, 2026
Cherry pick #121424 to 26.9: Disable the AI function per-query quotas by default
robot-clickhouse added a commit that referenced this pull request Sep 23, 2026
george-larionov added a commit that referenced this pull request Sep 24, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
robot-clickhouse-ci-2 added a commit that referenced this pull request Sep 24, 2026
Cherry pick #121424 to 26.7: Disable the AI function per-query quotas by default
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 24, 2026
george-larionov added a commit that referenced this pull request Sep 24, 2026
Drop the leaked `26.10` and `26.9` blocks; record the changes in the `26.8` block.
`ai_function_max_api_calls_per_query` no longer changes in 26.8, so its entry is removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
george-larionov added a commit that referenced this pull request Sep 24, 2026
Drop the leaked `26.10` block; record the changes in the `26.9` block.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
clickhouse-gh Bot added a commit that referenced this pull request Sep 25, 2026
Backport #121424 to 26.8: Disable the AI function per-query quotas by default
PedroTadim added a commit that referenced this pull request Sep 25, 2026
Backport #121424 to 26.7: Disable the AI function per-query quotas by default
clickhouse-gh Bot added a commit that referenced this pull request Sep 25, 2026
Backport #121424 to 26.9: Disable the AI function per-query quotas by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-improvement Pull request with some product improvements pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants