Conversation
|
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughChat prompt extraction now supports messages represented as dictionaries or SDK models. A synchronous test checks legacy prompt attributes for dictionary-based system and user messages. ChangesMistral chat prompts
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change targets dictionary-based prompts, and the supplied test summary covers system and user roles and content. No actionable merge-blocking behavior risk is evident. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Dictionary-form prompts can now appear in recorded traces where they previously did not. Existing content-capture controls still apply, but deployments handling sensitive prompts should account for the wider capture. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
feat(instrumentation): ...orfix(instrumentation): ....What was wrong
The Mistral client accepts chat messages as plain dicts, and the Mistral SDK README uses that form:
In the default (legacy attributes) mode,
_set_input_attributesreadmessage.contentandmessage.role. A dict has neither attribute, so the first message raisedAttributeError.@dont_throwswallowed it, and the span had nogen_ai.prompt.N.contentat all. Only the hard-codedgen_ai.prompt.0.role = "user"was left. Prompts were recorded only when callers builtUserMessage/SystemMessageobjects.Fix
_set_input_attributesnow readscontentandrolefrom a dict message and falls back to the attributes for SDK models. The content goes through the existing_content_as_str, so a string is unchanged and a list of content chunks is serialised the same way completions already are.Tests
test_mistralai_chat_legacy_with_dict_messagesreuses the existingtest_mistralai_chat_legacy.yamlcassette, sends a system and a user message as dicts, and asserts both prompt roles and contents.assert None == 'You are a comedian'(1 failed, 26 passed)uv run pytest testsgives 27 passed;uv run ruff check .passesThis PR was prepared with AI assistance (Breken's agent). I reviewed the change and ran the tests above.
Summary by CodeRabbit