Repository navigation
[3595 by Claude Opus 5.5] MCP: result redaction removes token counts from cost data and hides the token-alert settings - #3611
Conversation
…s that could be credentials under `token`-named keys are still removed. All 470 other MCP tests and the new ones pass, except one MCP tunnel registration test that failed once during the full run. That test passes when run alone (17/17, twice) and doesn't involve redaction. Lint and typecheck are clean. The change (`packages/api/mcp/adapter.ts`): the old single key filter is split in two. - Other key classes (`secret`, `password`, `credential`, private key, API key, access key, `cookie`, `authorization`, worktree/stored path, `job_data`, `container_env`): still always dropped, whatever the value. That rule is unchanged. - `token`-named keys: kept only if the value can't hold a credential: a number, boolean or null, or a plain object or array made only of those. A string, or a container with any string inside, is still dropped. That covers access, bearer, instance and refresh tokens and `tokenHash`, and also number-looking strings like `"1200"` and JSON-encoded strings. - Buffers, typed arrays and dates under a `token` key are also dropped, because a byte array could be a token's raw bytes. - Old exemption removed: the one-off `pr_review_max_context_tokens` exemption is gone; the general rule covers it. - No allow-list of setting names to maintain. Effect on the two tools in the issue: - `get_cost_breakdown` rows and totals now include `input_tokens`, `output_tokens`, `cache_creation_input_tokens` and `cache_read_input_tokens`, the same as `GET /api/stats/cost`. - `get_execution_settings` now includes all five `token_outlier_*` settings. Tests: - New `packages/api/test/mcpResultRedaction.test.ts`: a table of keys and values that must be kept and must be removed. Each one is checked at the top level, nested in an object, inside an array, as a JSON-encoded string, and as a JSON string inside an object. It also checks that a kept token container is still redacted inside. - `costExport.test.ts`: a new test runs redaction on the `get_cost_breakdown` output and checks it matches the `GET /api/stats/cost` response. - `mcpReviewerConcurrency.test.ts`: the settings round-trip now writes and reads back the `token_outlier_*` values through the real MCP call path. Against the original adapter, the new tests and the settings round-trip fail. I didn't create a visual preview because this change only affects API data.
|
/ultrafix goal=8 max=6 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 6) First action:
|
|
✅ AI Code Review Complete requested by @propr-dev[bot] Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR restores numeric token metrics and token-alert settings through a focused change to shared MCP redaction. It is merge-ready within the reviewed scope, conditional on the five pending checks completing successfully. ✅ Correct numeric contracts — The new filter preserves the numeric cost columns and all five numeric ✅ Sensitive filtering retained — Other sensitive key classes remain unconditionally excluded. Token fields containing strings, including nested strings, remain excluded; Buffer, typed-array, and Date values are also rejected. ✅ Relevant regression coverage — Tests cover nested and JSON-encoded payloads, cost-response parity, and settings persistence through the real MCP execution path. This assessment is based on static review of the supplied diff and context. No commands or tests were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Cover recursive depth boundariesConsider adding focused tests around the depth limit and cyclic token containers in ScoreThe implementation addresses the stated objective with a small production change and relevant regression tests. There are no verified merge blockers or current-head check failures; five checks remain pending. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3595
Branch:
3595/claude-opus-5-5-mcp-result-redaction-remo-20261117-0119-jchCommits: ✅ Changes committed (d9399af)
AI Processing Completed
Execution Details:
Summary:
MCP tools now return token counts and the token-alert settings. Values that could be credentials under
token-named keys are still removed. All 470 other MCP tests and the new ones pass, except one MCP tunnel registration test that failed once during the full run. That test passes when run alone (17/17, twice) and doesn't involve redaction. Lint and typecheck are clean.The change (
packages/api/mcp/adapter.ts): the old single key filter is split in two.secret,password,credential, private key, API key, access key,cookie,authorization, worktree/stored path,job_data,container_env): still always dropped, whatever the value. That rule is unchanged.token-named keys: kept only if the value can't hold a credential: a number, boolean or null, or a plain object or array made only of those. A string, or a container with any string inside, is still dropped. That covers access, bearer, instance and refresh tokens andtokenHash, and also number-looking strings like"1200"and JSON-encoded strings.tokenkey are also dropped, because a byte array could be a token's raw bytes.pr_review_max_context_tokensexemption is gone; the general rule covers it.Effect on the two tools in the issue:
get_cost_breakdownrows and totals now includeinput_tokens,output_tokens,cache_creation_input_tokensandcache_read_input_tokens, the same asGET /api/stats/cost.get_execution_settingsnow includes all fivetoken_outlier_*settings.Tests:
packages/api/test/mcpResultRedaction.test.ts: a table of keys and values that must be kept and must be removed. Each one is checked at the top level, nested in an object, inside an array, as a JSON-encoded string, and as a JSON string inside an object. It also checks that a kept token container is still redacted inside.costExport.test.ts: a new test runs redaction on theget_cost_breakdownoutput and checks it matches theGET /api/stats/costresponse.mcpReviewerConcurrency.test.ts: the settings round-trip now writes and reads back thetoken_outlier_*values through the real MCP call path.Against the original adapter, the new tests and the settings round-trip fail.
I didn't create a visual preview because this change only affects API data.
Review digest
Risk-tiered paths
packages/api/mcp/adapter.ts(+23/−1)packages/api/test/costExport.test.ts(+21/−0)packages/api/test/mcpResultRedaction.test.ts(added, +89/−0)packages/api/test/mcpReviewerConcurrency.test.ts(+1/−1)Validation evidence
Diff size: 4 files changed, +134/−2 lines
Detailed Logs:
04e45199-7bd7-4c50-8543-9d1dea7283d6Log files stored at:
/usr/src/app/logs/executions/issue-3595-2026-11-17T01-35-20-688Z-conversation.json/usr/src/app/logs/executions/issue-3595-2026-11-17T01-35-20-688Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3595.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!