capture: make request records privacy-safe by default - #356
capture: make request records privacy-safe by default#356PhilipJohnBasile wants to merge 3 commits into
Conversation
2382dfd to
8bc4d88
Compare
0149acf to
a5b2f9a
Compare
|
Thanks. This draws the right line: capture stays off unless |
|
@youssofal Agreed on the next-release placement. The boundary stays unchanged: capture is off unless configured, counts and digests are the enabled default, and raw prompt/completion token IDs require separate explicit opt-ins. No request-log/trace-tooling changes are added here. The PR is available for source review without expanding the scope or treating the release deferral as a defect. |
This extracts only the request-capture privacy boundary from #336.
Request captures are still off unless
MTPLX_REQUEST_CAPTURE_DIRis set. Once enabled, the default record now replaces prompt and completion token IDs with counts and stable SHA-256 digests. Prompt text, response text, messages, and exception text are also omitted by default, while nested credentials are redacted.The public
completion_token_ids(tokens)helper and its existing one-argument call remain supported. It now returns the completion count and digest by default. Raw completion IDs require their ownMTPLX_REQUEST_CAPTURE_INCLUDE_COMPLETION_TOKENS=1opt-in. That flag is separate fromMTPLX_REQUEST_CAPTURE_INCLUDE_PROMPT_TOKENS=1, and both paths enforce independent limits.Measurement
Command:
python scripts/measure_request_capture.py --records 1000Measured source:
fe5b5e59a14e0066f3191951483e3a65b9c55592on Apple arm64 with Python 3.14.6.The measurement verifies all 1,000 records completed, raw prompt and completion IDs were absent, prompt/response/message/secret content was absent, and token counts plus digests were present. Validation runs outside the timed section. The committed receipt is request-capture-1000.json.
Validation
python -m pytest tests/test_request_capture.py -q: 18 passedpython -m compileall -q mtplx/request_capture.py scripts/measure_request_capture.py tests/test_request_capture.py: passedpython -m ruff check mtplx/request_capture.py scripts/measure_request_capture.py tests/test_request_capture.py: passedgit diff --check origin/main...HEAD: passedExclusions
This PR does not change server call sites, runtime registries, replay systems, dashboards, API routes, workflow files, model behavior, or scheduling. The measurement covers request-capture persistence overhead only. It does not claim inference throughput or model-quality improvement.