Fix Claude Code and Codex trace import parsing#4
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes two importer parsers — Claude Code and Codex — to correctly handle content types that were previously unknown or misclassified. It also adds a regression test suite covering the new paths.
Confidence Score: 5/5Safe to merge — all changed parsing paths are exercised by the new regression tests and produce the expected outputs. The changes are narrowly scoped to two importers: adding thinking-block extraction in Claude Code and fixing event-message deduplication plus function_call_output ordering in Codex. The new test file covers each modified path (thinking blocks, server_tool_use, web_search_tool_result, event_msg user/agent messages, function_call_output, and the legacy response_item fallback). No existing behaviour is removed; the only control-flow change (function_call_output checked before function_call) is a clear correctness fix, not a regression risk. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[JSONL row] --> B{item.type?}
B -->|event_msg| C{payload.type?}
C -->|user_message| D[codexUserMessageContent\n→ push user message]
C -->|agent_message| E[extractTextContent\n→ push assistant message]
B -->|response_item| F{payload.type?}
F -->|message| G{hasEventMessages\n&& isConversation?}
G -->|No → include| H[push message\nwith role]
G -->|Yes → skip| I[deduplicated]
B -->|assistant/user| J[extractClaudeContent\non content array]
J --> K{block.type?}
K -->|thinking| L[return block.thinking]
K -->|text / tool_use\nredacted_thinking| M[extractTextContent]
K -->|server_tool_use\nweb_search_tool_result\ntool_result| N[push ToolEvent\ninputSummary or outputSummary\n+ toolUseId]
A --> O{candidateType regex?}
O -->|function.*output\ntool.*output| P[ToolEvent\noutputSummary + call_id]
O -->|function_call\ntool_call\nshell\ncommand| Q[ToolEvent\ninputSummary + call_id\n+ rawInputRedacted]
Reviews (3): Last reviewed commit: "address greptile review feedback (greplo..." | Re-trigger Greptile |
Summary
Sources checked
Verification