From b30981595bff41d9b99dea6fc2ba61641128a658 Mon Sep 17 00:00:00 2001
From: Ali Khokhar <20476625+Alishahryar1@users.noreply.github.com>
Date: Sat, 10 Oct 2026 23:06:26 -0700
Subject: [PATCH] patch: disable automatic variable dumps in file logs (#2047)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Why
The file logger automatically includes variable values in exception
tracebacks, bypassing structured trace redaction and potentially
exposing request credentials. Addresses the automatic traceback dumps
reported in #2002.
## How
Set `diagnose=False` when creating file sinks. Exception chains, stack
traces, and explicitly logged context remain available. Automatic
variable annotations are disabled, so any additional diagnostic values
must be logged explicitly.
Confidence Score: 5/5
Safe to merge. Executed checks
confirmed the credential protection without losing exception details or
explicit context.
T-Rex evidence
**[Command output from the
check](https://app.greptile.com/trex/artifacts/44936914-51ff-483f-9754-ab9db6797f1d)**
- Ran the prescribed focused test command before environment repair and
captured the missing-interpreter warning and pytest\_asyncio import
failure, showing an environment blocker rather than a PR defect.
**[Command output from the
check](https://app.greptile.com/trex/artifacts/947bf228-7b15-4b04-93c6-517557c46f3f)**
- Ran uv sync --frozen --group dev and captured its successful
installation output, showing that the test environment was restored.
**[Command output from the
check](https://app.greptile.com/trex/artifacts/89879f93-b2d8-403f-9be2-7ca43a40731c)**
- Reran the exact requested pytest command and captured 24 passing tests
with exit code 0, showing that the focused suite succeeds.
**[Evidence from the
check](https://app.greptile.com/trex/artifacts/ed90ce90-f7f5-463d-a5bf-cad7497dfca8)**
- Authored and executed this isolated harness against both Git revisions
with real file sinks, making the paired runtime observations
reproducible without tracked code changes.
**[Command output from the
check](https://app.greptile.com/trex/artifacts/3f4233df-0e62-40df-82ff-1ce0c64dc193)**
- Executed 16 parent-revision cases and captured their actual serialized
file records, showing synthetic local credentials exposed across both
logging routes and all four sink configurations.
**[Command output from the
check](https://app.greptile.com/trex/artifacts/dd8d06c4-0d2c-4215-8154-0c1c498c707f)**
- Executed the same 16 cases against the PR and captured their actual
serialized file records, showing automatic credentials omitted while
exception chains, frames, and explicit context remain.
**[Command output from the
check](https://app.greptile.com/trex/artifacts/18872c5f-f89f-4f68-9c81-de4081418efa)**
- Executed working-tree and staged diff checks plus git status after
validation, showing no tracked modifications.