Skip to content

refactor: replace unmaintained SSE dependencies to restore stream reliability#3036

Open
amitksingh1490 wants to merge 5 commits intomainfrom
reqwest-eventsource-unmaintained
Open

refactor: replace unmaintained SSE dependencies to restore stream reliability#3036
amitksingh1490 wants to merge 5 commits intomainfrom
reqwest-eventsource-unmaintained

Conversation

@amitksingh1490
Copy link
Copy Markdown
Contributor

@amitksingh1490 amitksingh1490 commented Apr 16, 2026

Summary

Replace the unmaintained SSE transport stack with maintained components to restore dependable streaming behavior and clear provider error reporting across OpenAI-compatible and Bedrock flows.

Context

Our prior streaming path depended on libraries and integration behavior that had effectively stagnated for roughly two years. As provider APIs evolved, this created increasing operational risk: stream stalls after reasoning, EOF/reconnect edge cases, and confusing surfaced errors (including cases where provider intent was obscured by generic wrapper messages).

This PR focuses on reducing that reliability risk and improving user trust in streaming outputs under normal and throttled conditions.

Changes

  • Migrated SSE transport/repository wiring to the maintained event source stack and parser flow.
  • Added dedicated transport plumbing to preserve upstream response metadata required for correct event stream handling.
  • Updated provider stream adapters (OpenAI responses path, Anthropic/Google/OpenAI shared event handling, Bedrock stream handling) so terminal stream conditions and provider errors are surfaced predictably.
  • Standardized retry/error classification behavior around real provider semantics, including Bedrock connection-capacity failures.
  • Added regression coverage around stream termination and provider-specific error classification.

Why this matters

  • Reliability: avoids hangs/stalls caused by brittle end-of-stream handling.
  • Operational safety: reduces dependence on aging, low-maintenance stream integration points.
  • Clarity: users now see provider-meaningful failures instead of ambiguous wrapper errors.
  • Maintainability: consolidates streaming behavior around actively maintained dependencies and clearer adapter boundaries.

Testing

  • cargo +nightly fmt --all && cargo +nightly clippy --all-features --workspace --all-targets --fix --allow-dirty -- -D warnings
  • cargo nextest run --all-features --workspace
  • cargo test -p forge_repo provider::bedrock::tests
  • cargo build

Why: our previous SSE dependencies had effectively stalled maintenance for about two years, and stream reliability issues (EOF handling, stalls, and provider-specific error surfacing) were becoming operational risk. This change moves the transport/repository stack to actively maintained components and aligns retry/error semantics so users get clear provider messages instead of ambiguous stream failures.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@github-actions github-actions bot added the type: refactor Code refactoring and restructuring. label Apr 16, 2026
amitksingh1490 and others added 4 commits April 16, 2026 14:43
Fixes clippy::string_slice and clippy::indexing_slicing errors in:
- forge_repo/src/provider/event.rs
- forge_repo/src/provider/retry.rs
- forge_repo/src/provider/sse_parser.rs

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: refactor Code refactoring and restructuring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant