feat: parse full response_item transcript coverage (#13) - #37
Open
ayushsingh82 wants to merge 1 commit into
Open
feat: parse full response_item transcript coverage (#13)#37ayushsingh82 wants to merge 1 commit into
ayushsingh82 wants to merge 1 commit into
Conversation
…ai#13 part 1) parseTranscript() only recognized response_item entries with payload.role === "assistant", extracting just "output_text" content blocks. Recent Codex JSONL transcripts also carry: - user messages as response_item.payload.type === "message" with role: "user" and "input_text" content blocks - assistant messages using "text" blocks in addition to "output_text" - function_call entries (tool invocations) - function_call_output entries (tool results) None of these were captured, so automatic memory capture could miss user intent and tool context on transcripts that are mostly response_item-shaped rather than legacy event_msg-shaped. parseTranscript() now handles all of the above, with tool calls/results recorded as bounded, truncated "tool"-role entries (capped at 500 chars with a truncation marker) rather than raw unbounded output. Since a rollout file can log the same turn in both the legacy event_msg shape and the current response_item shape, entries are deduped when an identical (role, content) pair recurs within a small line window, so turns aren't captured twice. signals.ts's groupEntriesIntoTurns() now carries "tool" entries into the turn's captured content without scanning them for signal keywords, since bounded tool output is noisy and shouldn't itself trigger a capture. transcript.ts is now bundled to dist/services/transcript.js (same pattern as session.js/tags.js/resultMerge.js) so this can be unit-tested directly against real transcript fixtures instead of only through the hook binaries.
Contributor
Author
|
@Dhravya parses full |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses part 1 of #13 (the transcript-coverage half; the per-project tag override half is a separate, larger change and not included here).
parseTranscript()insrc/services/transcript.tsonly recognizedresponse_itementries withpayload.role === "assistant", and only extractedoutput_textcontent blocks. Recent Codex JSONL transcripts also carry, per #13:response_item.payload.type === "message"withrole: "user"andinput_textcontent blocks — previously dropped entirelytextblocks in addition tooutput_text—textblocks were previously droppedfunction_callentries (tool invocations) — previously dropped entirelyfunction_call_outputentries (tool results) — previously dropped entirelyOn a transcript that's mostly
response_item-shaped rather than legacyevent_msg-shaped, automatic capture could miss user intent and tool context.Changes
parseTranscript()now extracts all of the above. Tool calls/results are recorded as bounded, truncated"tool"-role entries (capped at 500 chars with atruncated, N more charsmarker) rather than raw unbounded output, per the issue's ask to filter/truncate tool context.event_msgshape and the currentresponse_itemshape, entries are now deduped when an identical(role, content)pair recurs within a small line window — so the same turn isn't captured twice.signals.ts'sgroupEntriesIntoTurns()now carries"tool"entries into a turn's captured content, but doesn't scan them for signal keywords — bounded tool output is noisy and shouldn't itself trigger a capture.build.mjsnow also emitstranscript.jsas a standalonedist/services/transcript.jsbundle (same pattern already used forsession.js/tags.js/resultMerge.js), so this could be tested against real JSONL fixtures instead of only through the hook binaries.Test plan
npm run typecheck— no new errors introduced by this change (4 pre-existing errors onmain, unrelated to this file, are already being fixed in fix: don't lose capture delta on failed upload; restore clean typecheck #36)npm test— 74/74 pass, including 6 new fixture-based tests intest/unit.mjsunder "Codex transcript parsing":response_itemuser messages frominput_textblocksresponse_itemassistant messages fromoutput_textandtextblocksfunction_call/function_call_outputas bounded tool entries, verifying truncationevent_msgandresponse_itemevent_msg-only transcripts still parse unchanged (regression guard)