Skip to content

fix(sse,compression): graceful silent-close truncation + compressToolResults boolean guard - #10805

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.50from
minhlongs:fix/silent-sse-close-7699
Aug 21, 2026
Merged

diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.50from
minhlongs:fix/silent-sse-close-7699

Conversation

@minhlongs

Copy link
Copy Markdown
Contributor

Summary

Two production fixes shipped from a worktree off release/v3.8.50 (2f5eca2b5).

1. fix(sse): graceful max_tokens truncation on silent mid-stream close (#7699)

createDisconnectAwareStream now distinguishes:

⚠️ User-visible wording change: the empty-content Claude error message intentionally changed from "Upstream stream ended without a terminal marker" → "Provider returned empty content" (matches OpenAI/Responses branch).

2. fix(compression): only explicit boolean compressToolResults overrides step config

liteEngine: stepConfig is Record<string, unknown>, so a malformed compressToolResults value leaked through the ?? chain as {}. Now guarded with typeof === "boolean"; falls through to config.lite, then default true.

Verification

  • Tests: 68/68 — 35 in changed files (6 + 29) + 33 pre-existing blast-radius guards (empty-stream-no-content-8649.test.ts, stream-handler.test.ts)
  • npm run typecheck:core clean
  • ESLint clean on all 4 touched files
  • code-reviewer subagent: PASS

Files

  • open-sse/utils/streamHandler.ts + tests/unit/silent-sse-close-7699.test.ts
  • open-sse/services/compression/engines/cavemanAdapter.ts + tests/unit/compression/lite.test.ts

⚠️ base-red inherited: #9985 (release/v3.8.50 not green — known migration v139 collision [ccr_blocks, job_registry] in stream-utilities.test.ts artifact rotation; pre-existing, out of scope).

minhlongs added 2 commits August 20, 2026 11:39
…ose (diegosouzapw#7699)

createDisconnectAwareStream now distinguishes graceful truncation
(partial content already reached client -> clean Claude message_stop,
no 'event: error') from real empty-content failure (diegosouzapw#8649 -> still
emits 502 error, no fake 'max_tokens').

Note: empty-content Claude error message intentionally changed from
"Upstream stream ended without terminal marker" to "Provider returned
empty content" - user-visible.
… step config

lite engine stepConfig is Record<string, unknown>; malformed value
leaked through the config chain as {}. Now a typeof === "boolean"
guard; falls through to config.lite then default true.
@minhlongs
minhlongs force-pushed the fix/silent-sse-close-7699 branch from da182ef to 48f443f Compare August 20, 2026 04:42
@diegosouzapw
diegosouzapw merged commit b661b71 into diegosouzapw:release/v3.8.50 Aug 21, 2026
3 checks passed
xiaoyaner0201 added a commit to xiaoyaner0201/OmniRoute that referenced this pull request Aug 21, 2026
…fd4040)

Additive two-parent merge onto the current live head, which advanced again during
O5/R6 from b87056a to 6fd4040 (five commits: diegosouzapw#10830 Grok Build custom host,
diegosouzapw#10854 skills marketplace API-key installs, diegosouzapw#10804 Cursor account Agent endpoint,
diegosouzapw#10531 freebuff translate-path golden regen, diegosouzapw#10805 SSE silent-close truncation).

Zero file overlap with this PR's 34-file diff; the merge is conflict-free and
introduces no adaptation of either side. No force, rebase, amend, or squash.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…Results boolean guard (diegosouzapw#10805)

Two fixes: (1) createDisconnectAwareStream now distinguishes graceful max_tokens truncation (partial content already reached the client, upstream closes without a terminal marker → clean stop, no error) from a real empty-content failure (still surfaces the 502). Fixes diegosouzapw#7699, keeps diegosouzapw#8649 intact. (2) liteEngine's compressToolResults now requires an explicit boolean before overriding step config, instead of letting a malformed value leak through the `??` chain.

Validated in an isolated worktree boarded onto origin/release/v3.8.50 (0 conflicts, 4 files):
- 68/68 tests pass (silent-sse-close-7699, compression/lite, empty-stream-no-content-8649, stream-handler).
- check-file-size, check-changelog-integrity: OK.
- typecheck:core: clean.
- check-complexity / check-cognitive-complexity: OK, both under baseline.

Note: the empty-content Claude error message text changed from "Upstream stream ended without a terminal marker" to "Provider returned empty content" (matches the OpenAI/Responses branch wording) — intentional, documented in the PR.

Co-authored-by: minhlongs <minhlongs@users.noreply.github.com>
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.

2 participants