Merged
Conversation
Current State (2592 lines, 6 files)
regular/responses/
├── mod.rs (20 lines) # Module exports
├── context.rs (70 lines) # ResponsesContext
├── types.rs (18 lines) # Just BackgroundTaskInfo ← merge into context.rs
├── conversions.rs (428 lines) # responses_to_chat, chat_to_responses
├── handlers.rs (812 lines) # Entry points + non-MCP execution + load_conversation_history
└── tool_loop.rs (1244 lines) # ALL MCP tool loop logic (too big!)
Proposed Structure (mirroring harmony pattern)
regular/responses/
├── mod.rs (~30 lines) # Module exports
├── context.rs (~90 lines) # ResponsesContext + BackgroundTaskInfo (merged)
├── conversions.rs (428 lines) # Unchanged
├── common.rs (~250 lines) # NEW: Shared helpers
│ # - ToolLoopState (from tool_loop.rs)
│ # - prepare_chat_tools_and_choice
│ # - extract_all_tool_calls_from_chat
│ # - convert_mcp_tools_to_chat_tools
│ # - build_mcp_list_tools_item
│ # - build_mcp_call_item
│ # - generate_mcp_id
│ # - load_conversation_history (from handlers.rs)
├── handlers.rs (~100 lines) # THIN: Entry points only
│ # - route_responses (dispatches to sync/streaming)
│ # - route_responses_sync
│ # - route_responses_streaming
├── non_streaming.rs (~400 lines) # NEW: Non-streaming execution
│ # - route_responses_internal (from handlers.rs)
│ # - execute_tool_loop (from tool_loop.rs)
│ # - execute_without_mcp (from handlers.rs)
└── streaming.rs (~700 lines) # NEW: Streaming execution
# - execute_tool_loop_streaming (from tool_loop.rs)
# - execute_tool_loop_streaming_internal
# - convert_and_accumulate_stream
# - ChatResponseAccumulator
# - convert_chat_stream_to_responses_stream (from handlers.rs)
# - process_and_transform_sse_stream (from handlers.rs)
# - StreamingResponseAccumulator (from handlers.rs)
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
slin1237
approved these changes
Jan 5, 2026
jamesjxliu
pushed a commit
to jamesjxliu/sglang
that referenced
this pull request
Jan 6, 2026
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.
Motivation
The current state of regular/responses module has a misleading structure.
Current State (2592 lines, 6 files)
Modifications
Proposed Structure (mirroring harmony pattern)
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci) or contact authorized users to do so.