Fix task resultSummary picking a worker's opening line instead of its final text#107
Merged
Merged
Conversation
… final text latest_assistant_text scanned messages newest-first but the content parts WITHIN a message oldest-first, returning the FIRST non-empty text part of the last assistant message. Claude-provider sessions store each turn as a separate message, so the last assistant message holds only the final text and the bug never shows. Codex appserver sessions accumulate an entire run - opening remark, tool_use items, final verdict - as parts of ONE assistant message. There the summary became the worker's opening sentence (observed three times on live review tasks), and a trailing 'BLOCKED:' verdict was undetectable by classify_worker_status, so blocked Codex workers were misreported as completed. Extract the scan into a pure final_assistant_text() helper that walks both messages and parts newest-first, and cover it with unit tests including the Codex single-message regression shape.
juacker
marked this pull request as ready for review
July 11, 2026 21:38
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.
Bug
latest_assistant_text()(the source of a workspace task'sresultSummary) scanned messages newest-first but the content parts within a message oldest-first, returning the FIRST non-empty text part of the last assistant message.Why it only ever bit Codex workers: Claude-provider sessions store each turn as a separate message, so the last assistant message holds only the final text. Codex appserver sessions accumulate an entire run — opening remark, tool_use items, final verdict — as parts of one assistant message. Verified against a live Codex review session in the history DB: 1 assistant message containing 3 text parts + 14 tool_use parts → the stored summary was the worker's opening sentence (observed on three separate review tasks).
Worse than cosmetic: a trailing
BLOCKED:verdict was invisible toclassify_worker_status(), so blocked Codex workers were misreported ascompleted.Fix
final_assistant_text()helper that walks both messages AND parts newest-first, with a doc comment explaining the provider difference.[text, tool_use, text]→ returns the trailing text) and the BLOCKED-classification end-to-end path.Validation
cargo test --lib workspace_tasks: 29 passed (6 new).cargo clippy/cargo fmtclean.resultSummary(separate-message provider), corroborating the single-message root cause.