Skip to content

perf(agents): remove automatic tool payload secret masking - #169063

Merged
steipete merged 14 commits into
mainfrom
steipete/perf-micro-remove-tool-result-redaction-20260919
Oct 12, 2026
Merged

steipete merged 14 commits into
mainfrom
steipete/perf-micro-remove-tool-result-redaction-20260919

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Automatic secret masking changed source code and .env reads between tool execution, model context, and saved history. The same payload could be scanned three to five times, consuming main-thread CPU while losing source fidelity—for example, changing API_TOKEN = computeToken() into an abbreviated token.

User Impact

Implements Peter's explicit maintainer decision of October 11: tool arguments, results, and conversation text retain their original text in model context, transcripts, history, UI tool events, summaries, and live trajectories. .env reads are unmasked. Logs, diagnostic/support exports, telemetry, and config/audit credential output retain masking.

Media omission, size limits, empty-result placeholders, provider replay normalization, permissions, and execution authority remain. There is no new setting, dependency, schema change, or deployment.

Release-note context: transcripts and shared conversations can contain credentials. Previously masked text cannot be recovered. A private completion interrupted on an older release may reject retry when only a masked input remains: matching placeholders cannot prove unchanged input. Strict conflict rejection stays; check the prior outcome and submit a fresh request if needed.

Why This Change Was Made

Removes the payload masking passes, preparation snapshots, source exceptions, revision checks, and persistence hooks instead of adding another fast path. logging.redactPatterns now describes the logging/diagnostic boundary. Sharing, 1Password, Beam, tool, and SDK documentation describe the new behavior; the removed sanitizeToolArgs SDK export has a dated migration record.

The cutover preserves current actor-storage binding, row identity and owner revisions, append admission, first-send/replay source envelopes, question-answer authority, and compaction ownership. The new ChatGPT V2 caller uses the same structural transcript normalizer, retaining replay/media validity and current write-authority checks.

Evidence

Measurement

Seven-round median main-thread CPU per 1,000 realistic results, using the same 33,475,321-character corpus of repository reads, grep output, and git output:

Path Before After
Persistence 2,110.280 ms 119.640 ms
Combined lifecycle 6,323.657 ms 117.633 ms

The combined path is 53.76× faster. Both versions ran on Blacksmith Testbox tbx_01m4mherhqcpnan9jx43q1ak6w, Node 24.19, corpus SHA-256 3c95b5406d726071d32f92379f2af274da57fdfd8ebc11e09003872ce836f1ad. This measures tool processing, not overall Gateway CPU.

Requested production diff (git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*'): +1,503 / −3,796, net −2,293 lines.

Behavior and validation

  • The real read-tool → provider request → reopened SQLite regression fails on the old implementation and passes with raw .env and credential-shaped source for Anthropic and OpenAI. Logging tests still mask registered secrets and known token forms; diagnostic masking occurs before truncation.
  • Build, export-name collision, closure/CI-plan, provider/plugin, transcript, and headless UI proofs passed remotely. Core tool/MCP/exec/computer proof passed 362 tests on Blacksmith tbx_01m4mqgf99r13p5w6mt5c0s5zr; transcript proof passed 214 tests, and closure/CI-plan proof passed 135 tests on AWS cbx_7a4f8dcbd226. Subsequent provider/plugin, worker, session, and source-fidelity groups passed on isolated remote hosts. All leases are released.
  • Latest integration on the isolated Linux rig: 117 facts/Workboard/pending-input/actor-memory/commit cases passed in 198.87 s; 50 mention/turn-recorder/Logbook cases passed in 381.43 s; focused core lint passed. The final six history/memory files passed 72 cases. All 13 ChatGPT V2 compaction cases passed, including exact raw text under configured logging patterns. Each new raw-text regression failed on the corresponding old masking path first. An oversized test fixture and its stored-history type were caught and corrected during validation.
  • Synthetic Logbook browser proof passed in 18.33 s. Full frames were inspected; only synthetic content was captured. Uploaded image bytes match the inspected captures.
  • Independent full-snapshot and focused integration reviews completed with no actionable findings. CODEOWNERS has no matching rule for the changed paths; the behavior is explicitly maintainer-approved.

Current integration and CI

Rebased onto e358b0e0baf2d31a1260e62bb85dfac63c1b11f6. The full production cutover passed independent review in three completed passes, with no actionable findings. The paired validation used source tree 4f229e20a76919a681215d8403eaecd94e12b105; later commits change test fixtures only. Candidate at that stage: 678f798722d3cad6f839faa774193deb3192bf4c. A subsequent main conflict was resolved by rebasing onto 12a91e0919da5832e003af177959f48d3692ae27. Final candidate: 683aabdcf62b2075099f1dd5f56c6dd73226c8d8.

At the maintainer's request, each formerly unqualified test file was run serially with pnpm test <file> --maxWorkers=1 on both the untouched merge-base and candidate. Both checkouts used their own dependencies, built CLI, and worker cache. These are local macOS results; normal E2E startup includes its CLI build.

Group / exact file Merge-base Candidate Classification
TypeSafe admission — test/decision-typesafe-admission.integration.test.ts 1 passed; 30 s 1 passed; 25 s Original failure not reproduced after rebase
Native early reply — test/e2e/qa-lab/runtime/required-native-same-session.e2e.test.ts 1 failed; 408 s 1 failed; 271 s Inherited: same aDone true-versus-false assertion
Communication admission — src/gateway/server.agent-input-authority.test.ts 7 failed / 8 passed; 63 s 7 failed / 8 passed; 42 s Inherited: same four communication-state and three input-staging failures
Owner continuation — src/gateway/server.sessions-send-owner-continuation.test.ts 5 failed; 26 s 5 failed; 17 s Inherited: same error-versus-accepted assertion
Resume authority — src/gateway/server.sessions-send-resume.test.ts 6 failed / 2 passed; 384 s 6 failed / 2 passed; 378 s Inherited: same three timeouts, cancelled-successor assertion, and two communication-state errors
Conversation-route ownership — test/e2e/qa-lab/runtime/conversation-route-ownership.e2e.test.ts 1 failed; 43 s 1 failed; 45 s Inherited: same conversation-binding-ownership error
Visible-spawn — src/gateway/server.visible-spawn-fallback.product-proof.test.ts 2 failed / 11 passed; 87 s 2 failed / 11 passed; 87 s Inherited: same two CLI model-inheritance session-patch errors; prior four physical-owner cases pass on both

All 44 cases ran on each revision: 22 passed and the same 22 failed. Case-by-case comparisons checked assertions and error signatures, not only exit status. No failure was explained by a masking assertion or a redaction side effect.

The final CI run 38247900729 tested merge 33199095b3a08c1f66854e09108bf7f4f9b1beb8 against main 22e89d92d55fe75cb894780cd4f8b9fa27d1b44d: 120 jobs passed, 18 skipped, 19 test jobs failed plus the aggregate gate. This is an inherited-failure landing, not green CI. Build, production/test types, lint, docs, source contracts, and security passed. The automatic report cannot compare the differently named shards; its unknown rows were investigated case by case.

The final main-conflict resolution retained main’s async side-effect and mention-inbox interfaces, writer-owned physical preparation, and narrow event/transaction imports. It passed fresh independent review through P2. All four affected local files passed 62/62 cases in 570.92 s, including cold worker preparation: worker transcript 15, session creation 27, append/replay 3, Agents API 17. Targeted lint/format passed.

Final failure group Classification and evidence
Native early reply and conversation-route ownership Same exact failures reproduced by the requested paired main/branch runs above.
Profile catalog prerequisites: recovery, scoped reads, narrow mutations, voice, creation and HTTP history Same errors/cases as exact main 5ac29c6c local reproductions and natural main 38243573908; intervening source changes are outside the failing preparation path.
Wrapper source closure Exact CI-main 22e89d92 reproduces the duplicate transcript-entry-anchor.ts inventory assertion: 1 failed / 16 skipped, 6.98 s. Both copies already exist on main; this lane only removes obsolete masking modules.
Repository editor admission Exact CI-main 22e89d92 reproduces all four obsolete positive-SQL-count assertions, before mutation starts: 4 failed / 1 passed, 264.75 s including cold worker preparation. Main moved this getter to its prepared in-memory snapshot.
Agent deletion and archive restore Exact main 5ac29c6c reproduces both deletion assertions (2 failed / 65 passed, 35.32 s) and the cleared-selection catalog assertion (1 failed / 19 skipped, 42.02 s). Relevant failing paths remain unchanged.
Startup plugin metadata, thinking metadata and memory corpus Matching main failures: extra llama-cpp; high versus medium; and the renamed async-stat guidance. Tests and determining owners match; the thinking materializer’s unrelated read change is accounted for.
Repeated-request recovery and worker-launch manifest Main reproduces the same required recovery timeout and unchanged-manifest assertion. Recovery event timing differs; no claim of identical traces. The scenarios execute no tool results before failure.
Parent RPC restart Exact same completed-child case and Session stores for agent main are unavailable error as main 38232649109; fixture and admission owner unchanged.
Codex prompt provenance Exact CI-main 22e89d92 reproduces the same 120000 ms timeout: 1 failed / 6 skipped, 364.32 s including cold worker preparation. Same case and source line as CI.
Visible spawn Exact CI-main 22e89d92 file replay: 3 failed / 10 passed, 229.67 s. It reproduces two physical-reader errors, including the exact direct-agent model-pin case seen in CI, and the visible CLI patch error. Other physical scenarios vary; both CLI failures also have exact older paired-main proof. No claim of identical physical-case sets.
Native Codex unconfirmed exit Same unique physical-reader admission failure previously observed in this file’s delayed-exit case on main 38220958692. This is shared-cause evidence, not an exact unconfirmed-exit replay. The guard runs before payload interpretation and the scenario has no tool calls; upstream typed-receipt changes and the unobserved inner RPC are retained as limits.

The previous CLI cancellation and plugin-warmup fixture deadlines were repaired without changing fake-clock defaults; cancellation passed 13/13 locally and full reliability 56/56. The scheduler child uses the existing 120 s E2E budget and reports error/signal on failure. Its real CI scenario passed in 34.909 s (job 114807310048). No production change was needed for these timing fixtures.

All failed job logs were read once, and every failed job has a source-bound attribution. The native version-1 exception evidence pins the exact head, tested merge, all 19 jobs, aggregate, and artifact hashes. Independent review has no actionable findings. No new lease, full local build, or CI rerun was used.

CODEOWNERS has no matching rule. Two Windows-only cases remain skipped. Previously masked history is unrecoverable. No live Gateway was changed.

Synthetic before/after

Chat tool summary before

Chat tool summary after

Activity tool result before

Activity tool result after

Synthetic Logbook detail before

Synthetic Logbook detail after

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core security Security documentation scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling extensions: anthropic extensions: codex plugin: file-transfer plugin: workboard extensions: crabbox extensions: onepassword 1Password plugin plugin: beam Beam session sharing plugin plugin: session-share extensions: agentsapi size: XL labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Removes automatic secret masking from tool and conversation payloads while retaining masking for logs and diagnostics.

Example: A read tool returns API_TOKEN = computeToken().

  • Before: Activity can display API_TOKEN = comput...en(), and masked text can enter saved history.
  • After: Activity and saved history retain API_TOKEN = computeToken().

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, coherent cutover with inspected browser evidence and substantial integration coverage; no actionable introduced bug identified.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected browser captures show original synthetic source and credential-shaped text in chat, Activity, and Logbook after the fix; read-tool/provider/SQLite regressions support the core path. This maintainer-authored PR is outside the ordinary contributor proof gate. Storage envelopes and schemas remain unchanged, existing history is not rewritten, and the historical masked-input retry limitation is explicitly accepted and documented.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Automatic masking can alter source reads and saved conversation text while repeatedly scanning large tool results.
Reason: The maintainer explicitly chose original-text preservation, and the patch removes the corresponding machinery across producers, storage, replay, and presentation.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it implements an explicit maintainer decision, addresses source corruption and repeated masking work, and has no concrete introduced defect identified in the reviewed paths. The previous merge conflict is resolved; current CI is not green.

Priority: P2
Reviewed head: 683aabdcf62b2075099f1dd5f56c6dd73226c8d8

Before merge

None.

Findings

None.

Agent review details

How this fits together

Tool execution feeds model context, transcript storage, history, trajectories, and presentation; logging and diagnostic exports retain a separate masking boundary.

flowchart LR
  A[Tool execution] --> B[Size and media preparation]
  B --> C[Model context]
  B --> D[SQLite transcripts]
  D --> E[History and sharing]
  B --> F[UI and channel progress]
  A --> G[Masked logs and diagnostics]
Loading

Technical review

Best possible solution:

Land the approved cutover with diagnostic masking, live authorization, structural normalization, and the documented SDK transition preserved.

Do we have a high-confidence way to reproduce the issue?

Current-main source demonstrates automatic masking at read and live-result boundaries, and the supplied before images visibly show corrupted credential-shaped source; no target code was executed during this review.

Is this the best way to solve the issue?

Removing the masking passes and their preparation machinery coherently implements the approved direction while preserving separate diagnostic masking and existing storage and execution owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 08005517c47b.

Provenance checked

  • Live tool-result masking changes intended behavior with a stated reason (dcf3baa: Prevent recognized secrets from reaching subsequent model requests even when transcript persistence already masked them.)
  • Code Mode source exceptions changes intended behavior with a stated reason (bc39f51: Preserve proven Code Mode source through persistence without weakening the then-existing credential-masking policy.)
  • Model-visible source-aware masking changes intended behavior with a stated reason (0ab6578: Preserve ordinary source assignments while continuing to mask credential-shaped tool output.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned change and current merge state: Reviewed introduced hunks against merge base 12a91e0. Live REST reports the reviewed head as mergeable, resolving the previous conflict blocker. (683aabdcf62b)
  • Main still applies payload masking: Fetched main still masks .env read results and prepares live tool-result text through the masking owner; the central cutover remains unique work. (src/agents/agent-tools.read.ts:1055, 08005517c47b)
  • Diagnostic masking retained: Diagnostic text continues to combine operator patterns with built-in protections and registered-secret masking; rejected observer output is masked before clipping. (src/logging/redact.ts:661, 683aabdcf62b)
  • Accepted compatibility and exposure tradeoffs: The maintainer-authored body and discussion explicitly accept raw credentials in transcripts and sharing, immediate sanitizeToolArgs removal, and strict rejection of ambiguous historical masked-input retries. The SDK removal has a dated migration record. (src/plugins/compat/agent-harness-records.ts:29, 683aabdcf62b)
  • Inspected browser evidence: Inspected all six linked before/after images: chat argument summaries, Activity results, and Logbook details retain synthetic credential-shaped text after the change. (ui/src/pages/activity/tool-activity.ts:118, 683aabdcf62b)
  • Prior tail finding addressed: sessions tail now reads both arguments and args and sanitizes terminal output. The earlier reviewed commit is unavailable locally, so no historical patch-equivalence claim is made. (src/commands/sessions-tail.ts:109, 683aabdcf62b)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Addresses source fidelity and repeated payload-processing cost without evidence of an urgent runtime outage.
  • merge-risk: 🚨 compatibility: Removes sanitizeToolArgs and changes masking behavior for existing consumers; immediate removal is explicitly accepted and documented.
  • merge-risk: 🚨 security-boundary: Credentials can now remain in model context, transcripts, shared conversations, and progress displays; this exposure is an explicitly accepted maintainer tradeoff.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Shared progress-draft, tool-summary, and exec-followup text now preserves credential-shaped values that Telegram's Test Server can observe.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (25 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-12T07:37:54.836Z sha 7c696e6 :: needs changes before merge. :: [P2] Render both trajectory argument fields in sessions tail
  • reviewed 2026-10-12T08:16:22.621Z sha 7c696e6 :: needs changes before merge. :: [P2] Render both trajectory argument fields in sessions tail
  • reviewed 2026-10-12T08:43:03.397Z sha f3c453c :: needs changes before merge. :: [P2] Render both trajectory argument fields in sessions tail
  • reviewed 2026-10-12T09:43:06.942Z sha 18835f7 :: needs changes before merge. :: none
  • reviewed 2026-10-12T09:57:35.971Z sha 7eb6c07 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T10:56:48.598Z sha e3f1a4b :: needs changes before merge. :: none
  • reviewed 2026-10-12T11:40:28.340Z sha f471a36 :: needs changes before merge. :: none
  • reviewed 2026-10-12T12:11:14.536Z sha 678f798722d3cad6f839faa774193deb3192bf4c :: needs changes before merge. :: none

Reviewed October 12, 2026, 8:33 AM ET / 12:33 UTC (Revision 26).

@steipete
steipete force-pushed the steipete/perf-micro-remove-tool-result-redaction-20260919 branch 2 times, most recently from 9ef027a to 628dcbf Compare October 11, 2026 12:39
@steipete
steipete marked this pull request as ready for review October 11, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: qa-channel Channel integration: qa-channel commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: agentsapi extensions: anthropic extensions: codex extensions: crabbox extensions: google extensions: memory-core Extension: memory-core extensions: onepassword 1Password plugin gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. plugin: beam Beam session sharing plugin plugin: file-transfer plugin: session-share plugin: workboard proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts security Security documentation security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant