Skip to content

fix(session-replay): preserve native materialization fidelity - #2157

Merged
Neonforge98 merged 4 commits into
developfrom
codex/native-session-history-fidelity
Sep 26, 2026
Merged

Neonforge98 merged 4 commits into
developfrom
codex/native-session-history-fidelity

Conversation

@Neonforge98

@Neonforge98 Neonforge98 commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Switching a conversation between SDE, Codex CLI and Claude CLI can reject an unchanged native transcript. SDE writes executable run_shell calls, while canonical SessionEvents use run_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 synchronization
  • pnpm 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 targeting
  • cargo 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 passed
  • pnpm typecheck:fast, targeted ESLint, pnpm check:circular, pnpm check:test-placement, changed-file rustfmt, git diff --check, and pre-commit cargo clippy -p org2 — passed
  • Built and launched the native macOS instance. Computer Use completed SDE → Codex CLI → Claude CLI → Codex CLI → SDE → Claude CLI in one synthetic conversation. The Codex CLI → SDE leg first reproduced the mismatch before the Rust fix; fixed-build Retry passed and a cold restart preserved all six prompt/response pairs once
  • Two isolated local app data homes and clones (Neonforge/VantaNode) exchanged Team Chat messages without starting an Agent run. A later Agent prompt recovered both human marker strings from the shared context. This was a same-Mac dual-instance simulation, not a two-physical-Mac run
  • Read-only inspection of the failed EventStore row and local queue JSON confirmed a failed synthetic message retained queueMessageId after its durable queue owner disappeared; no user data was deleted
  • Full cargo fmt --all -- --check reports pre-existing formatting differences outside this diff; changed Rust files passed rustfmt individually
  • Architecture and lifecycle review: docs/org2-performance-guard-2026-09-26/NativeConversationMaterialization.md. No layout change, so a screenshot does not validate the transport behavior

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
@Neonforge98
Neonforge98 merged commit a378893 into develop Sep 26, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant