Avoid full Codex session reads when listing and looking up sessions#2
Open
Vottivott wants to merge 1 commit intovignesh07:mainfrom
Open
Avoid full Codex session reads when listing and looking up sessions#2Vottivott wants to merge 1 commit intovignesh07:mainfrom
Vottivott wants to merge 1 commit intovignesh07:mainfrom
Conversation
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.
Summary
This fixes two Codex-specific performance problems in
ccshare:.jsonlfiles just to extract the first-linesession_meta.cwdlistSessions()scan when the user already provided an explicit Codex session idChanges
readFirstLine()helper for Codex metadata discoveryWhy
Large Codex session files can be multiple GB. The previous implementation used
readFile(..., 'utf-8')for every Codex session duringlist, and also for explicit session-id operations becausegetSession()always went throughlistSessions()first.That makes
ccshare listandccshare share/export/preview <codex-session-id>unsafe on large histories.Verification
Manual verification in an isolated temp
HOME:bun run src/cli.ts list --limit 5succeeded with a 1 GB sparse Codex session filebun run src/cli.ts export 019c70c7-9e1f-70c1-84a8-1405892852f1 -o out.htmlsucceeded with an explicit Codex session idNotes
I did not rely on
tsc --noEmitfor validation here because the repo currently has unrelated missing dependency / type environment issues in this environment.