Skip to content

LCORE-1350: Add server url check#1231

Merged
tisnik merged 1 commit intolightspeed-core:mainfrom
asimurka:server_url_check
Feb 26, 2026
Merged

LCORE-1350: Add server url check#1231
tisnik merged 1 commit intolightspeed-core:mainfrom
asimurka:server_url_check

Conversation

@asimurka
Copy link
Contributor

@asimurka asimurka commented Feb 26, 2026

Description

This PR adds additional server url check and fixes obsolete docstring.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: N/A

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

  • Bug Fixes
    • Improved MCP integration header handling to ensure only configurations with valid server URLs are processed, preventing propagation of invalid settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Walkthrough

The pull request refines header construction logic in the responses utility module. MCP headers are now generated exclusively from tools that have both headers defined and a non-empty server URL. Additionally, documentation for a function parameter type is clarified.

Changes

Cohort / File(s) Summary
MCP Headers and Type Documentation
src/utils/responses.py
Modified _build_provider_data_headers to filter MCP tools by both headers presence and non-empty server URL. Updated extract_vector_store_ids_from_tools parameter documentation to clarify expected InputTool type.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'LCORE-1350: Add server url check' directly reflects the main change: adding a server URL check in the _build_provider_data_headers function.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/utils/responses.py (1)

186-190: Add a focused regression test for server URL gating.

The new filter on Line 189 is good, but this path should be covered with explicit tests (include/exclude cases for MCP tools with headers + empty/non-empty server_url) to avoid future regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/responses.py` around lines 186 - 190, Add a focused regression test
that verifies the server_url gating in the mcp_headers comprehension: exercise
cases where tools contain entries with type == "mcp" with headers present and
server_url non-empty (should be included in mcp_headers), with headers present
but server_url empty/None (should be excluded), and with non-mcp types (should
be excluded). Create tests that build a small list named tools matching the
structure used by the mcp_headers comprehension and assert the resulting
mcp_headers mapping contains only the expected tool.server_url -> tool.headers
pairs; include both include and exclude assertions to prevent regressions around
the tool.type, tool.headers, and tool.server_url checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/utils/responses.py`:
- Around line 186-190: Add a focused regression test that verifies the
server_url gating in the mcp_headers comprehension: exercise cases where tools
contain entries with type == "mcp" with headers present and server_url non-empty
(should be included in mcp_headers), with headers present but server_url
empty/None (should be excluded), and with non-mcp types (should be excluded).
Create tests that build a small list named tools matching the structure used by
the mcp_headers comprehension and assert the resulting mcp_headers mapping
contains only the expected tool.server_url -> tool.headers pairs; include both
include and exclude assertions to prevent regressions around the tool.type,
tool.headers, and tool.server_url checks.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca21850 and b9a08fd.

📒 Files selected for processing (1)
  • src/utils/responses.py

Copy link
Contributor

@tisnik tisnik left a comment

Choose a reason for hiding this comment

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

LGTM

@tisnik tisnik merged commit 4290fcd into lightspeed-core:main Feb 26, 2026
22 checks passed
@asimurka asimurka deleted the server_url_check branch February 27, 2026 12:40
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.

2 participants