Skip to content

port(omniroute): #7093 - bound relay SSE stream lifetime past response headers - #267

Merged
bloodf merged 2 commits into
devfrom
port/omniroute-7093
Jul 16, 2026
Merged

bloodf merged 2 commits into
devfrom
port/omniroute-7093

Conversation

@bloodf

@bloodf bloodf commented Jul 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • What changed: Port of fix(relay): bound Bifrost stream lifetime diegosouzapw/OmniRoute#7093 — bound relay SSE stream lifetime so relay streams are torn down deterministically past response headers / terminal events (abort, timeout, malformed terminal) instead of leaking listeners and hanging sockets. Adds open-sse/utils/relayStreamLifecycle.js (lifecycle helper) and open-sse/utils/quotaTerminalReason.js (terminal-reason classification), wired into open-sse/executors/base.js, open-sse/handlers/chatCore.js, open-sse/services/providerAttemptContext.js, open-sse/utils/proxyFetch.js.
  • Why it changed: upstream OmniRoute #7093 fixed relay SSE streams whose lifetime was unbounded past response headers, leaking resources and stalling cleanup on abort/timeout paths; durindoor shares the relay subsystem and had the same unbounded lifetime.

Type

  • fix: — bug fix (resource-leak / cleanup correctness)

Breaking changes

  • No

Testing

  • What was tested: the 3 new unit suites covering the ported behavior — tests/unit/relay-stream-lifecycle.test.js, tests/unit/relay-terminal-reason.test.js, tests/unit/base-executor-relay-sse.test.js — plus lint and production build.
  • Commands run: npm run lint; npm run build; vitest run unit/relay-stream-lifecycle.test.js unit/relay-terminal-reason.test.js unit/base-executor-relay-sse.test.js; bash .omc/gate.sh <worktree> (all under pinned Node 20.20.2).
  • Evidence: lint 0 errors (168 pre-existing warnings); Next.js build completed; targeted suites 3 files / 23 tests all pass. Full local gate run hit fleet-wide host load contention (load avg 130+/16) causing mass timeouts in 86 unrelated suites — signature matches the flake confirmed by sibling merge agents; CI required checks on this PR are the authoritative full-suite run.

Checklist

  • Tests added or updated for behavioral changes (3 new suites, 23 tests)
  • No new dependencies without explicit justification (none added)
  • Conventional commit used (port(omniroute): #7093 - bound relay SSE stream lifetime past response headers)
  • CHANGELOG updated if this change is user-facing (internal relay robustness fix; doc artifact = JSDoc module comments at the new change sites relayStreamLifecycle.js and quotaTerminalReason.js, per AGENTS §1 doc-artifact options)
  • No secrets, keys, credentials, or tokens committed

Existing PRs

Searched open + closed PRs for 7093 / relay SSE stream lifetime: no duplicates — only this PR (#267). Related relay work merged earlier (#46 provider batch, #145 CI-gate stabilization) does not cover relay stream lifetime bounding.

Provenance

Agent-generated port. Model: durindoor/kimi/kimi-k2.7 via Oh My Pi harness; implemented by a wave-G port subagent, verified and merged via the upstream-pr-import orchestration (worktree .omc/wt-port-om-7093, branch port/omniroute-7093, head 1ed9203). No plugins beyond the harness.

Ported-By: port(omniroute) wave-G

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ed92036d8

ℹ️ 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".

Comment thread open-sse/executors/base.js
@bloodf
bloodf force-pushed the port/omniroute-7093 branch from 1ed9203 to 1fc4ead Compare July 16, 2026 03:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1fc4eadba3

ℹ️ 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".

Comment thread open-sse/utils/relayStreamLifecycle.js
CortexOS added 2 commits July 16, 2026 17:49
…r graceful EOF

- Abort the connect timer with a named TimeoutError (DOMException) and pass
the internal timeout signal separately so relayStreamLifecycle can preserve
only the exact internal reason by identity, never a caller-side
AbortSignal.timeout() TimeoutError.
- In createDisconnectAwareStream, treat named TimeoutError as a hard error
rather than a caller/network abort, so truncated SSE streams reach the client
as terminal failure instead of clean EOF.
- Add pipeWithDisconnect regression test: partial bytes delivered, then
internal TimeoutError rejects the next read.

Addresses Codex P2 on PR #267.
@bloodf
bloodf force-pushed the port/omniroute-7093 branch from 1fc4ead to 2fc1d09 Compare July 16, 2026 17:50
@bloodf
bloodf merged commit 4314051 into dev Jul 16, 2026
3 checks passed
@bloodf
bloodf deleted the port/omniroute-7093 branch July 17, 2026 02:50
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.

1 participant