Skip to content

Test mistral-support spans and replace exact pins with minimum versions - #32

Merged
sergical merged 3 commits into
mainfrom
mistral-version-ranges
Nov 18, 2026
Merged

sergical merged 3 commits into
mainfrom
mistral-version-ranges

Conversation

@sergical

@sergical sergical commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

The example pinned @sentry/node 11.0.0 and @mistralai/mistralai 2.7.0. Sentry traces Mistral 3.x only from 11.11.0 (getsentry/sentry-javascript#25827). A reader who upgrades Mistral alone gets no model spans and no warning. This PR makes that kind of drift fail in CI instead of in a reader's terminal.

  • package.json sets minimums (^11.11.0, ^3.0.0). The lockfile keeps the tested combination, so pnpm install still gives readers a known-good setup.
  • spans.test.ts runs the example's real answer() and the optional tracing.ts helpers against a mocked Mistral API. It needs no API keys. It fails if the model, agent, or tool spans that the README describes are missing.
  • The mistral-support workflow runs typecheck, lint, and the test on changes. Each Monday it repeats them with pnpm update --latest and opens an issue if they fail, so a new major version of either SDK shows up here first.
  • Dependabot refreshes only the lockfile each week, so the minimums in package.json stay meaningful.
  • The execute_tool span now sets gen_ai.agent.name, which the agent tracing docs say it should.
  • pnpm-workspace.yaml is removed. It only exempted the 11.0.0 packages from pnpm's release-age gate.

The test catches the original problem and passes at the new minimums:

@sentry/node 11.14.0 + mistral 3.5.0 (lockfile)  ✔ ✔  pass 2, fail 0
@sentry/node 11.11.0 + mistral 3.0.0 (minimums)  ✔ ✔  pass 2, fail 0
@sentry/node 11.0.0  + mistral 3.5.0 (old pin)   ✖ the Mistral integration traces the tool request and the streamed reply
                                                   expected 2 gen_ai.chat spans

Live run. I ran @sentry/node 11.13.0 with Mistral SDK 3.5.0, the lockfile versions before the 11.14.0 refresh, through recipe steps 1–8, sending to a scratch Sentry project. The SDK's requests went to OpenRouter's mistralai/mistral-small-2603 model, because no direct Mistral key was available, and the example code was otherwise unchanged.

  • Basic setup: the answers were "shipped … Thursday" and "Kettle". 4 gen_ai.chat spans arrived with conversation ID 6dffaf67…, including prompts, tool definitions, tool calls, streamed output and tokens.
  • With tracing.ts connected: 3 invoke_agent Order Support turns, 5 gen_ai.chat spans and 3 execute_tool lookup_order spans arrived. Each tool span has gen_ai.agent.name: Order Support.
  • The /fail turn: its tool span and agent span have status error, and no second model call runs. The issue "Order service unavailable (demo)" has culprit lookupOrder(orders.ts) and links to that tool span's trace. The retry answered "processing … next week".

One known SDK bug is still present in 11.13.0: the http.client span of every streaming call has status error with HTTP 200, while the gen_ai.chat spans are ok. The example adds no workaround.

Not verified: a call to Mistral's own API, and Dependabot's handling of this pnpm 12 lockfile. CI on this PR is the workflow's first run on GitHub, and it passed.

Related: getsentry/sentry-docs (Mistral 3.x supported range), getsentry/static-sites and mistralai/cookbook (recipe text and snippet sync). Links follow in comments.

The example pinned @sentry/node 11.0.0 and @mistralai/mistralai 2.7.0.
Sentry traces Mistral 3.x only from 11.11.0, so upgrading Mistral alone
silently removed every model span.

- package.json sets minimums (^11.11.0, ^3.0.0); the lockfile keeps the
  tested combination.
- spans.test.ts runs the example against a mocked Mistral API and fails
  when the model, agent or tool spans disappear.
- CI runs the test on changes and weekly against the latest releases.
- Dependabot refreshes the lockfile weekly.
- execute_tool sets gen_ai.agent.name, as the agent tracing docs advise.

Co-authored-by: Claude <[email protected]>
@sergical

Copy link
Copy Markdown
Member Author

Related drafts:

sergical and others added 2 commits November 18, 2026 11:50
Without these checks, an SDK change that dropped the model input or tool
definitions from the spans would still pass.

Co-authored-by: Claude <[email protected]>
@sergical
sergical marked this pull request as ready for review November 18, 2026 23:49
@sergical
sergical merged commit d9c0ac3 into main Nov 18, 2026
13 checks passed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a820e71. Configure here.

run: |
if [ -z "$(gh issue list --state open --search "in:title \"$TITLE\"" --json number --jq '.[].number')" ]; then
gh issue create --title "$TITLE" --label sentry-sdk --body "The weekly check against the latest versions failed: $RUN_URL"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issue create fails without label

Medium Severity

The weekly latest job files a GitHub issue with --label sentry-sdk, but nothing in this repository defines or creates that label. gh issue create fails when a requested label is missing, so a scheduled SDK-breakage run would stay failed without opening the issue that job exists to file.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a820e71. Configure here.

sergical added a commit to getsentry/sentry-docs that referenced this pull request Nov 19, 2026
## DESCRIBE YOUR PR

The Mistral integration page lists `@mistralai/mistralai` `>=2.0.0 <3`.
The SDK has accepted `>=2.0.0 <4` since 11.11.0
(getsentry/sentry-javascript#25827; `versionRange` in
`packages/server-utils/src/orchestrion/config/mistral.ts`). Readers on
Mistral 3.x are told they are unsupported. The page also did not say
that 3.x needs 11.11.0, while its header says only "Requires SDK version
11.0.0".

Evidence: with Mistral 3.5.0, `@sentry/node` 11.11.0 and 11.13.0 produce
both `gen_ai.chat` spans, and 11.0.0 produces none. See the span test in
getsentry/sentry-agent-tracing-examples#32.

## IS YOUR CHANGE URGENT?

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

## PRE-MERGE CHECKLIST

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

Co-authored-by: Claude <[email protected]>
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.

1 participant