Repository navigation
fix(session-replay): preserve native materialization fidelity - #2157
Merged
Merged
Conversation
Pre-commit hook ran. Total eslint: 0, total circular: 4
Pre-commit hook ran. Total eslint: 0, total circular: 0
Pre-commit hook ran. Total eslint: 0, total circular: 0
Pre-commit hook ran. Total eslint: 0, total circular: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Switching a conversation between SDE, Codex CLI and Claude CLI can reject an unchanged native transcript. SDE writes executable
run_shellcalls, while canonical SessionEvents userun_command_line; one TS materialization path and SDE's Rust read-back projection compared those names literally. On verification failure, cleanup could delete the published transcript/binding while retaining its ledger and replay records. After a restart, Retry could also find a failed EventStore message whose durable queue owner was already gone and refuse to send it. Claude CLI's Default selection could inherit the oldest saved credential instead of its ambient native login.Solution
Normalize SDE tool names at the canonical TS/Rust projection boundaries with the existing storage alias registry, leaving the executable native history unchanged. Retain published native artifacts when read-back verification fails, so subsequent prefix and synchronization checks can examine them. On Retry, reconcile an orphaned failed queue projection for the exact session, read it back, and resubmit only when its failed state and absent ownership are proven; still reject accepted or concurrently changed rows. Resolve Claude Code Default through ambient CLI authentication, while explicit accounts keep their selected credential. Genuine transcript differences continue to stop dispatch.
Potential risks
A true verification mismatch now retains the provider-native artifact for inspection and may require explicit reconciliation. Children whose transcripts had already been deleted are not automatically reconstructed; their failed prompts and audit records must be preserved during separate recovery. Retry reconciliation adds bounded EventStore I/O only when the user clicks Retry; no polling or retained background state was added. The changed Rust read-back projection and default Claude credential selection affect provider-switch compatibility, so mixed-provider sessions merit review. There are no schema, dependency, IPC, wire, or persistence-format changes; rollback is a code revert, while retained native artifacts should be inventoried before any manual cleanup. Native six-step switching, fixed-build Retry, cold restart/read-back and two-isolated-instance Team Chat integration passed. CPU/RSS and idle/hidden resource measurements remain unverified; no runtime performance improvement is claimed.
Verification
pnpm test src/engines/SessionCore/conversations src/engines/SessionCore/__tests__/rustTsContract.test.ts— 13 files / 541 tests passed, including alias materialization, strict changed-output rejection, failure retention and subsequent synchronizationpnpm test src/engines/ChatPanel/ChatHistory/hooks/__tests__/useEditUserMessage.test.ts src/engines/SessionCore/hooks/session/__tests__/messageQueuePersistence.test.ts— 2 files / 56 tests passed, including orphaned Retry ownership and parent/child projection targetingcargo test -p org2 --lib agent_sessions::cli::native_ir::tests— 11 passed;cargo test -p org2 --lib ambient_claude_launch_does_not_inherit_a_saved_account— 1 passedpnpm typecheck:fast, targeted ESLint,pnpm check:circular,pnpm check:test-placement, changed-file rustfmt,git diff --check, and pre-commitcargo clippy -p org2— passedqueueMessageIdafter its durable queue owner disappeared; no user data was deletedcargo fmt --all -- --checkreports pre-existing formatting differences outside this diff; changed Rust files passed rustfmt individuallydocs/org2-performance-guard-2026-09-26/NativeConversationMaterialization.md. No layout change, so a screenshot does not validate the transport behavior