Skip to content

fix: make sensitive trace payloads opt-in by default - #4550

Closed
sylvesterkaczmarek wants to merge 4 commits into
openai:mainfrom
sylvesterkaczmarek:fix/sensitive-tracing-default
Closed

fix: make sensitive trace payloads opt-in by default#4550
sylvesterkaczmarek wants to merge 4 commits into
openai:mainfrom
sylvesterkaczmarek:fix/sensitive-tracing-default

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

This pull request fixes the default handling of potentially sensitive trace payloads by making trace_include_sensitive_data opt-in when no explicit configuration is provided.

RunConfig now treats an unset OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA environment variable as false, while preserving every existing explicit override. The voice pipeline's corresponding non-audio sensitive-data setting also defaults to False. Audio tracing remains unchanged.

This is an intentional default-behavior change. Applications that rely on model generations or tool inputs/outputs being present in traces can preserve the previous behavior with either RunConfig(trace_include_sensitive_data=True) or OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA=true. The tracing guide now documents that migration path directly.

Existing tests continue to cover explicit true/false environment values and explicit RunConfig overrides, and the default expectation now verifies the secure-by-default behavior.

The earlier draft #2392 implemented the same core direction but was closed automatically after going stale without a maintainer rejection. This refreshes that focused change on current main and adds migration documentation requested in the issue discussion.

This pull request resolves #2393.

OpenSourceSoul and others added 4 commits February 1, 2026 16:16
By default, trace_include_sensitive_data was set to True, which meant
sensitive data (tool inputs/outputs, LLM generations) was included in
traces without explicit user consent. This is a security risk as it could
lead to accidental data leakage of PII, secrets, or confidential info.

This change makes the SDK secure-by-default:
- Changed OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA env default from 'true' to 'false'
- Changed VoicePipelineConfig.trace_include_sensitive_data default from True to False
- Updated tests to reflect new secure-by-default behavior

Users can still opt-in to include sensitive data by:
1. Setting OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA=true environment variable
2. Explicitly passing trace_include_sensitive_data=True to RunConfig or VoicePipelineConfig

Security impact: Prevents accidental exposure of sensitive data in production deployments.
Replay the focused openai#2393 default changes from the stale upstream draft onto current main for a fresh reviewed contribution.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c5cdcb000

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/tracing.md
Similarly, Audio spans include base64-encoded PCM data for input and output audio by default. You can disable capturing this audio data by configuring [`VoicePipelineConfig.trace_include_sensitive_audio_data`][agents.voice.pipeline_config.VoicePipelineConfig.trace_include_sensitive_audio_data].

By default, `trace_include_sensitive_data` is `True`. You can set the default without code by exporting the `OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA` environment variable to `true/1` or `false/0` before running your app.
By default, `trace_include_sensitive_data` is `False`. Applications that intentionally need model and tool inputs/outputs in traces must opt in explicitly, either in code:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move unreleased tracing guidance to a docs-only change

This line documents the new opt-in default introduced by the accompanying runtime change, so it is not accurate for the latest published package until that behavior is released. Repository policy requires documentation for unreleased behavior to be handled in a separate docs-only pull request coordinated with the release; remove this documentation change from the runtime fix.

AGENTS.md reference: AGENTS.md:L76-L78

Useful? React with 👍 / 👎.

trace_include_sensitive_data: bool = True
"""Whether to include sensitive data in traces. Defaults to `True`. This is specifically for the
voice pipeline, and not for anything that goes on inside your Workflow."""
trace_include_sensitive_data: bool = False

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align the voice constructor's static default

When static analysis is active, the handwritten VoicePipelineConfig.__init__ declaration below this field still advertises trace_include_sensitive_data=True, although construction now produces False. Editors and other consumers of the static signature therefore report the old security-sensitive default; update that declaration alongside the dataclass field.

AGENTS.md reference: AGENTS.md:L100-L100

Useful? React with 👍 / 👎.

@seratch

seratch commented Aug 21, 2026

Copy link
Copy Markdown
Member

Thanks for sending this. However, we decide when to switch the default settings. So let me close this PR for now.

@seratch seratch closed this Aug 21, 2026
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.

Change trace_include_sensitive_data defaults to True in future releases

2 participants