Skip to content

fix: fix processing null field#555

Merged
hittyt merged 1 commit intoalibaba:mainfrom
ninan-nn:hotfix/fix_server_response
Mar 24, 2026
Merged

fix: fix processing null field#555
hittyt merged 1 commit intoalibaba:mainfrom
ninan-nn:hotfix/fix_server_response

Conversation

@ninan-nn
Copy link
Collaborator

@ninan-nn ninan-nn commented Mar 24, 2026

Summary

  • restore lifecycle route serialization to omit None fields in JSON responses instead of emitting explicit null
  • align the lifecycle OpenAPI contract so response-side optional fields are omitted when unset, while request-side nullable inputs that are still intentionally supported remain nullable
  • update route tests and lifecycle docs to reflect the no-null response contract used for backward compatibility with released SDKs

What This Fixes

This PR addresses the lifecycle compatibility issue behind issue #550.

Before this change, POST /sandboxes, GET /sandboxes/{id}, and GET /sandboxes could serialize optional response fields such as metadata, expiresAt, status.reason, status.message, and status.lastTransitionAt as explicit JSON null values.

That behavior broke older released Python SDK versions which distinguished between:

  • field omitted
  • field explicitly present with null

In particular, metadata: null could trigger client-side parsing failures during sandbox creation.

After this change:

  • lifecycle responses omit unset optional fields instead of returning null
  • manual-cleanup sandboxes are represented by an omitted expiresAt field in responses
  • request-side nullable inputs that are still part of the API surface, such as timeout and image.auth, remain documented as nullable in the spec

Testing

  • cd server && uv run pytest tests/test_routes_create_delete.py tests/test_routes_get_sandbox.py tests/test_routes_list_sandboxes.py
  • passed: 16 passed

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1713df6a0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ninan-nn ninan-nn force-pushed the hotfix/fix_server_response branch from f1713df to 577d45a Compare March 24, 2026 09:05
@ninan-nn ninan-nn force-pushed the hotfix/fix_server_response branch from 577d45a to 790c4aa Compare March 24, 2026 09:14
@Pangjiping Pangjiping added bug Something isn't working component/server labels Mar 24, 2026
Copy link
Collaborator

@Pangjiping Pangjiping left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@hittyt hittyt left a comment

Choose a reason for hiding this comment

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

LGTM

@hittyt hittyt merged commit ad3a576 into alibaba:main Mar 24, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working component/server sdks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants