Skip to content

fix(mcp): Make link_issue fail early with actionable errors - #2852

Open
sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/link-issue-actionable-errors
Open

sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/link-issue-actionable-errors

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

link_issue fails on about 18% of calls. Most failures are setup problems that agents can't fix by retrying, but the errors didn't say that, so agents kept retrying.

Over the last 7 days of mcp.server spans for link_issue, the top failure results were:

Result Calls Users
No active issue integration matches this URL ~610 ~100
Provide an unambiguous value for App link field 'issueId' ~500 10 (one org made most of them)
Expected one installed Sentry App 'linear' ~270 ~40
App link 409 conflict (canonical URL) ~210 ~33

Changes:

  • Native URL with no matching integration. The error now names the provider the URL belongs to (GitHub, Jira, GitLab, Bitbucket, Azure DevOps) and links to that provider's page under organization settings. If the org has integrations for that provider but none of them covers the URL, the error lists them. Jira and GitHub links succeed for about 90% of their calls, so the matcher itself works. These failures come from orgs without the integration.
  • Sentry App not installed. The error now says the App isn't installed in the organization and links to settings/sentry-apps/<slug>/.
  • Identifier-only Linear URLs (https://linear.app/<ws>/issue/ENG-123). These are now rejected before the App callback runs. The error tells the agent to use the full URL with the title slug. The backend's expectedExternalIssueUrl guard (IssueLinkCreator._verify_expected_url) compares the webUrl that Linear returns with an exact string match, and Linear always adds a title slug. So these calls always ended in a 409, after Linear's callback had already run. In the last 7 days no identifier-only Linear URL created a new link. They only succeeded when an equivalent link already existed. That path still works, because the guard then uses the stored URL.
  • App issue search with no match. The error now says the search found nothing for that issue and that retrying won't help. Before, it asked for an "unambiguous value", which read as a request to try again with different input.
  • The externalIssueUrl description now says Linear URLs need the title slug.

Accepting identifier-only Linear URLs end to end would need either the backend guard to compare issue identity instead of the exact URL, or the App's search to return the canonical URL. Both are outside this repo.

Not addressed here: native 409 lock contention ("This issue link is being updated", ~200 calls from 9 users, from parallel links to the same external issue), and 404s from sentry-app-installations for users the backend doesn't treat as org members.

via @dcramer.

--

View Session [Sentry]

@sentry-junior
sentry-junior Bot requested a review from a team as a code owner December 3, 2026 17:52
@sentry-junior
sentry-junior Bot requested a review from dcramer December 3, 2026 17:52
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cli Ready Ready Preview Dec 3, 2026 6:10pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 3, 2026 6:10pm UTC

Request Review

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

📊 MCP Server Token Cost Report

Summary

  • Total Tokens: 71213 tokens
  • Tool Count: 78 tools
  • Average: 913 tokens/tool

Per-Tool Breakdown

Tool Tokens % of Total
get_issue_details 4049 5.7%
get_alert_rule 2245 3.2%
search_logs 1837 2.6%
search_metrics 1836 2.6%
search_traces 1835 2.6%
find_releases 1805 2.5%
get_issue_activity 1759 2.5%
update_alert_rule 1653 2.3%
get_replay_details 1602 2.2%
create_alert_rule 1506 2.1%
get_monitor_details 1501 2.1%
update_metric_monitor 1479 2.1%
create_metric_monitor 1458 2%
update_issue 1394 2%
get_event_stacktrace 1381 1.9%
render_sentry_chart 1362 1.9%
get_snapshot 1308 1.8%
get_profile 1291 1.8%
get_agent_conversation_details 1278 1.8%
find_monitors 1261 1.8%
get_alert_options 1236 1.7%
search_profiles 1228 1.7%
search_errors 1214 1.7%
get_profile_details 1203 1.7%
find_related_issues 1171 1.6%
get_uptime_monitor_details 1163 1.6%
render_issue_chart 1141 1.6%
create_monitor 1135 1.6%
onboarding_status_update 1109 1.6%
search_issue_events 1103 1.5%
search_replays 1095 1.5%
get_release_details 1056 1.5%
get_dashboard_details 1052 1.5%
search_attributes 1012 1.4%
search_issues 977 1.4%
search_docs 973 1.4%
find_alert_rules 908 1.3%
update_uptime_monitor 873 1.2%
create_uptime_monitor 871 1.2%
search_agent_conversations 830 1.2%
find_dropped_events 819 1.2%
get_metric_monitor_details 797 1.1%
create_project 793 1.1%
update_dsn 765 1.1%
get_issue_user_reports 630 0.9%
get_latest_base_snapshot 623 0.9%
find_dashboards 553 0.8%
link_issue 553 0.8%
find_uptime_monitors 537 0.8%
get_issue_breadcrumbs 492 0.7%
unlink_issue 484 0.7%
find_metric_monitors 471 0.7%
get_issue_tag_values 469 0.7%
find_project_members 448 0.6%
update_project 441 0.6%
get_sentry_resource 429 0.6%
submit_feedback_to_sentry_team 426 0.6%
add_issue_note 404 0.6%
delete_monitor_environment 363 0.5%
find_teams 351 0.5%
find_projects 346 0.5%
delete_alert_rule 345 0.5%
delete_uptime_monitor 333 0.5%
delete_metric_monitor 331 0.5%
create_dsn 326 0.5%
add_team_to_project 324 0.5%
remove_team_from_project 320 0.4%
find_dsns 319 0.4%
find_organizations 311 0.4%
get_snapshot_image 302 0.4%
analyze_issue_with_seer 300 0.4%
get_event_attachment 299 0.4%
get_trace_details 282 0.4%
create_team 266 0.4%
get_span_details 263 0.4%
whoami 261 0.4%
get_sentry_mcp_info 142 0.2%
get_doc 102 0.1%

Note: This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better.

MCP Apps views

Each ui:// view as a host receives it from resources/read.

View MIME type Raw Gzip Brotli Budget % of budget
ui://sentry/chart/v6.html text/html;profile=mcp-app 19,249 B 7,913 B 7,014 B 24,576 B 78.3%

The budget applies to raw bytes, and the view's generator fails over it.

sentry-junior Bot and others added 2 commits December 3, 2026 18:09
link_issue failures were mostly setup problems that agents could not fix by
retrying, and the errors did not say what to do:

- A native URL with no matching integration now names the provider and links
  to its integration settings page, or lists the installed integrations of
  that provider that do not cover the URL.
- A Sentry App that is not installed now says so and links to the App's
  settings page.
- An identifier-only Linear URL (no title slug) is rejected before the App
  callback runs. Sentry requires the URL Linear returns to match
  expectedExternalIssueUrl exactly, so these calls always ended in a 409
  after Linear had already acted. An equivalent stored link still guards
  with its stored URL.
- An App issue search with no match now says the search found nothing
  instead of asking for an unambiguous field value.

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
main was 0.8 KB under the 3.77 MiB budget, and the link_issue error
messages add about 2.5 KB. The new budget leaves about 8.5 KB again.

This branch was successfully deployed

2 active and 1 inactive deployments
Preview – cli — b7b0b5c7 Deployed Dec 3, 2026 by vercel[bot]
Actions — b7b0b5c7 Deployed Dec 3, 2026 by sentry-junior[bot] via eval #2220
Preview – sentry-local — b7b0b5c7 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant