Repository navigation
fix: preserve source code in tool results - #127697
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 22, 2026, 3:23 AM ET / 07:23 UTC. ClawSweeper reviewWhat this changesThe PR preserves ordinary source and configuration text in model-visible tool results while retaining masking for registered secrets, recognizable credentials, structured sensitive fields, and direct Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThis PR remains necessary: current main still broadly redacts model-visible tool results. The final head cleanly separates source-preserving model context from broader diagnostic redaction, with the security boundary explicitly accepted in discussion; no actionable patch defect was found. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherTool and read results enter agent context, persisted transcripts, and provider request payloads, while logs and diagnostics use separate output paths. This change narrows only the model-visible path so source text stays usable by later agent edits. flowchart LR
A[Tool and read output] --> B[Model-visible redaction]
B --> C[Session transcript]
C --> D[Provider request payload]
A --> E[Diagnostic redaction]
E --> F[Logs and error output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +129, Tests +345, Docs +18. Total +492 across 20 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one explicit model-visible redaction policy, retain broad redaction for diagnostics and non-tool transcript fields, and preserve direct Do we have a high-confidence way to reproduce the issue? Yes—source inspection establishes the prior broad assignment patterns and the final head's separate model-visible path; this read-only review did not execute the regression. Is this the best way to solve the issue? Yes—the split is the narrowest maintainable fix because the producer, transcript, and provider paths now share a source-fidelity policy while diagnostics retain broad masking. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ff6db34233df. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Maintainer decision: accept the documented model-visible redaction boundary. Opaque, unregistered values in workspace/tool output are not secrets merely because they appear beside Do not add provenance/taint plumbing or restore broad key-name masking for generic tool output. Either would preserve a porous heuristic while reintroducing source corruption. The supported remedy for an opaque actual secret is registration at its owner boundary. This resolves the security/product choice raised by the exact-head local review for |
|
ClawSweeper Rank-up move — intentional skip: this PR is |
|
Exact-head CI run The repaired redaction owner-boundary test now passes in the full Node shard. Three remaining failures are unrelated to this PR:
This PR changes neither |
Preserve opaque source strings across tool-result replay while retaining masking for direct .env reads, registered or recognizable secrets, structured sensitive fields, and payment data.
Closes #127640
AI-assisted. I reviewed the implementation and understand the changed redaction boundary.
Problem
Broad diagnostic redaction also rewrote model-visible tool results. Ordinary source expressions such as
API_TOKEN = computeToken()becameAPI_TOKEN = ***, so later reads and edits operated on text that never existed in the file.Root cause and fix
redactToolPayloadTextserved two incompatible boundaries:Model-visible text now masks registered secret values and recognizable credential forms instead of inferring secrecy from ordinary key names. Compact shell assignments, raw JSON source, YAML/TOML/config text, and normal source expressions remain faithful. Structured tool-result fields and payment-credential JSON retain their explicit masking rules.
The read tool applies broad assignment masking only to direct
.env-family reads, where the filename is authoritative and the file is a credential store..envrcand general config files remain source-shaped. Generic exec and plugin output deliberately receive no provenance/taint system: an opaque, unregistered value is not treated as secret merely because it appears besideapi_key,token, or a similar identifier. Register actual secrets; recognizable formats and registered values remain masked across producers.This is the selected security/product boundary. Restoring broad generic masking would reproduce the bug; provenance plumbing would provide porous hygiene rather than a security boundary because arbitrary shell transforms erase origin.
User impact
Agents can read, persist, replay, and edit the same source/config text that exists on disk. Direct
.envreads, registered secrets, authorization headers, URL credentials, known token forms, structured sensitive fields, and payment credentials remain masked.Evidence
Final exact head:
a444d12b13b9eb15fc5964c06dbfe5d0eeea79272de631bab0716c28a53f5dcefe7cefb6404a08a7: failed becausesettings.yamlreturnedapi_key: unquot…7890instead of the stored text.662e2896a7076a8afa3668ac06571b94c94da4f0: failed because JSON source{"token":"timeObserverToken"}became{"token":"***"}inside a structured resource string.pnpm tsgo: passed.pnpm check:test-types: passed (core, extensions, root).pnpm docs:list: passed.pnpm docs:check-links: 6,532 internal links checked, 0 broken.git diff --check: passed..envowner rule and the distinct payment-data rule.Gate status
32560606608: every attributable lint, typecheck, security, Windows, and changed-path shard passed.build-artifactsalone remained red after one retry because the Control UI gzip output measured 27-37 bytes above its budget. This PR has no UI diff:HEAD:uiand green main SHA6e7349be4d8fffb2e677cf7b6a3b13a201b6a11e:uiare the identical tree690b6a308947850ae145ecfba6af731e3a2e54d5; main passed at 345,042 bytes while identical PR input varied from 345,070 to 345,080 bytes. Unrelated CI variance; no UI budget change belongs in this PR.a444d12b13b9eb15fc5964c06dbfe5d0eeea7927with zero findings, zero security concerns, no maintainer decision, and zero Rank-up moves.a444d12b13b9eb15fc5964c06dbfe5d0eeea7927through the changed path. A real-user DM triggered thereadtool againstsettings.yaml; the second provider request contained the exact tool resultapi_key: timeObserverToken, not a masked rewrite. The recording captured SUT typing start/cancel and the finalOPENCLAW_TOOL_RESULT_OKreply. Both provider turns completed, the workspace assertion passed byte-for-byte, and temporary SUT state was removed.