Skip to content

fix(sdk): handle 204 No Content responses without JSON decoding#4133

Open
H4ck3r-netizen wants to merge 1 commit into
orchestration-agent:mainfrom
H4ck3r-netizen:fix/sdk-204-response
Open

fix(sdk): handle 204 No Content responses without JSON decoding#4133
H4ck3r-netizen wants to merge 1 commit into
orchestration-agent:mainfrom
H4ck3r-netizen:fix/sdk-204-response

Conversation

@H4ck3r-netizen
Copy link
Copy Markdown

Summary

Fixes #4086

The SDK's OrchestratorClient._request method was attempting to decode an empty body as JSON when the server returns 204 No Content (e.g., on delete_agent or stop_agent). This caused cleanup automation to fail after the server already completed the action.

Changes

  • Check resp.status == 204 and empty body before calling json.loads
  • Return empty dict {} for 204 responses and empty bodies
  • Handle HTTPError with 204 code gracefully
  • Add regression tests in tests/test_sdk_client.py

Testing

  • 5 new tests covering 204 handling, empty body, normal JSON parsing, and error paths
  • All tests pass: pytest tests/test_sdk_client.py -v

Bounty

This PR addresses the $4k bounty on issue #4086.

- Check response status and body length before json.loads in _request
- Return empty dict for 204 responses and empty bodies
- Add regression tests for 204 handling on delete_agent and stop_agent

Fixes orchestration-agent#4086
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.

[ Bounty $4k ] [ SDK ] Handle 204 responses without JSON decoding — delete workflow

1 participant