Two gaps in the previous commit's title link:
- Legacy rollouts. Codex's ThreadHistoryMode is Legacy by default. The local
thread store has only defaulted to Paginated since openai/codex#47900
(2026-09-24). A legacy rollout doesn't persist item_completed for a started
SubAgentActivity. It persists an event_msg instead:
{"type":"sub_agent_activity", "event_id": <call id>, "agent_thread_id",
"kind":"started", ...}. Its children got no title. That event now links
the same way, through one helper (codexAgentStarted) shared with the
item_completed path.
- Forked children. A forked child's rollout repeats its parent's history,
including the spawns of its siblings. The same call id then linked from
two files, which counted as a conflict and erased the sibling's title.
Titles are now keyed by {child, parent}, and only the file of the child's
own parent_session names it or takes a name away from it.
What was run:
- New tests. On the previous commit each fails with:
- TestCodexSubagentTaskTitleFromLegacyActivity: `legacy activity title
for child-started = "", want "Legacy started task"`.
- TestCodexSubagentTaskTitleComesFromItsOwnParent: `a fork's copy of the
parent's spawn erased the child's title: ""`.
- Broken by hand: with the parent dropped from the key, the second test
fails with `a spawn its parent never made named the child: "Only in the
fork's copy"`.
- go test -tags nogui ./internal/sessions ./internal/usage: ok.
- The event's field names come from Codex's source (protocol
SubAgentActivityEvent and the rollout persistence policy, openai/codex
669449b). Not tried: a real legacy-history Codex subagent rollout.
Hogeexxl's change (his fork branch codex/codex-session-details, f7c176c9),
cherry-picked with his authorship:
- A Codex child thread whose title is still empty after the existing
precedence takes the task_name of the parent's spawn_agent call, linked by
the call id and the SubAgentActivity "started" item that names the child's
agent_thread_id. Conflicting links leave the title empty.
- session_meta.agent_nickname is exposed as `nickname` on the list, one,
manage and overview responses, beside the title, not in place of it.
- GET /api/usage/requests and /v1/magpie/usage/requests carry `compaction`
(true/false) for Codex calls with native evidence, and leave it out
otherwise. A gateway row matched by a unique response_id takes the marker
and keeps its own model, usage, cost and kind.
- Flags bits 1024 (rowCompactionKnown) and 2048 (rowCompaction) are new.
TestRowFlagsApart covers them, and they don't overlap 1..512. The sessions
cache goes to version 21 and the calls cache to calls-v15.
Review:
- Rollout format checked against Codex's source (openai/codex 669449b):
- v2 spawn_agent args carry task_name.
- A paginated rollout persists item_completed with a SubAgentActivity
item: kind "started", id = the call id, agent_thread_id.
- SessionMeta has a top-level agent_nickname, which Codex's own list.rs
and metadata.rs read too.
- compaction_response_id lives in token_usage_record.
Gaps in legacy rollouts and in calls without a response_id are fixed in
the next two commits.
- Privacy: only a title string the user's own Codex wrote and a boolean
are added to local API responses. Nothing new goes to a vendor or to
telemetry. The ingest POST parses fields one by one, so it is unchanged.
- No .github, dependency or network changes.
What was run:
- His tests pass: go test -tags nogui ./internal/sessions ./internal/usage,
and the two new internal/gui API tests.
- Broken by hand, each caught by his tests:
- the nickname read removed;
- the conflict checks removed;
- mergeCodexCompactions broken;
- the gateway pair's setCodexCompaction removed;
- the flag read forced to true.
- Not caught:
- the parent check on the title link (covered by a test in the next
commit);
- `copy.codexCompactions = nil` in cloneCodexChunks removed. That line is
defensive only: the shared chunks never hold the map.
- The gofmt, vet and full-suite record for the three commits is in the
last one.