Repository navigation
fix(sessions): preserve transcript idempotency keys - #125221
PollyBot13 wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Pre-release note: exact beta.3 release head |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: found issues before merge. Reviewed August 18, 2026, 5:32 PM ET / 21:32 UTC. ClawSweeper reviewWhat this changesThe draft carries an idempotency key captured before transcript redaction into SQLite replay indexing so retries can deduplicate without retaining that key in transcript event JSON. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still lacks a pre-redaction durable replay identity, but this draft cannot merge because it stores caller-controlled secret-shaped keys verbatim in SQLite and uses a uniqueness domain that cannot distinguish user and assistant messages. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherSession and Gateway transcript writes redact message data before storing events, while a SQLite identity index supports replay and deduplication. The index feeds session recovery and injected assistant-message retries. flowchart LR
A[Incoming transcript message] --> B[Redact stored event]
A --> C[Derive replay identity]
B --> D[SQLite transcript event]
C --> E[SQLite identity index]
E --> F[Replay and deduplication lookup]
D --> G[Session and Gateway recovery]
Decision needed
Why: This selects a persistent secret-handling and identity-scoping boundary that implementation tests cannot decide safely. Before merge
Findings
Agent review detailsSecurityNeeds attention: The patch introduces durable storage of caller-controlled secret-shaped values outside the redacted transcript event JSON. PR surfaceSource +18, Tests +217, Other 0. Total +235 across 7 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: Adopt an owner-approved one-way, role-scoped replay identity with an explicit SQLite migration and replace the raw-key pass-through with that canonical durable contract. Do we have a high-confidence way to reproduce the issue? Yes—source inspection provides deterministic inputs: persist a secret-shaped key, or append a user then an assistant message with the same key in one session; this read-only review did not execute contributor code. Is this the best way to solve the issue? No. The patch repairs redaction-induced identity drift but violates the at-rest redaction boundary and does not scope replay identity by message role. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5cabd2b72e20. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
8b56448 to
9e69636
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
9b3a8af to
0c17f90
Compare
|
Exact-head CI classification after the test-type repair: the four remaining failed jobs all died during runner setup while downloading pinned actions from codeload ( |
0c17f90 to
5043b1d
Compare
|
@clawsweeper re-review Rebased onto current main (0b75ea3). Patch scope is unchanged. Validation: focused idempotency/redaction and chat.inject parent-id suites 8/8 pass; diff check clean. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
5043b1d to
9774b24
Compare
|
@clawsweeper re-review Rebased exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Design decision requested for durable transcript idempotencyThe current draft restores replay lookup by carrying the pre-redaction
I also traced existing consumers. The persisted key is used for restart-recovery turn matching, pre-persisted-turn reconciliation, session-manager deduplication, and transcript mirroring. The specific UUID/ Option 1 — Treat the root key as non-secret protocol metadata
Changes: narrow redactor exception, role-aware schema/index migration, collision regression, and an exact restart-recovery regression. Tradeoff: arbitrary caller-supplied keys remain readable in transcript storage. This is appropriate only if the contract explicitly says an idempotency key must never contain a secret. Option 2 — Store a role-scoped SHA-256 identity
Changes: new digest field/helper, role-aware lookup path, schema migration/backfill or mixed legacy support, recovery/mirror/session-manager refactoring, and expanded regressions. Tradeoff: the original key cannot be reconstructed. Plain SHA-256 also permits verification of guessed low-entropy keys, although generated UUID/run identifiers have high entropy. Option 3 — Store a role-scoped HMAC identityThis has the same application changes as Option 2, but uses a stable installation secret. Additional changes: secret custody, key identifier/versioning, backup/restore and rotation behavior, and fail-closed handling when the key is missing. Tradeoff: materially stronger than plain hashing only if the HMAC secret is protected separately from the agent database. It introduces substantially more lifecycle machinery. Option 4 — Introduce a dedicated internal turn/replay identity
Changes: broader producer/consumer contract migration across transcript persistence, recovery, mirroring, anchors, and tests. Tradeoff: largest change, but cleanly separates caller data from durable protocol identity. RecommendationIf root idempotency keys are contractually non-secret, Option 1 is the smallest complete repair. If arbitrary caller values must remain confidential at rest, the current draft should not merge; I would prefer Option 4, or Option 2 if every relevant consumer can be reduced to candidate equality lookup. I would use Option 3 only if OpenClaw already has an acceptable separately protected key-lifecycle owner. Could a session/Gateway owner choose which privacy contract is intended? Once selected, I can reshape the draft and add the missing cross-role and exact restart-recovery coverage. |
|
Closing as superseded by #126245, which merged the canonical transcript-identity/redaction fix into main. This draft's storage model and assertions no longer match the adopted contract; any remaining user/assistant role-collision concern should be raised separately with a current-main reproduction. |
Closes #125214
What Problem This Solves
Transcript storage redacts secret-shaped substrings before persistence. When a generated idempotency key matches that detector, the durable replay identity is mutated and exact replay/deduplication can fail.
Why This Change Was Made
This candidate keeps persisted transcript event JSON redacted while carrying the original key to the existing SQLite identity owner during the append transaction. Single-message, atomic-batch, and Gateway-injected assistant retries then use that identity index for replay lookup.
The branch is deliberately draft after exact-head adversarial review found that the apparently narrow design crosses two Critical contracts:
A robust repair likely needs a separately typed one-way identity field plus a database migration. That is a broader persistence contract and should not be invented in contributor polish without a domain maintainer choosing the seam.
User Impact
If the final design is accepted, exact retries whose idempotency keys resemble secrets will deduplicate correctly without exposing the key in transcript event JSON. This draft is not ready to merge until the identity-at-rest and role-scoping contracts are resolved.
Evidence
Exact rebased head:
9774b240630168e1103a0ff4c6956583d916556echat.injectregression: 4/4 passed.pnpm check:changedpassed on the rebased candidate.git diff --checkpassed.Owner Acceptance Card
AI-assisted: yes. Codex rebased, tested, and adversarially reviewed the candidate. The draft status is intentional pending a domain-competent maintainer decision on the dangerous boundary.