Skip to content

MCP search places read their limits from settings - #1871

Merged
zlareb1 merged 4 commits into
mainfrom
fix/code-search-places-settings-20261201
Dec 1, 2026
Merged

zlareb1 merged 4 commits into
mainfrom
fix/code-search-places-settings-20261201

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Related: #1679

Changelog category

  • CI Fix or Improvement

Changelog entry

None.

Why

The unit gate rejects three search place limits in server/transport/code_lean.py. It fails with the same three constants on clean main and on the merge tree for the related pull request.

Scope and risk

MCP search places read the default reply budget, leading-source line cap and query word cap from the settings catalog. The defaults remain 600 tokens, 30 lines and 32 words. A request's explicit token_budget still takes precedence.

Compatibility, rollout and rollback

  • Wire fields and defaults are unchanged.
  • The settings reference documents the three optional LOOM_CODE_SEARCH_PLACES_* settings. No action is needed for the existing defaults.
  • Reverting restores the fixed limits. Remove any overrides for these settings before reverting.

Tests

  • test_no_new_tunable_constant fails before the change on clean main and the related merge tree, and passes with this change.
  • 332 focused tests pass across the search place, tunable constant, feature inventory, settings defaults, documentation link and public copy suites. The inventory check fails without the query word limit test and passes with it.
  • Both settings-defaults tests pass with the regenerated snapshot.
  • make format-check, make lint and make typecheck pass.

AI assistance in the code

  • AI-generated with Codex. The agent reproduced the failure, reviewed the diff and ran the checks above.

Checklist

  • Local format, lint, type checks and focused tests pass.
  • The settings reference, schema, example and default snapshot were regenerated.
  • The description records configuration and rollout details.
  • The commit is signed off.

Note

Low Risk
Behavior-preserving refactor with unchanged defaults; only adds optional operator overrides for search-place sizing.

Overview
Replaces three hardcoded limits in MCP search places formatting (code_lean.py) with settings-backed values so they can be tuned and satisfy the tunable-constant gate.

code_search_places_token_budget (default 600) is the default reply token target when the request omits token_budget. code_search_places_source_max_lines (default 30) caps the leading place’s full body. code_search_places_query_max_words (default 32, minimum 1) limits distinct query words used for matching-line selection. Per-request token_budget still overrides the default.

Settings are wired through the catalog, JSON schema, example YAML, and configuration reference; the defaults snapshot and unit tests (including a new test for the query-word cap) use the settings fields instead of module constants.

Reviewed by Cursor Bugbot for commit b208525. Bugbot is set up for automated code reviews on this repo. Configure here.

The unit gate rejects operator limits declared as module constants.
Put the reply budget, source line cap and query word cap in the
settings catalog and retain their defaults.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 1, 2026 2:43am UTC
loom-telemetry Ready Ready Preview Dec 1, 2026 2:43am UTC

Request Review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 64cca9e. Configure here.

Comment thread server/settings/catalog.py Resolved
Record the three catalog defaults so the settings gate detects future
changes to them.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The feature inventory requires a test for the setting. A search with two matching words checks that lowering the limit keeps only the longer match.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The source limit controls the full body. A single place and cursor pages can exceed the reply's token target.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 merged commit 8caaafb into main Dec 1, 2026
86 of 87 checks passed
ZYZ666-RGB added a commit to ZYZ666-RGB/loom that referenced this pull request Dec 1, 2026
…a-delta

Picks up ClickHouse#1871, which moved MCP places limits into settings so
test_no_new_tunable_constant no longer fails on this branch.

Signed-off-by: yuzhou <1991039819@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant