capture: make request records privacy-safe by default - #356
Open
PhilipJohnBasile wants to merge 3 commits into
Open
capture: make request records privacy-safe by default#356PhilipJohnBasile wants to merge 3 commits into
PhilipJohnBasile wants to merge 3 commits into
Conversation
This was referenced Aug 26, 2026
youssofal
force-pushed
the
main
branch
2 times, most recently
from
September 1, 2026 08:07
2382dfd to
8bc4d88
Compare
PhilipJohnBasile
force-pushed
the
feat/privacy-safe-request-capture
branch
from
September 1, 2026 13:02
0149acf to
a5b2f9a
Compare
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.
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.