Capture Git and PR Metadata in Session Files
Resolved 💬 1 comment Opened May 8, 2026 by lyledean1 Closed May 8, 2026
What variant of Codex are you using?
cli
What feature would you like to see?
Today the session JSONL includes cwd, timestamps, and conversation data, but no git or PR identifiers. That means any linkage to a branch, commit, or PR has to be inferred later from the current state of the local repo or GitHub, which is inherently lossy because branches move, PRs close, and repositories change over time. The request is for Codex CLI to capture immutable repository context at session start, and optionally refresh selected fields during the session.
Suggested fields in session_meta:
- repo_root
- git_branch
- git_commit_sha
- git_commit_short_sha
- git_remote_url
- github_pr_number nullable
- github_pr_url nullable
- github_pr_title nullable
Behavior:
- Populate git fields whenever cwd is inside a git repo.
- Populate PR fields when a PR can be resolved from the current branch or commit.
- Fail soft when git/GitHub context is unavailable.
- Prefer capturing this at session creation so exported data reflects the session’s actual historical context rather than current repo state.
Why it matters:
- Enables reliable joins between Codex sessions and PRs/commits in BigQuery or other analytics systems.
- Makes debugging and auditing easier.
- Preserves historically accurate context for long-lived or later-exported sessions.
Additional information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗