fix(cloud): push live CLI session transcripts on share - #649
Open
Neonforge98 wants to merge 1 commit into
Open
Conversation
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
Sharing a live CLI session (
cliagent-*— Claude Code, Codex CLI, … GUI sessions) publishes a permanently hollow cloud copy: the row is created with the rightaccess_mode/visibility and metadata, butevents_countstays 0, so the recipient forever sees "No activity yet — Session data may not have loaded" and Reload does nothing.Root cause:
loadPushEventsreads non-imported sessions fromeventStoreProxy.getPersistedEvents(the SQLite events cache). Live CLI sessions never write that cache — their transcript of record is the CLI's native store (account-profile aware, e.g.~/.orgii/claude-code-cli-profiles/<account>/projects/…jsonl). The engine reads 0 events with no cursor, silently upserts metadata only, and then stamps the event plane clean, so subsequent passes skip the session entirely. The owner's own replay hydrates from the native transcript, which is why this is invisible on the sharing side and only the recipient breaks.Solution
When the persisted events cache is empty for a CLI session, load the full native transcript through
cli_agent_chunks— the same profile-home-aware command the session-resume path uses — and convert withprocessChunksRust, mirroring the imported-history branch. A populated events cache still wins, so sessions that do persist (forks, cloud replays) keep their existing path, and non-CLI sessions are untouched.Verification
org2CloudSyncEngine.sessions.test.tspin both directions (empty cache → native transcript chunks; populated cache → no chunks call). Fullsrc/features/Org2Cloudsuite: 1043 passed.pnpm typecheckclean.events_count: 0across restarts and new activity on the unfixed build. With this fix installed, the first sync pass pushed 7 events (events_epoch: 1), and the second instance (different cloud account) rendered the full replay — all three rounds navigable via the round switcher, correct owner attribution, no synthetic-round pollution.Risks
The fallback only fires when the events cache is empty AND the session id is
cliagent-*. Chunk→event conversion is the same deterministic pipeline the imported-history push already relies on, so freeze-line/epoch/hash behavior is unchanged. Mid-turn reads produce a prefix snapshot; the next pass appends, as with imported sources. Rollback is a revert.🤖 Generated with Claude Code