Skip to content

feat(codex): add Codex session transcript adapter support#816

Open
rehan6025 wants to merge 5 commits into
repowise-dev:mainfrom
rehan6025:feat/codex-session-adapter
Open

feat(codex): add Codex session transcript adapter support#816
rehan6025 wants to merge 5 commits into
repowise-dev:mainfrom
rehan6025:feat/codex-session-adapter

Conversation

@rehan6025

Copy link
Copy Markdown

Summary

  • Added Codex transcript support to the shared session adapter.
  • The adapter now parses Codex session metadata and tool payloads into the normal event format used by the session pipeline.
  • Added regression tests covering discovery and normalization for Codex transcripts.

Related Issues

Test Plan

  • Tests pass (pytest)
  • Lint passes (ruff check .)
  • Web build passes (npm run build) (if frontend changes)

Checklist

  • My code follows the project's code style
  • I have added tests for new functionality
  • All existing tests still pass
  • I have updated documentation if needed

@repowise-bot

repowise-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

✅ Health: 7.6 (unchanged)

📋 At a glance
6 new findings introduced.

⚠️ Change risk: moderate (riskier than 52% of this repo's commits · raw 9.0/10)
This change's risk is driven by:

  • more lines added than baseline
  • more scattered than baseline

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-15 10:54 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@RaghavChamadiya

Copy link
Copy Markdown
Member

Thanks for this @rehan6025, the adapter is wired in cleanly and the seam is right. One blocking issue and a few smaller things.

Blocking: discover() returns nothing in real usage, and the discover test fails.

The last commit switched to a non-recursive glob:

return sorted(path for path in root.glob("*.jsonl") if path.is_file())

But Codex writes rollouts into a date-nested tree (~/.codex/sessions/YYYY/MM/DD/*.jsonl), which the module docstring and #785 both call out. A non-recursive *.jsonl only matches files sitting directly under sessions/, so it finds nothing in the real layout and no transcripts ever reach the miners.

I ran the branch to confirm. test_discover_lists_jsonl_sorted creates nested files and currently fails:

tests/unit/sessions/test_codex_adapter.py::test_discover_lists_jsonl_sorted FAILED
E AssertionError: assert [] == ['a.jsonl', 'b.jsonl']
1 failed, 2 passed

So the "pytest passes" box isn't accurate on the current head. Switching to root.rglob("*.jsonl") fixes both the real-world discovery and the test. Worth double checking whatever motivated the non-recursive change, since it goes against the documented Codex layout.

Fixture isn't real-shaped. tests/unit/sessions/data/codex_session.jsonl uses an invented flat shape (top-level type: "assistant", top-level text and tool_calls[]). Real Codex rollouts, which _fill_response_item and _event_kind are actually built for, use session_meta / response_item / event_msg with a nested payload. The inline test does exercise the real shapes, so the code path is covered, but #785 specifically asks for a real-shaped fixture and to confirm the format first. Suggest replacing the fixture with an actual multi-line rollout.

No miner-level test. #785's "done when" includes the decisions and demand miners producing non-empty output on a fixture with the relevant tool calls. Right now the tests only check normalize() field mapping. Since tool-name normalization is the load-bearing part, one end-to-end test through a miner would guard against regressions the field checks miss.

Smaller stuff:

  • parse_timestamp is duplicated verbatim from claude_code.py. Import it instead of copying.
  • codex.py is missing a trailing newline.
  • discover() ignores repo_root and returns every session on the machine. That works because the miners re-filter by cwd, but a one-line comment noting that would help, since the Claude adapter narrows by repo in discover itself.

The tool-name aliases line up with what the demand miner keys on, so that part looks good. The recursive-glob fix is the one that has to land; the rest is follow-up.

@rehan6025

Copy link
Copy Markdown
Author

Thanks for the detailed review! I'll address the recursive discovery issue and work through the remaining feedback, then push an update.

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.

[Feature] Codex session adapter: mine decisions and demand-weight docs from Codex transcripts

2 participants