feat(mcp): route hosted AI through OpenRouter with gpt-5.6-luna@medium - #1213
Open
sentry-junior[bot] wants to merge 6 commits into
Open
feat(mcp): route hosted AI through OpenRouter with gpt-5.6-luna@medium#1213sentry-junior[bot] wants to merge 6 commits into
sentry-junior[bot] wants to merge 6 commits into
Conversation
Move the Cloudflare chat playground off the hardcoded OpenAI gpt-4o path onto the shared OpenRouter provider, and bump the OpenRouter default model to openai/gpt-5.5 so hosted agents and chat use the same modern model. Co-Authored-By: David Cramer <david@sentry.io>
Switch the shared OpenRouter default from gpt-5.5 to the cheaper gpt-5.6-luna tier and send reasoningEffort=high for agents and chat. Effort remains overridable via OPENROUTER_REASONING_EFFORT. Co-Authored-By: David Cramer <david@sentry.io>
dcramer
marked this pull request as ready for review
July 29, 2026 22:43
High reasoning effort spends completion budget before visible text or tool calls. Bump the playground cap so luna@high does not truncate.
Luna agents are schema-constrained NL→query hops, not long-horizon coding. Start at OpenRouter's medium default and keep OPENROUTER_REASONING_EFFORT for a no-deploy bump if quality dips. Co-Authored-By: David Cramer <david@sentry.io>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cc5b0a2. Configure here.
@ai-sdk/openai only accepts none/minimal/low/medium/high/xhigh. Reject unknown OPENROUTER_REASONING_EFFORT values early, map max→xhigh, and document empty string as omit-provider-option rather than disable.
Use a null-prototype alias map and Object.hasOwn so prototype keys like constructor cannot bypass validation and leak a function into provider options.
2 tasks
HazAT
added a commit
that referenced
this pull request
Jul 31, 2026
## Summary
Moves the eval CI job and eval harness off a direct OpenAI key onto
OpenRouter, so GitHub Actions no longer needs `OPENAI_API_KEY` for
evals.
## Changes
- `.github/workflows/eval.yml` now injects `OPENROUTER_API_KEY` and
`EMBEDDED_AGENT_PROVIDER=openrouter`
- eval scorers/task runners default to `getOpenRouterModel()` instead of
hardcoding `openai("gpt-4o")`
- MSW unhandled-request filters also allow `openrouter.ai` traffic
during evals
- docs/comments updated to mention `OPENROUTER_API_KEY`
## Follow-up
- Ensure the Actions environment has an `OPENROUTER_API_KEY` secret
before relying on eval CI results
- Hosted Cloudflare chat OpenAI usage is covered separately by #1213
## Test plan
- [x] `pnpm --filter @sentry/mcp-server-evals exec tsc -b --force`
- [x] After secret is set, confirm Eval workflow can call OpenRouter
successfully
<!-- junior-request-attribution:start -->
Requested by **Daniel Griesser**.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC08J1NSPU6S%3A1785497651.998319 -->
--
[View Junior
Session](https://junior-prod.sentry.dev/conversations/slack%3AC08J1NSPU6S%3A1785497651.998319)
[Sentry](https://sentry.sentry.io/explore/conversations/slack%3AC08J1NSPU6S%3A1785497651.998319/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Daniel Griesser <dgriesser@sentry.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Route hosted MCP AI through OpenRouter and default to
openai/gpt-5.6-lunawithreasoningEffort=medium.Key Changes
gpt-4o→ shared OpenRouter provideropenai/gpt-5→openai/gpt-5.6-lunamedium(override withOPENROUTER_REASONING_EFFORT)maxOutputTokens:2000→16000so reasoning does not starve text/tool outputOPENROUTER_*+EMBEDDED_AGENT_PROVIDERWhy
Prod is moving off a direct OpenAI key onto OpenRouter. Luna@medium is the cheap/fast GPT-5.6 tier at OpenRouter's own default effort — enough for schema-constrained NL→Sentry query agents without the latency/cost of always-on high. We can bump effort or model via env if quality dips.
Deploy notes
After merge, hosted worker should have:
OPENROUTER_API_KEYEMBEDDED_AGENT_PROVIDER=openrouterOPENROUTER_MODEL=openai/gpt-5.6-luna(also the code default)OPENROUTER_REASONING_EFFORT=medium(also the code default; sethighwithout redeploy if needed)OPENAI_API_KEYcan be removed once this is liveHow we'll measure
callEmbeddedAgent, LLM provider failures,NoObjectGeneratedErrorrescues)search_events/search_issues/search_issue_events(7d baseline ~11–12% on agent trio)444138(global tool failure rate, critical 18%)Risks / follow-ups
OPENROUTER_API_KEYEMBEDDED_AGENT_PROVIDER, provider selection still errors by designChecks run
vitest run packages/mcp-core/src/internal/agents/openrouter-provider.test.ts(pass)Requested by David Cramer via Junior.
--
View Junior Session