Skip to content

fix(discover): read full Codex session metadata line#1223

Open
euyua9 wants to merge 1 commit intogarrytan:mainfrom
euyua9:fix/codex-session-meta-first-line
Open

fix(discover): read full Codex session metadata line#1223
euyua9 wants to merge 1 commit intogarrytan:mainfrom
euyua9:fix/codex-session-meta-first-line

Conversation

@euyua9
Copy link
Copy Markdown

@euyua9 euyua9 commented Apr 26, 2026

Summary

  • replace the fixed 128KB Codex session_meta prefix read with a bounded read-until-newline helper
  • keep the read bounded at 1 MiB so malformed files cannot cause unbounded memory use
  • update the >128KB regression test to verify discovery succeeds instead of documenting the limitation

Why

Codex session_meta stores base_instructions on the first JSONL line. The current scanner reads only the first 128KB before splitting on \n, so a valid first line larger than that is truncated and JSON.parse fails. That silently drops the Codex session from global discovery.

The scanner only needs the first line, so reading chunks until the first newline preserves the existing fast path while handling larger but valid metadata lines.

Testing

  • bun test test/global-discover.test.ts

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