Skip to content

Conversation

@p1-0tr
Copy link

@p1-0tr p1-0tr commented Jun 5, 2025

In case the runner crashes it would be nice to return an error to the
user. So, add an error handler on the proxy and use it to try to figure
out if the runner crashed and format the response error accordingly.

Based on: #68

@p1-0tr p1-0tr requested review from doringeman and xenoscopic June 5, 2025 12:05
proxyLog: proxyLog,
}

proxy.ErrorHandler = func(w http.ResponseWriter, req *http.Request, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is going to be sent back to OpenAI clients, I would try to structure the error responses in a format they can parse. Documentation is a little sparse, but Google says the error format looks like:

{
  "error": {
    "message": "Invalid 'messages[1].content': string too long. Expected a string with maximum length 1048576, but got a string with length 1540820 instead.",
    "type": "invalid_request_error",
    "param": "messages[1].content",
    "code": "string_above_max_length"
  }
}

The only docs I can find for the API are https://platform.openai.com/docs/api-reference/responses-streaming/error

In case the runner crashes it would be nice to return an error to the
user. So, add an error handler on the proxy and use it to try to figure
out if the runner crashed and format the response error accordingly.

Signed-off-by: Piotr Stankiewicz <[email protected]>
@p1-0tr p1-0tr force-pushed the ps-fwd-runner-error branch from fe4ca85 to aaacee4 Compare June 17, 2025 12:56
@p1-0tr p1-0tr marked this pull request as ready for review June 17, 2025 12:56
@p1-0tr p1-0tr requested a review from xenoscopic June 17, 2025 12:56
Copy link
Contributor

@doringeman doringeman left a comment

Choose a reason for hiding this comment

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

How can I easily test this to see the error?

Copy link
Contributor

@doringeman doringeman left a comment

Choose a reason for hiding this comment

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

LGTM!

@p1-0tr p1-0tr merged commit e57dcc0 into main Jun 18, 2025
4 checks passed
@p1-0tr p1-0tr deleted the ps-fwd-runner-error branch June 18, 2025 06:22
doringeman pushed a commit to doringeman/model-runner that referenced this pull request Sep 23, 2025
* Adds Total and Pulled fields to ProgressMessage struct to track the total bytes to transfer and bytes transferred so far

* Use uint64 type to represent pulled and total
doringeman pushed a commit to doringeman/model-runner that referenced this pull request Sep 24, 2025
* Adds Total and Pulled fields to ProgressMessage struct to track the total bytes to transfer and bytes transferred so far

* Use uint64 type to represent pulled and total
doringeman pushed a commit to doringeman/model-runner that referenced this pull request Oct 2, 2025
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.

4 participants