feat: enforce logging content rule and add LOG_PAYLOADS switch #436#459
Open
ypldan wants to merge 2 commits into
Open
feat: enforce logging content rule and add LOG_PAYLOADS switch #436#459ypldan wants to merge 2 commits into
ypldan wants to merge 2 commits into
Conversation
DEBUG is routinely enabled in live environments during incidents, and today that floods aggregated logs with conversation content (chat-completion payloads incl. forwarded header values, message context, tool-call arguments, tool/LLM response bodies, unfiltered signed URLs) — a privacy/compliance hazard made worse by OTLP export (#433) and the upcoming JSON mode (#438). Implements part 2 of the approved design (#434) on top of the #435 lifecycle skeleton. - Content rule at every level: payload-dumping logs across the agent loop and toolsets now emit a structure summary + route the payload through the new common.payload_logging.log_payload (a no-op unless LOG_PAYLOADS=true). - LOG_PAYLOADS / LOG_PAYLOADS_MAX_LENGTH (off by default, truncated when on); forwarded header values are never logged even with the switch on. - LoggingConfig caps openai/httpx/httpcore at INFO unless LOG_PAYLOADS=true. - sanitize_url_for_log strips URLs to scheme/host/path at every log/exception site. - ToolErrorException/MCPToolErrorException string form is structural (no body); the body stays on error_message for #408 LLM forwarding, the user-facing resolver, and fallback trigger_on matching (now matched on error_message). - Docs: README, CODESTYLE §9, docs/agent.md, CLAUDE.md.
ypldan
requested review from
VinShurik,
andrii-novikov and
korotaav48
as code owners
July 17, 2026 15:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applicable issues
Description of changes
Enabling DEBUG in a live environment shouldn't leak conversation content. This implements the
content rule from the approved design (#434), on top of the #435 lifecycle skeleton: logs carry
structure, never payload.
summaries (counts, roles, names, ids, sizes, header names, sanitized URLs); the payload itself
goes through
payload_logging.log_payload.LOG_PAYLOADSswitch (off by default, truncated when on) re-enables payload records for localdebugging; it also caps
openai/httpx/httpcoreat INFO, so raising a log level alone neverreveals content. Header values are never logged.
error_messageforthe LLM (feat: expose MCP and HTTP Tool Errors to the LLM #408), the user-facing resolver, and fallback matching.
Docs updated (README, CODESTYLE §9, docs/agent.md, CLAUDE.md); design doc marked Implemented.
Checklist
[ ] App schema changes are backward compatible, or breaking changes are documented with a migration guide(no schema/manifest-model change; the new env vars are additive and off by default)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.