Skip to content

fix(codex): preserve transcript mirror identity during redaction - #126245

Merged
steipete merged 1 commit into
mainfrom
steipete/codex-transcript-mirror-append-44
Aug 19, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/codex-transcript-mirror-append-44

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #126244

What Problem This Solves

Fixes an issue where successful Codex app-server turns could lose their final mirrored transcript snapshot when a configured redaction pattern matched the generated mirror idempotency key. The model reply still completed, but durable history omitted the mirrored messages and only a warning exposed the loss.

Why This Change Was Made

Transcript redaction changed the top-level idempotencyKey after SQLite admission had captured the original value. The insert deduplicated against the redacted key, while replay lookup used the admitted key and missed. This change preserves that writer-owned control-plane identity byte-for-byte while continuing to redact message content.

Upstream Codex ordering and identity contracts were checked directly in codex-rs: turn IDs are stable submission UUIDs, item completion carries the authoritative turn/item identity, and notifications are translated serially. The defect is in OpenClaw's redaction/persistence boundary, not the Codex protocol.

AI-assisted implementation; the final diff and upstream contract were manually reviewed.

User Impact

Codex-backed conversations now retain prompt and assistant transcript rows exactly once even when custom transcript redaction patterns match the generated mirror key. Completed replies no longer silently lose durable mirrored history in this case.

Evidence

  • Production observation: the same SQLite transcript append did not insert message <uuid> mirror failure occurred 10 times over roughly seven hours while the corresponding turns completed successfully.
  • Pre-fix regression: the real SQLite prompt-then-final-snapshot sequence fails at session-accessor.sqlite-transcript-message-append.ts:144 with the production error.
  • Post-fix focused proof: 117 tests passed across:
    • src/agents/transcript-redact.test.ts
    • src/config/sessions/transcript-append-redact.test.ts
    • extensions/codex/src/app-server/transcript-mirror.test.ts
  • git diff --check passed.
  • Fresh Codex autoreview: clean, patch correctness 0.98, no actionable findings.
  • LOC: production +5/-0; tests +39/-0. The production growth is the narrow identity-preservation branch and its ownership comment; no schema, protocol, config, dependency, release, or fallback surface changed.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 19, 2026 07:38
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: codex size: XS maintainer Maintainer-authored PR labels Aug 19, 2026
Keep the writer-owned idempotency key stable across transcript redaction so final Codex snapshots replay against the admitted SQLite row instead of dropping mirrored history.\n\nCloses #126244
@steipete
steipete force-pushed the steipete/codex-transcript-mirror-append-44 branch from c58cddd to 6aee4e3 Compare August 19, 2026 07:53
@steipete
steipete merged commit 629f37e into main Aug 19, 2026
222 checks passed
@steipete
steipete deleted the steipete/codex-transcript-mirror-append-44 branch August 19, 2026 08:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex transcript mirroring drops final snapshot when redaction matches identity

1 participant