Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions miles/rollout/session/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@ async def chat_completions(request: Request, session_id: str):
session.append_record(record)
# --- lock released here ---

# Signal abort to the agent via a header so it can stop immediately,
# independent of how the caller's LLM client normalizes finish_reason.
# (litellm remaps "abort" → "stop" or "tool_calls" in some versions,
# masking the signal; reading raw response headers is the only
# reliable cross-version detection path.)
if choice.get("finish_reason") == "abort":
result["headers"]["x-sglang-aborted"] = "1"

return backend.build_proxy_response(result)
finally:
_inflight_chat["count"] -= 1
Expand Down
Loading