Skip to content

fix(agents): prevent transcript redaction from corrupting signed reasoning - #103628

Merged
joshavant merged 1 commit into
mainfrom
fix/transcript-replay-signature-redaction
Jul 10, 2026
Merged

joshavant merged 1 commit into
mainfrom
fix/transcript-replay-signature-redaction

Conversation

@joshavant

Copy link
Copy Markdown
Collaborator

Closes #102244

AI-assisted: Yes (Codex). I reviewed and understand the implementation.

What Problem This Solves

Transcript redaction could mistake credential-shaped substrings inside provider-minted reasoning signatures for secrets. Rewriting those signed bytes made persisted Anthropic and Bedrock sessions fail replay with invalid-signature errors.

Why This Change Was Made

This change preserves only structurally valid opaque replay payloads in route-specific provider signature fields. OpenAI structured replay envelopes are normalized to the minimal replay metadata while their encrypted payload remains exact.

Ordinary text, malformed payloads, unknown routes, and credential-shaped values outside recognized signed fields continue through normal redaction. Existing poisoned histories continue to use the existing replay recovery path.

This does not change signature capture behavior. In particular, OpenRouter streams that use a reasoning-detail ID distinct from the tool-call ID remain a separate adapter concern.

User Impact

Users can continue Bedrock/Anthropic, Gemini, OpenAI Responses, and compatible tool-reasoning sessions across persistence, restart, and compaction without transcript redaction corrupting valid replay signatures.

Evidence

  • Focused transcript-redaction and regression suite: 421 tests passed.
  • Changed checks passed; pre-commit autoreview completed with no actionable findings.
  • Live Bedrock contract proof: exact replay accepted; missing or corrupted signatures rejected; a poisoned persisted session recovered (run_6b68bef9025b).
  • Live tool/restart replay passed for Bedrock, Anthropic, Google native, and Google OpenAI-compatible routes (run_a3439a8dee0b).
  • Packaged npm-pack: Bedrock install preserved and replayed a 2,556-character signature (run_1130e4b0c914).
  • Live OpenAI Responses ciphertext remained byte-exact through redaction and replayed in a fresh process (run_5754946d4f04).
  • Live OpenRouter Completions ciphertext remained byte-exact through redaction and replayed through the OpenClaw adapter in a fresh process (run_ae547a8a6dd1).
  • Live manual compaction reduced 29,114 tokens to 1,187 tokens, retained valid signatures, and completed a post-compaction turn (run_795c6e6608f7).
  • Live security-boundary proof redacted a credential-shaped user canary while preserving the provider signature and successful replay (run_201fe0daff8d).
  • Maintained Google/Anthropic replay and OpenAI tool-projection live suites passed (run_8a1125fe54eb, run_7ab63f698054).

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Jul 10, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 10, 2026, 2:35 PM ET / 18:35 UTC.

Summary
The PR makes transcript redaction preserve structurally valid provider reasoning signatures and replay envelopes while expanding negative and provider-route regression coverage.

PR surface: Source +69, Tests +163. Total +232 across 2 files.

Reproducibility: yes. Current-main source provides a deterministic persistence-time corruption path, and the PR supplies exact-head live assertions for valid replay, corrupted-signature rejection, recovery, and canary redaction; this read-only review did not independently execute the provider calls.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #102244
Summary: This PR is the direct candidate fix for the canonical issue’s transcript-redaction signature-corruption mechanism.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] Recognized signed provider fields containing credential-shaped bytes will intentionally bypass text substitution; the scoped route-and-grammar boundary needs explicit owner acceptance.
  • [P1] The branch is behind current main, so maintainers should refresh it and confirm the exact merged candidate retains the successful focused and live behavior proof.

Maintainer options:

  1. Approve and refresh the scoped boundary (recommended)
    Explicitly accept the signed-payload exception, refresh onto current main, and require focused plus live replay/canary proof on the resulting candidate.
  2. Tighten before merge
    Remove any provider route or replay field whose signed-payload contract is not accepted by the relevant owner, then rerun the same proof.

Next step before merge

  • [P2] No narrow code repair remains; a likely owner should approve the deliberate redaction exception and refresh the exact merge candidate against current main.

Maintainer decision needed

  • Question: Should OpenClaw approve this known-provider route and payload allowlist as the permanent exception to transcript secret redaction?
  • Rationale: The fix is technically sound but deliberately preserves credential-shaped bytes in authenticated provider-owned fields, so the permanent boundary requires explicit ownership rather than automated acceptance.
  • Likely owner: steipete — They authored the final validation and security-boundary refinements and merged the existing replay-preservation framework.
  • Options:
    • Approve the scoped exception (recommended): Accept the current route, direct-block, field, and payload-grammar constraints after refreshing the branch and confirming exact-head proof.
    • Narrow preserved routes: Limit preservation to a smaller set of directly proven provider and field combinations before merge.

Security
Cleared: No concrete security regression was found: preservation is constrained by assistant-block location, route, field, and payload grammar, while malformed, nested, unknown-route, and ordinary credential-shaped values remain redacted.

Review details

Best possible solution:

Adopt the route-, field-, and grammar-aware preservation in transcript persistence, leave global secret detectors unchanged, retain the existing poisoned-history recovery path, and validate the refreshed merge candidate.

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

Yes. Current-main source provides a deterministic persistence-time corruption path, and the PR supplies exact-head live assertions for valid replay, corrupted-signature rejection, recovery, and canary redaction; this read-only review did not independently execute the provider calls.

Is this the best way to solve the issue?

Yes. A centralized route-, field-, and grammar-aware persistence exemption fixes the corruption without weakening global credential patterns and is narrower than adding downstream provider-specific workarounds.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b56bad33f2fb.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The exact-head live output demonstrates successful byte-exact Bedrock replay, expected rejection of missing or corrupted signatures, poisoned-history recovery, and continued redaction of an ordinary credential canary.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The exact-head live output demonstrates successful byte-exact Bedrock replay, expected rejection of missing or corrupted signatures, poisoned-history recovery, and continued redaction of an ordinary credential canary.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The underlying defect can poison persisted signed reasoning and repeatedly break real provider-backed sessions after restart or compaction.
  • merge-risk: 🚨 session-state: The patch controls which exact signed reasoning bytes survive transcript persistence and later replay.
  • merge-risk: 🚨 security-boundary: The patch intentionally exempts narrowly recognized credential-shaped provider payloads from normal transcript secret redaction.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The exact-head live output demonstrates successful byte-exact Bedrock replay, expected rejection of missing or corrupted signatures, poisoned-history recovery, and continued redaction of an ordinary credential canary.
  • proof: sufficient: Contributor real behavior proof is sufficient. The exact-head live output demonstrates successful byte-exact Bedrock replay, expected rejection of missing or corrupted signatures, poisoned-history recovery, and continued redaction of an ordinary credential canary.
Evidence reviewed

PR surface:

Source +69, Tests +163. Total +232 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 104 35 +69
Tests 1 192 29 +163
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 296 64 +232

What I checked:

  • Current-main reproduction: Current main rejects an opaque replay token when normal secret redaction would alter it, causing credential-pattern collisions inside signed provider bytes to fall through to destructive redaction. (src/agents/transcript-redact.ts:258, b56bad33f2fb)
  • Scoped preservation boundary: The PR limits preservation to direct assistant content blocks and recognized route, block-type, field, and provider-specific payload grammar combinations. (src/agents/transcript-redact.ts:431, f983edbbf39b)
  • Structured replay normalization: OpenAI replay envelopes are parsed, validated, stripped to recognized metadata, and reserialized while retaining exact encrypted payload bytes. (src/agents/transcript-redact.ts:474, f983edbbf39b)
  • Negative regression coverage: Tests cover credential collisions, malformed signatures, missing routes, unknown providers, nested lookalikes, and continued redaction of ordinary secret-shaped values. (src/agents/transcript-redact.test.ts:463, f983edbbf39b)
  • Exact-head real behavior proof: The contributor posted complete assertion output showing Bedrock accepts exact replay, rejects missing or corrupted signatures, recovers poisoned history, and still redacts a credential-shaped user canary while preserving the provider signature. (f983edbbf39b)
  • Feature provenance: The route-aware replay-preservation framework originated in merged PR fix(openai): preserve opaque reasoning transcript fields #90682; its final validation commits were authored by steipete and the PR was merged by steipete. (src/agents/transcript-redact.ts:220, 66880a5d736c)

Likely related people:

  • steipete: Authored the final scoping, rejected-signature redaction, and provider validation commits for the existing replay-preservation framework and merged its canonical PR. (role: framework refiner and merger; confidence: high; commits: 4464a5437827, 3fb9e2fd3e4e, 78153640a25d; files: src/agents/transcript-redact.ts, src/agents/transcript-redact.test.ts)
  • toruvieI: Authored the original merged replay-preservation work that established the route-bound transcript-redaction framework. (role: introduced behavior; confidence: high; commits: 51bc7ca50e71, 66880a5d736c; files: src/agents/transcript-redact.ts, src/agents/transcript-redact.test.ts)
  • joshavant: Previously landed validated opaque-image handling in the same transcript-redaction module, in addition to authoring this candidate fix. (role: recent area contributor; confidence: high; commits: aef1fad58d25; files: src/agents/transcript-redact.ts, src/agents/transcript-redact.test.ts)
  • vincentkoc: Recent and earlier provider-attribution work is directly relevant to the endpoint classification newly consumed by this patch. (role: adjacent owner; confidence: high; commits: 0426f238c363, 9dccdedc074a, 0e9a9dae84a8; files: src/agents/provider-attribution.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-10T12:20:18.008Z sha f983edb :: needs real behavior proof before merge. :: none

@joshavant joshavant self-assigned this Jul 10, 2026
@joshavant

Copy link
Copy Markdown
Collaborator Author

Exact-head live behavior proof

Source: f983edbbf39b4dde4d23fbf9aa746a3c0597c9fc

Execution: direct AWS Crabbox, provider aws, lease cbx_9620679993f5.

Bedrock signed-reasoning contract and recovery

Run: run_c31dc2f46526

{"status":"BEDROCK_REPLAY_VARIANT_REJECTED_AS_EXPECTED","variant":"missing-signature","errorName":"ValidationException","signatureRelated":true}
{"status":"BEDROCK_REPLAY_VARIANT_REJECTED_AS_EXPECTED","variant":"ellipsis-corrupted-signature","errorName":"ValidationException","signatureRelated":true}
{"status":"BEDROCK_PROVIDER_CONTRACT_PASSED","model":"global.anthropic.claude-sonnet-4-6","signatureLength":368,"signatureHashPrefix":"25695ba79926c477","exactReplaySucceeded":true,"missingSignatureRejected":true,"corruptedSignatureRejected":true}
{"status":"PERSISTED_SIGNATURE_POISONED_FOR_LIVE_RECOVERY"}
{"status":"OPENCLAW_POISONED_SESSION_RECOVERY_PASSED","sha":"f983edbbf39b4dde4d23fbf9aa746a3c0597c9fc","activePoisonedSignatureCount":0,"activeThinkingBlocks":1,"recoveryLogged":true}

The run completed with exit code 0, untruncated output, and empty captured stderr.

Redacted log SHA256: 159ace2a81d1ffa907bb5f3240aa59094eb9ab369f62e8a2c1b316a0a8978986

Credential-canary security boundary

Run: run_f99958595f94

{"status":"LIVE_SECURITY_BOUNDARY_PASSED","sha":"f983edbbf39b4dde4d23fbf9aa746a3c0597c9fc","rawCanaryAbsent":true,"redactionMarkerPresent":true,"signatureCount":1,"signaturesPreserved":true,"replaySucceeded":true}

The run completed with exit code 0, untruncated output, and empty captured stderr.

Redacted log SHA256: 2a023fa28b80cfa38ebe054536d7b139af58335c5d66f95af8a948682ec1178f

Publication boundary

These are the complete assertion outputs. Provider credentials, the synthetic canary value, prompts, raw provider responses, private endpoints, IP addresses, lease-owner metadata, and agent response bodies were not published.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 10, 2026
@joshavant
joshavant merged commit 5dffe21 into main Jul 10, 2026
181 of 195 checks passed
@joshavant
joshavant deleted the fix/transcript-replay-signature-redaction branch July 10, 2026 20:13
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transcript redaction corrupts Anthropic/Bedrock reasoning signatures (AIza/LTAI false positive), causing persistent replay_invalid

1 participant