Skip to content

LCORE-1428: Address former MCP auth failure#1400

Merged
tisnik merged 2 commits intolightspeed-core:mainfrom
max-svistunov:lcore-1428-fix-mcp-auth-library-mode
Mar 25, 2026
Merged

LCORE-1428: Address former MCP auth failure#1400
tisnik merged 2 commits intolightspeed-core:mainfrom
max-svistunov:lcore-1428-fix-mcp-auth-library-mode

Conversation

@max-svistunov
Copy link
Contributor

Description

Re-enable 8 MCP auth e2e test scenarios in library mode that were skipped
due to LCORE-1428 (ASGI exception when passing authorization headers to MCP
servers via /query and /streaming_query in library mode).

The underlying issue was in the llama-stack library client's request pipeline,
which has since been fixed upstream. The library client now correctly preserves
the authorization field on MCP tool definitions when routing requests through
FastAPI endpoint wrappers.

Also increases the container health-check timeout in restart_container from
15s to 60s — library mode embeds llama-stack and takes ~45-60s to start,
which caused all MCP auth scenarios (which restart the container per scenario)
to time out.

Type of change

  • Bug fix
  • End to end tests improvement

Tools used to create PR

  • Assisted-by: Claude Opus 4.6
  • Generated by: Claude Opus 4.6

Related Tickets & Documents

  • Related Issue # LCORE-1428
  • Closes # LCORE-1428

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

  1. Build and start Docker library-mode stack:
    FAISS_VECTOR_STORE_ID=test-store OPENAI_API_KEY=$OPENAI_API_KEY docker compose -f docker-compose-library.yaml up -d --build

  2. Run MCP e2e tests in library mode:
    FAISS_VECTOR_STORE_ID=test-store E2E_DEPLOYMENT_MODE=library uv run behave --tags=-skip --tags=MCP -D dump_errors=true @tests/e2e/test_list.txt

  3. Results: 25 scenarios passed, 0 failed (including the 8 previously-skipped library-mode scenarios for file, kubernetes, client, and OAuth auth on both query and streaming_query endpoints).

    1 feature passed, 0 failed, 18 skipped
    25 scenarios passed, 0 failed, 153 skipped
    203 steps passed, 0 failed, 1208 skipped
    Took 0min 47.801s
    

Remove @skip-in-library-mode tags from 8 MCP auth e2e test scenarios
that were skipped due to an ASGI exception when passing authorization
headers to MCP servers in library mode.

The underlying issue was in the llama-stack library client's handling
of MCP tool authorization through the request pipeline. This has been
resolved in the current llama-stack dependency, which now correctly
preserves the authorization field on MCP tool definitions when routing
requests through the FastAPI endpoint wrappers in library mode.

Manual verification confirmed that both /query and /streaming_query
endpoints correctly pass Authorization headers to MCP servers in
library mode, matching the behavior of HTTP (server) mode.

Affected scenarios:
- File-based auth: query + streaming_query
- Kubernetes auth: query + streaming_query
- Client-provided auth: query + streaming_query
- OAuth auth: query + streaming_query
The MCP auth e2e scenarios restart the lightspeed-stack container with
different configurations per scenario. In library mode the container
embeds llama-stack and takes ~45-60 seconds to become healthy, but
wait_for_container_health only polled 3 times (15 seconds total).

Increase max_attempts from 3 to 12 (60 seconds) so library-mode
container restarts have enough time to pass the Docker healthcheck.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 25, 2026

Warning

Rate limit exceeded

@max-svistunov has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 431add24-7846-41cf-bdd5-a53800f76d47

📥 Commits

Reviewing files that changed from the base of the PR and between f5f0ed7 and 73c2216.

📒 Files selected for processing (2)
  • tests/e2e/features/mcp.feature
  • tests/e2e/utils/utils.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@max-svistunov
Copy link
Contributor Author

@jrobertboos As stated earlier, this wasn't a bug in our code. The ASGI exception was coming from the llama-stack library client itself (it wasn't handling MCP tool authorization properly correctly when running in library mode) -- the authorization field on MCP tools was getting lost.

This has been fixed in llama-stack, so this is no longer reproducable, all tests pass for me after the changes in this PR.

If you agree with this assessment, I'll ask Pavel for review & merge.

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

@jrobertboos
Copy link
Contributor

@max-svistunov that sounds good to me :). Just to confirm tho the failing e2e test is just because of flakey behavior right?

Copy link
Contributor

@jrobertboos jrobertboos 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 068411f into lightspeed-core:main Mar 25, 2026
23 of 24 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.

3 participants