Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8773f5fd21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| flushText() | ||
| if role == transcript.RoleAssistant { | ||
| return content | ||
| return strings.Join(textParts, "\n\n") |
There was a problem hiding this comment.
Preserve the combined final response through evaluator normalization
For the new Checking./tool/Done. case on a normal single-shot Qwen run, the combined response returned here does not survive evaluation: normalizeSessionResult in internal/evaluator/evaluator.go:1715-1716 replaces FinalMessage with Transcript.FinalAssistantMessage(), which now returns only Done.. Consequently, reports and output_contains/output_matches rules receive a truncated answer, potentially changing verdicts for text before the tool event. Preserve the combined response through normalization and cover the evaluator path rather than only the parser.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b336894. The parser's final message is now the text after the last tool event, the same entry the evaluator's normalization picks, consistent with Claude Code and Codex. The new test checks the two agree.
| flushText := func() { | ||
| if emitted < len(textParts) { | ||
| content := strings.Join(textParts[emitted:], "\n\n") | ||
| *messages = append(*messages, transcript.Message{Role: role, Content: content, Turn: turn}) |
There was a problem hiding this comment.
Count Qwen turns independently of rendered text fragments
When one assistant session record contains text runs separated by tool events, each flush creates another RoleAssistant entry, but buildSessionResult still derives Turns through countTurns(trans), which increments for every assistant transcript entry. The new regression fixture therefore reports two turns instead of the previous one despite containing only one source assistant response; further interleavings inflate it further. This incorrect count propagates into report turns and judge turns_executed, so preserve the source-response count independently of transcript splitting.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b336894. Turns are now counted per source assistant response with visible text, so a message split around a tool call counts once.
Splitting a session line around a tool call gave it several assistant transcript entries. countTurns counted each one, so a single response raised turns and turns_executed. Count assistant lines with visible text in the parser instead, as before the split. The parser also returned the joined text of the line as the final message, while the evaluator replaces FinalMessage with the transcript's last assistant entry. Return the text after the last tool event, so both agree and match the other engines.
Summary
When a Qwen session message contained text, a tool call and more text, the transcript showed the tool call first, followed by both text fragments.
The parser now emits each run of adjacent text before the next tool call or result, so the transcript keeps the original order.
Splitting a message this way has two side effects, and this PR handles both:
countTurnscounts every assistant transcript entry, so one split message would count as several turns. The parser now counts assistant lines that have visible text, which is the same count as before the split.Turnsandturns_executeduse that count when a session file was parsed. The stdout fallback still usescountTurns.FinalMessagewith the transcript's last assistant entry. The parser now returns the same text: the text after the last tool event. This matches Claude Code and Codex, whose final message is the last assistant text after the last tool call. It only differs from before when the last assistant line itself carries a tool call.Test plan
The session-file regression expects three transcript entries in order. It also checks that the parser's final message equals
Transcript.FinalAssistantMessage()and that the split message counts as one response. The thought-text test checks that thought-only and tool-only lines are not counted.Local checks:
go test -race ./...andmake verify.