Repository navigation
Conversation
gdevenyi
left a comment
There was a problem hiding this comment.
Thank you for this fix. The crash is gone: I ran the CLI against a server that returns an empty 502, and it now prints {"statusCode": 502} instead of the traceback. Two changes are necessary before we can merge:
-
The commit scope fails Commitlint.
fix(odc-cli): ...uses the scopeodc-cli, butcommitlint.config.tsaccepts only workspace names inscope-enum, andcli/is not a pnpm workspace. The Commitlint CI job will fail on this commit. Please reword it tofix: report the status for an error response with an empty body(no scope) and force-push. -
The status code is still lost for an error body that is an object. In
cli/odc-cli:216-221,statusCodeis added only when the body is not adict. A proxy that returns502with an HTML body goes through_build_response, which stores{'error': 'Invalid JSON response'}. That is adict, so the output is{"error": "Invalid JSON response"}with no status. Issue #1779 asks forstatusCodeon every failure. Please setprops['statusCode'] = self.status or 'N/A'for every non-2xx response, then mergeself.dataon top when it is adict, so an API body that has its ownstatusCodestill wins. For a body that is not adict, also adderrorfromhttp.HTTPStatus(self.status).phrase(catchValueErrorfor a status code that is not standard), so the output matches the expected{"statusCode": 405, "error": "Method Not Allowed"}in the issue.httpis in the standard library and works on Python 3.8.
If you hand this to Claude Code, Sonnet 5 is the right size, because the change is in one file and the items above specify all of it.
Reviewed at commit 4dbfdae.
The CLI printed a traceback for an empty 502 or 405 response. Every non-2xx response now carries its statusCode, and a non-object body gets the standard reason phrase as error. An API body with its own statusCode still wins. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
4dbfdae to
43692e6
Compare
Fixes #1779
Summary
Test
🤖 Generated with Claude Code