Skip to content

fix(observability): redact wf.result in strict mode - #639

Draft
mistralai-nfau wants to merge 1 commit into
mainfrom
vibe/redact-wf-result-4fbb8c
Draft

mistralai-nfau wants to merge 1 commit into
mainfrom
vibe/redact-wf-result-4fbb8c

Conversation

@mistralai-nfau

Copy link
Copy Markdown
Contributor

Summary

  • Add "result" to DEFAULT_SENSITIVE_ATTRIBUTE_FRAGMENTS so AttributeRedactionPolicy masks wf.result (activity/workflow outputs) alongside wf.arguments when OTEL_REDACTION=strict
  • Previously, strict mode masked wf.arguments but exported wf.result unredacted — meaning the model reply masked on the chat span (gen_ai.output.messages) leaked in clear on the model-call activity's wf.result
  • Add regression test covering {"wf.arguments": "x", "wf.result": "x"} → both [REDACTED]

Bug report

OTEL_REDACTION=strict doesn't redact wf.result. AttributeRedactionPolicy matches on attribute-name fragments, and "result" was missing from DEFAULT_SENSITIVE_ATTRIBUTE_FRAGMENTS.

from mistralai.extra.observability import AttributeRedactionPolicy
AttributeRedactionPolicy().redact_attributes({"wf.arguments": "x", "wf.result": "x"})
# Before: {'wf.arguments': '[REDACTED]', 'wf.result': 'x'}
# After:  {'wf.arguments': '[REDACTED]', 'wf.result': '[REDACTED]'}

Affected versions: mistralai 2.9.4 / workflows 3.11.0, still present in 3.2.0 / 3.16.0.

Verification

  • Repro from the bug report now returns both redacted
  • pytest src/mistralai/extra/tests/test_redaction_policies.py — 51 passed
  • Mirrored fix in client-ts with 48 passing tests

AttributeRedactionPolicy matched on attribute-name fragments, and
'result' was missing from DEFAULT_SENSITIVE_ATTRIBUTE_FRAGMENTS.
Activity and workflow outputs (wf.result) were exported unredacted
even with OTEL_REDACTION=strict, while wf.arguments was masked.
The model reply masked on the chat span (gen_ai.output.messages)
thus leaked in clear on the activity span.

Add 'result' to the default sensitive fragments and cover
wf.arguments/wf.result with a regression test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

This branch has not been deployed

No deployments
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.

2 participants