Skip to content

fix(readers): repair amplifier/claude-code, add codex + copilot#3

Merged
Joi merged 1 commit into
mainfrom
fix/readers-multi-source
May 18, 2026
Merged

fix(readers): repair amplifier/claude-code, add codex + copilot#3
Joi merged 1 commit into
mainfrom
fix/readers-multi-source

Conversation

@Joi
Copy link
Copy Markdown
Owner

@Joi Joi commented May 18, 2026

Summary

Two existing readers had drifted out of sync with their source formats, so nightly runs were silently producing zero signals against real data. This PR restores both readers and adds two of the planned readers already listed in the README.

  • amplifier — Discover both the legacy flat layout and the current nested layout (<projects>/<project>/sessions/<sess>/{transcript,events}.jsonl). Newer Amplifier sessions write events.jsonl instead of transcript.jsonl; the loader synthesizes Schema-B messages from prompt:submit (user), llm:response text blocks (assistant), and tool:post (tool, with structured success/output preserved so detect_errors still fires on success: false).
  • claude-code — Unwrap the {type, message: {role, content}} wrapper that real Claude Code lines now use. Legacy flat {role, content} lines continue to parse. Session-meta lines (last-prompt, permission-mode, ai-title, attachment, file-history-snapshot) are skipped.
  • codex (new) — Walks ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl and emits user + assistant messages from response_item lines whose payload.type is message. Drops developer (system prompt) and non-message response items (reasoning, function_call, custom_tool_call).
  • copilot (new) — Walks ~/.copilot/session-state/<uuid>/events.jsonl and emits messages from user.message and assistant.message events. Session metadata (session.*, assistant.turn_*, system.message) is skipped.

Wire-up

  • jilog-review/src/readers/mod.rs: re-export CodexReader, CopilotReader.
  • jilog/src/config.rs: add type = "codex" and type = "copilot" variants with sensible default paths (~/.codex/sessions, ~/.copilot/session-state).
  • README.md: refresh the Readers table and the Quick Start config example.

Test plan

  • cargo test -p jilog-review — 83/83 pass, including 6 new unit tests
  • cargo build — clean
  • Smoke test against a real multi-harness machine: 24h window jumped from 0 sessions / 0 signals to 67 sessions / 101 signals (69 corrections, 23 errors, 8 workarounds, 1 deferral, 1 P0 alert)
  • CI green

New tests cover:

  • amplifier: legacy flat layout, current nested layout, events-only sessions, both-present preference, events synthesis (user + assistant + tool with success: false)
  • claude-code: wrapped message field + meta-line skipping
  • codex: dated rollout discovery, role filtering (user/assistant kept, developer dropped, non-message response items dropped)
  • copilot: session-state discovery, role filtering (user.message and assistant.message kept, all session metadata dropped)

Two existing readers had drifted out of sync with their source formats,
so nightly runs were silently producing zero signals against real data.
This restores both and adds two of the planned readers from the README.

- amplifier: walk both the legacy flat layout
  (`<projects>/<sess>/transcript.jsonl`) and the current nested layout
  (`<projects>/<project>/sessions/<sess>/{transcript,events}.jsonl`).
  Newer Amplifier sessions write `events.jsonl` instead of
  `transcript.jsonl`; the loader synthesizes Schema-B messages from
  `prompt:submit` (user), `llm:response` text (assistant), and
  `tool:post` (tool, with structured result preserved so detect_errors
  still fires on `success: false`).
- claude-code: unwrap the `{type, message: {role, content}}` wrapper
  format. Legacy flat lines continue to parse. Session-meta lines
  (last-prompt, permission-mode, ai-title, attachment,
  file-history-snapshot) are skipped.
- codex (new): walks `~/.codex/sessions/**/rollout-*.jsonl` and emits
  user + assistant Schema-B messages from `response_item` lines whose
  `payload.type` is `message`. Drops `developer` (system prompt) and
  non-message response items (reasoning, function_call, custom_tool_call).
- copilot (new): walks `~/.copilot/session-state/*/events.jsonl` and
  emits Schema-B messages from `user.message` and `assistant.message`
  events. Session metadata (start/shutdown/turn_*/system.message) is
  skipped.

Wire-up:
- jilog-review/src/readers/mod.rs: re-export CodexReader, CopilotReader.
- jilog/src/config.rs: add `type = "codex"` and `type = "copilot"`
  reader variants with sensible default paths.
- README: refresh the Readers table and Quick Start example.

Tests: 6 new unit tests covering legacy + nested + events-only +
both-present amplifier layouts, the wrapped claude-code shape, codex
message vs. non-message + role filtering, and copilot message vs.
session metadata. All 83 jilog-review tests pass.
@Joi Joi merged commit 7e10427 into main May 18, 2026
1 check passed
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