Skip to content

fix(memory-ingest): render Codex rollout message bodies#2132

Open
genisis0x wants to merge 1 commit into
garrytan:mainfrom
genisis0x:codex-rollout-bodies
Open

fix(memory-ingest): render Codex rollout message bodies#2132
genisis0x wants to merge 1 commit into
garrytan:mainfrom
genisis0x:codex-rollout-bodies

Conversation

@genisis0x

Copy link
Copy Markdown
Contributor

Closes #2105.

Problem

gstack-memory-ingest renders every Codex rollout session with an empty body (message_count: 0). Current Codex rollout JSONL carries each turn as a response_item record with the message on payload.{type:"message", role, content[]}:

{ "type": "response_item", "payload": { "type": "message", "role": "user"|"assistant"|"developer", "content": [...] } }

but parseTranscriptJsonl (bin/gstack-memory-ingest.ts) only extracts content when rec.payload.message is present (the older shape). That branch never fires on the current format, so the message loop counts zero turns and stages an empty page for every Codex transcript.

Fix

Handle the current payload.type === "message" shape alongside the legacy payload.message wrapper: read payload.role and flatten payload.content through the existing extractContentText helper. Legacy sessions keep working.

Test

Adds a product-path regression in test/gstack-memory-ingest.test.ts that ingests a response_item-format Codex session through the full --bulk path (fake-gbrain staging shim, same pattern as the NUL-byte test) and asserts the staged transcript renders both the user and assistant turns. It fails on the old parser (staged body empty, message_count: 0) and passes with the fix.

bun test test/gstack-memory-ingest.test.ts -> 24 pass. No template/SKILL.md change, so no regeneration; no VERSION bump (same as other bin/skill bug-fix PRs).

Codex rollout JSONL now carries each turn as a `response_item` record
with the message on `payload.{type:"message", role, content[]}`, not on
the legacy `payload.message`. parseTranscriptJsonl only read
`payload.message`, so every Codex session imported with an empty body and
message_count 0.

Handle the current `payload.type === "message"` shape alongside the
legacy wrapper: read `payload.role` and flatten `payload.content`. Adds a
product-path regression that ingests a response_item session and asserts
the staged transcript renders both the user and assistant turns (fails on
the old parser with an empty body).

Closes garrytan#2105
@trunk-io

trunk-io Bot commented Jun 29, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant