Skip to content

Comments

fix: make trace_include_sensitive_data secure by default#2441

Draft
OiPunk wants to merge 3 commits intoopenai:mainfrom
OiPunk:codex/openai-agents-secure-tracing-default
Draft

fix: make trace_include_sensitive_data secure by default#2441
OiPunk wants to merge 3 commits intoopenai:mainfrom
OiPunk:codex/openai-agents-secure-tracing-default

Conversation

@OiPunk
Copy link
Contributor

@OiPunk OiPunk commented Feb 9, 2026

Summary

This PR makes tracing safer by default by switching the default of RunConfig.trace_include_sensitive_data from True to False when OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA is not set.

This aligns runtime behavior with secure-by-default expectations and documentation.

Fixes #2393

Changes

  • Change _default_trace_include_sensitive_data() env fallback from "true" to "false" in src/agents/run_config.py
  • Update default-behavior test in tests/test_run_config.py
  • Update docs in docs/tracing.md to state the default is False

Testing

  • uv run ruff format --check
  • uv run ruff check
  • uv run mypy . --exclude site
  • uv run pytest tests/test_run_config.py tests/test_agent_runner.py -k trace_include_sensitive_data -q
  • uv run coverage run -m pytest tests/test_run_config.py tests/test_agent_runner.py -k trace_include_sensitive_data -q
  • uv run coverage report -m src/agents/run_config.py

Coverage

src/agents/run_config.py: 100% (106/106)

@github-actions github-actions bot added documentation Improvements or additions to documentation feature:core labels Feb 9, 2026
@seratch seratch marked this pull request as draft February 9, 2026 20:24
@seratch
Copy link
Member

seratch commented Feb 9, 2026

Thanks for sending this patch! However, since this is a breaking change, we don't plant to make the change in the short term.

@OiPunk
Copy link
Contributor Author

OiPunk commented Feb 10, 2026

Follow-up pushed to fix current CI failures on this PR.

Root cause:

  • tests/mcp/test_mcp_tracing.py expected legacy function span fields (input/output) for MCP/non-MCP calls.
  • Current runtime behavior omits those fields in this path, so snapshots drifted and all Python-version test jobs failed.

Fix:

  • Refreshed the inline snapshot in tests/mcp/test_mcp_tracing.py to match current normalized span output.

Commit:

Local verification:

  • ruff check on touched + related files: pass
  • mypy . --exclude site: pass
  • pytest tests/test_run_config.py tests/test_agent_runner.py tests/test_tracing_errors.py tests/test_tracing_errors_streamed.py tests/mcp/test_mcp_tracing.py -q: 121 passed

@github-actions
Copy link
Contributor

This PR is stale because it has been open for 10 days with no activity.

@github-actions github-actions bot added the stale label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature:core feature:mcp stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: trace_include_sensitive_data defaults to True, risking accidental data exposure

2 participants