Skip to content

fix(server): bound the query of a remote document search - #1778

Merged
ajianaz merged 1 commit into
developfrom
fix/doc-search-query-cap
Nov 14, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/doc-search-query-cap

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

What

A remote document search (POST /doc/search, MCP uteke_doc_search) now refuses a query longer than 2000 characters, in every mode, with a 400 (an MCP tool error) before an embedding slot is taken. The bound is the one of a remote skill search (MAX_QUERY_CHARS). New EmbedNeed::for_doc_search(query, mode) in remote_guard returns the bound check and the embed need together; the router and the MCP tool use it. CHANGELOG [Unreleased] entry.

Why

Found in the v0.24.0 release review: the query had no length bound, so a client could send up to the 10 MB request limit and have it embedded under a slot. POST /doc/search is LAB, so there is no contract change; the CLI is unchanged.

Testing

  • New tests: remote_guard (at the bound and one over in fts, hybrid and semantic, multibyte characters count once, exact error text), HTTP POST /doc/search (400 with the exact message in all three modes, 200 at the bound) and MCP uteke_doc_search (same).
  • Full uteke-server and uteke-mcp test suites pass locally, and cargo clippy -p uteke-core -p uteke-server -p uteke-mcp --all-targets -- -D warnings and cargo fmt are clean.
  • CI on the PR: all 15 checks green and Cora "No issues found".

Closes #1777

POST /doc/search and uteke_doc_search took a query of any length and embedded it under a slot. The query is now at most 2000 characters in every mode (the bound of a remote skill search), refused before the slot is taken.

Closes #1777
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 882f748 into develop Nov 14, 2026
18 checks passed
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.

fix(server): bound the query of a remote document search

1 participant