refactor(sse-crates): vendor reqwest-eventsource and eventsource-stream as forge_eventsource and forge_eventsource_stream#3211
Merged
laststylebender14 merged 6 commits intomainfrom Apr 30, 2026
Conversation
924e5cc to
76ebde9
Compare
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
Vendor the
reqwest-eventsourceandeventsource-streamcrates as first-party workspace crates (forge_eventsourceandforge_eventsource_stream), giving the project full control over their source code and eliminating external dependency pins.Context
The project relied on two crates (
reqwest-eventsource v0.6.0andeventsource-stream v0.2.3) from crates.io for Server-Sent Events (SSE) support. Vendoring them as local workspace crates allows us to fix lint violations, apply project-specific improvements, and remove transitive dependency churn without waiting for upstream releases.Changes
crates/forge_eventsource_stream— new crate vendored fromeventsource-stream. Provides aStream-based SSE parser that works over anyStream<Item = Result<Bytes, _>>. IncludesEventStream,Event,EventStreamError, and theEventsourceextension trait.crates/forge_eventsource— new crate vendored fromreqwest-eventsource. Wrapsforge_eventsource_streamwith reqwest-specific glue: automatic reconnection, retry policy,Last-Event-IDtracking,RequestBuilderExt, and anEventSourceStreamimplementation.reqwest-eventsourceandeventsource-streamfrom[workspace.dependencies]; addedforge_eventsourceandforge_eventsource_streampointing to the new crate paths.forge_app,forge_infra,forge_repo, andforge_servicesCargo.tomland source imports to reference the new workspace crates.Key Implementation Details
event_stream.rsnow usesstr::strip_prefix(is_bom)(passing the predicate function directly) instead of the unsafe index&string[1..], eliminating bothclippy::string_sliceandclippy::indexing_slicingviolations while correctly handling the 3-byte UTF-8 encoding of U+FEFF.Error::InvalidStatusCodeandError::InvalidContentTypeinforge_eventsourcenow carryBox<Response>instead of bareResponse, resolvingclippy::result_large_errwithout changing the public API semantics.forge_repothat previously passed the response directly now dereference via*response.update_environmentimpl inforge_services::mcp::servicetests was converted from thefn … -> impl Futureform to idiomaticasync fn, fixingclippy::manual_async_fn.EventBuilder::dispatchhad continuation lines that lacked the required indentation, causingclippy::doc_lazy_continuation; these are now correctly indented.Testing