Skip to content

[PR] fix: release completed reasoning-round response bodies - #7040

Closed
Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_release-reasoning-round-bodies
Closed

Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_release-reasoning-round-bodies

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

consumeRound stops at a Responses terminal event and releases the reader lock without cancelling the remaining HTTP body. An upstream that keeps that body open retains its connection even though the guard has finished the round. A continuation can then wait for a pool slot still occupied by its own previous round; the cleared idle timer no longer releases it.

Change

Cancel a round body whenever consumption exits before EOF, then release the reader lock. Cancellation is observed without awaiting it, so a tee's other consumer or a rejecting cancellation cannot hold up the terminal response. Completed EOF, folding decisions, output events and usage accounting retain their existing behavior.

Verification

  • Base: 301e1a5459a77d5578206927c8062a58381af642.
  • Six new regressions: 4 fail / 2 pass on the base.
  • New and existing reasoning-guard suites: 18 tests passed. Completed, failed and incomplete terminal events release open bodies; ordinary EOF retains its previous result; rejecting/pending cancellation cannot delay or replace the terminal response.
  • A real loopback upstream and a one-connection undici pool reproduce the causal failure. The first HTTP response writes a valid terminal event and remains open. On the base the continuation never obtains its connection (one request, then the fixture deadline). With the fix the second request runs, carries the original input and encrypted reasoning, and returns response.completed.
  • Full npm run typecheck, npm run build, and git diff --check: passed.
  • Codex preflight found the CLI and artifact but the configured upstream 127.0.0.1:8199 is unreachable; real four-phase host acceptance remains unrun.

All-state and author-history searches found no equivalent round-body release. #1113 handles raw passthrough/backpressure cleanup; this fixes the separate parsed reasoning-round consumer introduced in #740. The shared guard is unchanged in both compression modes apart from transport cleanup.

Fixes #7039

@ranxianglei ranxianglei changed the title fix: release completed reasoning-round response bodies [PR] fix: release completed reasoning-round response bodies Nov 17, 2026
Merge upstream master 6a641f3, including the architecture module-map and schedule-independent ranxianglei#2929 probe fixes.

Preserve the existing PR head and exact contribution patch. Validation of this refreshed head runs in upstream CI; no local test rerun is claimed.
@ranxianglei

Copy link
Copy Markdown
Owner

This fix is included verbatim (original commits and authorship preserved) in the merged batch PR #7074 — the changes are already on master. Closing to avoid a duplicate merge. 该修复已随批量 PR #7074 原样合入 master,为避免重复合并,关闭此 PR。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reasoning continuations can wait on their own completed HTTP response body

2 participants