Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/vouch/transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,16 @@ def flush() -> None:
session["git_branch"] = git["branch"]
continue

# codex records the turn's model on `turn_context`, not on
# `session_meta`, so without this the normalized transcript's model
# is always none for codex while the claude parser fills it. first
# non-empty wins (the model can change across turns; keep the first).
if rtype == "turn_context":
model = payload.get("model")
if isinstance(model, str) and model.strip() and session["model"] is None:
session["model"] = model.strip()
continue

if rtype != "response_item":
continue
if len(messages) >= max_messages:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_session_transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def test_handler_returns_degraded_when_absent() -> None:
{"type": "session_meta", "payload": {
"id": "cx-1", "cwd": "/repo", "timestamp": "2026-06-22T08:01:54Z",
"git": {"branch": "feat/x"}}},
{"type": "turn_context", "payload": {
"turn_id": "t1", "cwd": "/repo", "model": "gpt-5-codex"}},
{"type": "response_item", "payload": {
"type": "message", "role": "developer",
"content": [{"type": "input_text", "text": "<permissions>boilerplate"}]}},
Expand Down Expand Up @@ -245,6 +247,8 @@ def test_parse_codex_pairs_calls_and_skips_boilerplate(tmp_path: Path) -> None:
assert out["session"]["agent"] == "codex"
assert out["session"]["cwd"] == "/repo"
assert out["session"]["git_branch"] == "feat/x"
# codex carries the model on turn_context, not session_meta
assert out["session"]["model"] == "gpt-5-codex"

roles = [m["role"] for m in out["messages"]]
assert roles == ["user", "assistant"] # developer message skipped
Expand Down
Loading