Repository navigation
fix: preserve streamed reasoning details - #2604
Merged
Merged
Conversation
This was referenced Sep 15, 2026
mikasenghaas
force-pushed
the
fix/reasoning-details-hash
branch
from
September 15, 2026 03:47
bea1899 to
d110415
Compare
mikasenghaas
commented
Sep 15, 2026
mikasenghaas
left a comment
Member
Author
There was a problem hiding this comment.
make sure this works for any streamed reasoning (no standards since oai chat completions doesnt support)
The OpenAI stream accumulator concatenates repeated string metadata in provider-specific reasoning details. Preserve scalar fields while joining reasoning text so tool requests replay the message that the interceptor recorded.
mikasenghaas
force-pushed
the
fix/reasoning-details-hash
branch
from
September 15, 2026 04:20
d110415 to
4f30b22
Compare
mikasenghaas
requested review from
eligotts,
hallerite and
samsja
and removed request for
samsja
September 15, 2026 04:35
mikasenghaas
commented
Sep 15, 2026
mikasenghaas
marked this pull request as ready for review
September 15, 2026 05:32
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped harness bug fix that preserves streamed reasoning fields and adds a mocked SSE regression test. Runtime impact is confined to the affected streamed-completion metadata path, with no schema, infrastructure, security, billing, or authentication changes. You can add or adjust custom eligibility rules. Learn more. |
hallerite
approved these changes
Sep 15, 2026
mikasenghaas
added a commit
that referenced
this pull request
Sep 15, 2026
Main fixed the cause in the bash harness's streaming path (#2604), so replayed reasoning details match verbatim and the hash needs no special case; the regression test for the mangled form goes with it.
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
reasoning, legacyreasoning_content, and structuredreasoning_detailsfields.id,index,format, andsignature.Verification
id: "r1"andformat: "unknown"replayed asid: "r1r1"andformat: "unknownunknown". The intercepted and replayed message hashes differed.uv run eval terminal-bench-2 --env.taskset.tasks '["fix-git"]' --env.agent.harness.id bash -n 1 -r 2 -c 2 --no-push: both rollouts solved the task with reward 1.0. They took 13 and 12 turns, with 1 branch each.uv run eval echo-tool-v1 ...comparison completed with reward 1.0. Basemainproduced 2 turns and 2 branches. This branch produced 2 turns and 1 branch.rolemetadata plusreasoning,reasoning_content, andreasoning_detailsstream fields.uv run pytest tests/: 87 passed, 75 skipped.uv run pre-commit run --all-files: passed.\n- Current-head live rerun after the review refactor: reward 1.0, 15 turns, 1 branch, and no errors.\n\n
Note
Preserve streamed reasoning details and role in
core.chat_accumulate_streamed_messageto core.py to concatenate reasoning text and merge compatible reasoning-detail fragments across streamed chunks.core.chatto apply these accumulated fields to the final completion message, defaulting the role toassistantwhen missing.Macroscope summarized 5367fa3.
Note
Medium Risk
Changes the shared harness streaming completion assembly path used by eval rollouts; incorrect merging could alter intercepted messages and downstream replay/hash behavior.
Overview
Fixes how the bundled harness
chat()rebuilds assistant messages from streaming chat completion chunks so provider reasoning fields survive without SDK mis-merging.Instead of forcing
role = "assistant"on the final snapshot, the stream loop now accumulates per-choice overrides forrole,reasoning,reasoning_content, andreasoning_details. String reasoning fields are concatenated across deltas;reasoning_detailsentries of the same type merge text/summary while keeping scalar metadata (id,index,format,signature) from the first chunk rather than duplicating them.Adds
test_chat_harness_preserves_streamed_reasoning, which mocks an SSE stream and asserts the assembled message matches joined reasoning text and a single structuredreasoning.textdetail.Reviewed by Cursor Bugbot for commit 5367fa3. Bugbot is set up for automated code reviews on this repo. Configure here.