Repository navigation
refactor(codex): name child transcripts by role - #8213
Conversation
A rollout whose session_meta names a parent thread is a native child's. It is saved as <agent>-sub<seq>-<role>.jsonl, the name fullsend-ai#6970 gives: seq counts the kept child rollouts in ascending basename order, role is the child's agent_role when it is a valid persona key and generic otherwise (an unnamed child records a null role). The root keeps <agent>-<basename>. Path containment, rollout validation and redaction are unchanged. main keeps codex's multi-agent tools off, so no run produces a child rollout yet. Signed-off-by: Dharit Shah <dhshah@redhat.com>
PR Summary by QodoName Codex child transcripts by role and sequence
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
|
🤖 Finished Review · ✅ Success · Started 10:22 PM UTC · Completed 10:31 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.05 |
…cript ValidSubagentKey admits "default", a config key that never names a persona; the reserved list is what refuses it. A child whose rollout records a reserved name is now named generic, like one with a null or malformed role. Signed-off-by: Dharit Shah <dhshah@redhat.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Risk Assessment: moderate (2/5) DetailsSmall two-file PR with balanced test coverage and no protected path changes, elevated to moderate risk by strong historical coupling and recent fix history on the codex runtime components. Previous runRisk Assessment: moderate (2/5) DetailsSmall two-file PR with balanced test coverage and no protected path changes, elevated to moderate risk by strong historical coupling and recent fix history on the codex runtime components. Previous run (2)Risk Assessment: moderate (2/5) DetailsSmall two-file PR with balanced test coverage and no protected path changes, elevated to moderate risk by strong historical coupling and recent fix history on the codex runtime components. Previous run (3)Risk Assessment: moderate (2/5) DetailsSmall two-file PR with balanced test coverage and no protected path changes, elevated to moderate risk by strong historical coupling and recent fix history on the codex runtime components. |
|
Looks good to me Earlier findings
Previous runReviewFindingsMedium
Low
Earlier findings
Next steps:
Previous run (2)ReviewFindingsLow
Earlier findings
Next steps:
Previous run (3)ReviewFindingsLow
|
|
🤖 Finished Review · ✅ Success · Started 10:33 PM UTC · Completed 10:40 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.42 |
Superseded by updated review
…ut of new names A rollout whose name this extraction already saved is skipped before the reservation would truncate the saved file, whichever of the two was listed first. A role the artifact redactor would mask is no role, so the child is named generic like one with a reserved name. A test covers a child name the output root refuses. Signed-off-by: Dharit Shah <dhshah@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 10:50 PM UTC · Completed 10:57 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.43 |
…s name DownloadFile lands a file at outputDir/<remote basename> before renaming it to the staging name, so a later rollout with a saved transcript's name as its basename would overwrite that transcript on the way in. The saved-name guard now covers the basename as well. A test with the triage label and a later triage-sub1-correctness.jsonl that fails validation shows the child's contents survive. Signed-off-by: Dharit Shah <dhshah@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 11:09 PM UTC · Completed 11:14 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.06 |
Superseded by updated review
waynesun09
left a comment
There was a problem hiding this comment.
LGTM. A Codex review of 751ffaf found nothing at medium or above. The earlier findings are all fixed or answered.
Summary
A child rollout, one whose
session_metanames aparent_thread_id, is saved as<agent>-sub<seq>-<role>.jsonl, the name #6970 gives.<seq>counts the kept child rollouts instart-time order;
<role>is the child'sagent_rolewhen it is a valid persona key andgenericotherwise (an unnamed V1 child records a null role). The root keeps
<agent>-<basename>. Namingonly, as in #6970.
Inert until PR 6:
mainregisters no roles and keeps the multi-agent tools off (#7829), so no runproduces a child rollout before the switch; every current run's artifacts are byte-equal.
Related Issue
Part of #6970. Supersedes the transcript part of #7809 (closed).
Changes
internal/runtime/codex_transcript.go: sort thefindlisting by rollout basename; decode line1 of each validated rollout (
codexSessionMeta,codexReadSessionMeta); name a child by itsrole (
codexChildTranscriptName,codexGenericRole). Containment, rollout validation andredaction are called as before. On review: a rollout whose local name or basename is a
transcript this extraction already saved is skipped before anything is truncated or
downloaded over it, and a role the artifact redactor would mask is no role.
internal/runtime/codex_transcript_test.go: a per-path fakeopenshell(the shared fake servesone body for every download); cases: named role, null role, invalid role, two children with the
same role (seq 1 and 2), root unchanged, first line not a
session_meta(kept under itsbasename, as today), not a rollout (discarded, as today), a reserved name (
default) asrole; a child is redacted.
docs/contributing/runtime-implementation.mdwas consulted: its Codex transcript rows (rolloutsession JSONL, validated and redacted;
transcripts/holds rollouts) stay true, and theuser-facing child name lands with the switch PR's Artifacts row.
Interpretations, for a maintainer to correct:
<seq>counts kept child rollouts only, 1-based andunpadded, in ascending basename order (pi uses the dispatch index and keeps a gap for a discarded
child; on Codex the runner sees only the files). A null, empty, malformed or reserved role
(
default, which is a config key and never a persona name) or credential-shaped role isgeneric. Only the first non-blank line decides identity.Testing
make lintpasses (staged first)TestCodexChildTranscriptName,TestCodexReadSessionMeta,TestCodexExtractTranscripts_NamesChildrenByRole,TestCodexExtractTranscripts_ChildNameRejected,TestCodexExtractTranscripts_DownloadLandingNameSaved; the existing transcript tests are unedited.Before the
ExtractTranscriptschange, the new test failed on the names: the four children weresaved under
<agent>-<basename>.go test -race ./internal/runtime/andmake go-testgreen;go vetclean.origin/mainat0864bdc1; Codex pinCODEX_VERSION=0.159.3.go tool cover -func):codexChildTranscriptNameandcodexReadSessionMeta100%,
ExtractTranscripts83.5%.Checklist
🤖 Generated with Claude Code