Skip to content

fix: harden sensitive runtime logging#3938

Open
seratch wants to merge 9 commits into
mainfrom
fix/sensitive-logging-redaction
Open

fix: harden sensitive runtime logging#3938
seratch wants to merge 9 commits into
mainfrom
fix/sensitive-logging-redaction

Conversation

@seratch

@seratch seratch commented Jul 24, 2026

Copy link
Copy Markdown
Member

This pull request fixes sensitive-data exposure across runtime logging paths by adding shared policy-aware logging helpers and applying them to model, tool, MCP, Realtime, session, tracing, voice, and sandbox error boundaries.

In redacted mode, MCP lifecycle logs now use fixed messages without reading server or tool names. Diagnostic mode preserves useful endpoint identity while stripping URL credentials, query parameters, and fragments.

It also adds a Python-native sensitive logging audit skill with stable inventory fingerprints, baseline comparison, and review-ledger validation. The change does not alter public APIs, persisted schemas, or wire protocols, and detailed diagnostics remain available when sensitive-data logging is explicitly enabled.

@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: d5d79b835e

ℹ️ 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 .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread src/agents/run_internal/session_persistence.py
Comment thread src/agents/mcp/_logging.py
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated

@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: 90083bc89c

ℹ️ 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 src/agents/mcp/_logging.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated

@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: 2a574cc745

ℹ️ 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 src/agents/agent.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread src/agents/mcp/server.py Outdated

@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: d7c819c71f

ℹ️ 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 .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread src/agents/logger.py Outdated

@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: f318085937

ℹ️ 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 .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread src/agents/extensions/sandbox/e2b/sandbox.py
@seratch
seratch force-pushed the fix/sensitive-logging-redaction branch 4 times, most recently from 3351f33 to 92ec6de Compare July 24, 2026 10:54

@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: 92ec6debf7

ℹ️ 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 src/agents/voice/pipeline.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
@seratch
seratch force-pushed the fix/sensitive-logging-redaction branch from 062c2ba to 5bc85a2 Compare July 24, 2026 11:20

@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: 5bc85a2bc5

ℹ️ 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 src/agents/voice/pipeline.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated

@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: 1aa2fcfeb3

ℹ️ 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 .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated

@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: 9cff0a570d

ℹ️ 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 .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated

@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: 520adb2081

ℹ️ 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 .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread src/agents/tracing/provider.py
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated
Comment thread .agents/skills/sensitive-logging-audit/scripts/_inventory.py Outdated

@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: fa372d6d28

ℹ️ 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 src/agents/agent.py
Comment thread src/agents/extensions/memory/advanced_sqlite_session.py Outdated

@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: 6e5811b61d

ℹ️ 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 src/agents/run.py Outdated
Comment thread src/agents/extensions/sandbox/blaxel/mounts.py Outdated

@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: 7b9b48d3ee

ℹ️ 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".

exc_info=True,
log_tool_action_warning(
logger,
"Failed to unmount UnixLocal workspace mount before deleting root",

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 Retain the failed UnixLocal mount path

When tool-data logging is explicitly enabled and a workspace has multiple ephemeral mounts, this replacement drops the previous mount_path from the warning. A generic unmount exception then leaves identical records for every mount, and because the method returns without deleting the workspace after any failure, the log is the only indication of which mount blocked cleanup; attach the path as diagnostic-only context.

Useful? React with 👍 / 👎.

if force_no_raise or sink.on_error in ("log", "ignore"):
if sink.on_error == "log":
logger.exception("sandbox event sink failed (ignored): %s", type(sink).__name__)
log_tool_action_error(logger, "Sandbox event sink failed (ignored)", exc)

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 Retain the failing sink type in swallowed diagnostics

For sinks configured with on_error="log", the exception is swallowed immediately after this record, but the replacement no longer includes the previous type(sink).__name__. Applications with several instrumentation sinks therefore cannot determine which sink lost an event when their handlers raise the same exception; preserve the sink identity as diagnostic-only context while keeping the redacted message fixed.

Useful? React with 👍 / 👎.



def _processor_diagnostic_extra(processor: TracingProcessor) -> dict[str, object]:
return {"trace_processor": processor}

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 Keep trace processor extras queue-safe

When both data policies enable diagnostics and the application sends these records through a multiprocessing QueueHandler, the raw processor object survives QueueHandler.prepare() as a custom LogRecord attribute. A processor containing common non-pickleable state such as locks or threads then causes the queue feeder to reject the failure record, so the processor error is never reported; store a queue-safe instance identifier instead of the processor object itself.

AGENTS.md reference: AGENTS.md:L108-L108

Useful? React with 👍 / 👎.

Comment thread src/agents/logger.py
"%s: %s",
message,
exc,
exc_info=exc,

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 Avoid evaluating exception truthiness while logging

When diagnostic logging is enabled, logging tests the truthiness of exc_info before normalizing an exception instance. A custom exception whose __bool__ raises therefore makes these helpers raise while handling the original failure—changing swallowed callback, cleanup, and fallback behavior—while a falsey exception silently loses its traceback; pass a stable exception tuple instead, including in _log_action_at_level.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant