Repository navigation
fix(platform): keep zero request/response byte counts in tools_call audit records - #122
Closed
devopssquaddev wants to merge 1 commit into
Closed
devopssquaddev wants to merge 1 commit into
devopssquaddev wants to merge 1 commit into
Conversation
…udit records The shared JsonFormatter only kept a 0 value for a few keys, so a denied or failed tools/call (response_bytes=0) logged its audit record without response_bytes, and request_bytes vanished for empty arguments. The native MCP audit record requires both fields on every tools/call, including denials. Found by the live S-73 audit test: the denied record it read had no response_bytes. The new contract test fails before the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
Owner
Author
|
Superseded by #123 (release 2.4.5), which carries this commit unchanged. |
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.
Problem
Every native MCP
tools/callwrites one audit record (event: tools_call) that must carrytool,tenant_id,status,elapsed_s,request_bytesandresponse_bytes, including denials.The shared
JsonFormatteronly kept a0value for a short allowlist (elapsed_s,since_send_s,sse_drops,id,pending_id). A denied or failed call hasresponse_bytes: 0, so its audit record was logged withoutresponse_bytes, andrequest_bytesdisappeared for calls with empty arguments. The live S-73 audit test caught it on a deniedpostgres__queryrecord.Fix
request_bytesandresponse_bytesjoin the keys whose0is kept. No other keys change behavior.Verification
test_json_formatter_keeps_zero_byte_counts_on_denied_audit_recordfails before the fix (KeyError: 'request_bytes') and passes after.tests/test_platform_logging.py+tests/test_mcp_tool_policy.py: 49 passed.The formatter ships in every first-party image; only records that log byte counters (MCP backends, sidecar) are affected.
🤖 Generated with Claude Code